Compare commits

...

142 Commits

Author SHA1 Message Date
Sal b0f89a5dba Merge branch 'easy-colors' into 'master'
Caret color codes in server name

See merge request KartKrew/Kart-Public!218
2020-08-30 21:49:03 -04:00
James R daf6e66268 Fix stupid NONET
(cherry picked from commit 679bfa21edec6b652def93082da5586e6c755678)
2020-08-29 18:19:39 -07:00
James R 95a026c98d C90?
(cherry picked from commit 1f38db46298181d117432e12e88b326a92b4b785)
2020-08-29 18:19:15 -07:00
James R 54c3aed86c Convert caret color codes to SRB2 color codes 2020-08-27 15:44:06 -07:00
James R f802e9fbcb Convert from caret colors when sending SERVERINFO 2020-08-27 15:43:20 -07:00
Sal 5e7926d87f Merge branch 'check-defaultdir' into 'master'
Check ~/.srb2kart for srb2.srb

See merge request KartKrew/Kart-Public!215
2020-08-27 14:08:17 -04:00
James R 4c816f4059 Say DEFAULTDIR not .srb2kart 2020-08-26 23:37:52 -07:00
James R 6e3facf8f4 Check DEFAULTDIR for srb2.srb after cwd 2020-08-26 20:20:40 -07:00
Sal f87b883ba5 Merge branch 'various-compiling-fixes-2' into 'master'
Fix some compile flags

See merge request KartKrew/Kart-Public!213
2020-08-26 09:58:35 -04:00
Sal 7c69e49a05 Merge branch 'too-many-characters' into 'master'
Warn players when going over the skin limit

See merge request KartKrew/Kart-Public!214
2020-08-26 09:58:22 -04:00
ThatAwesomeGuy173 27b72ccbf5 Replace 'ignoring skin' debug print with a proper console warning 2020-08-25 23:13:58 -06:00
James R 04d774c765 Fix NOHW compiling 2020-08-24 18:06:00 -07:00
James R 3437b0690a Kill NOHS 2020-08-24 17:58:39 -07:00
James R 16fc87edcf Fix NOMIXER compiling 2020-08-24 17:55:42 -07:00
James R fbde926497 Fix NOPNG compiling 2020-08-24 17:52:55 -07:00
James R 0d57ba1d02 Fix NOGME compiling 2020-08-24 17:51:01 -07:00
Sally Coolatta 3ce6b8a54f Fix version string 2020-08-23 04:44:05 -04:00
Sal d0629a9c13 Merge branch 'fix-ogl-timedemo' into 'master'
Fix timedemo in OpenGL mode

See merge request KartKrew/Kart-Public!209
2020-08-23 04:38:57 -04:00
Sal 3f16ef2eaa Merge branch 'misc-optimizations' into 'master'
Remove ESLOPE POLYOBJECTS POLYOBJECTS_PLANES #ifdefs (backport srb2 2.2)

See merge request KartKrew/Kart-Public!204
2020-08-23 04:38:05 -04:00
James R 035fab5f6c Merge branch 'demoleak-fix' into 'master'
Fix replay recording memory leak

See merge request KartKrew/Kart-Public!208
2020-08-22 21:42:34 -04:00
Hannu Hanhi 4210352be9 Fix timedemo in OpenGL mode 2020-08-23 00:10:50 +03:00
Hannu Hanhi 5c13727aac Fix replay recording memory leak 2020-08-22 22:04:45 +03:00
FlykeSpice c09cb6d762 Remove POLYOBJECTS POLYOBJECTS_PLANES #ifdefs(backport from srb2 2.2) 2020-08-20 13:02:13 -04:00
FlykeSpice 00137ef4ea Remove ESLOPE #ifdef(backport from srb2 2.2) 2020-08-20 13:02:13 -04:00
Sal 79c299bf31 Merge branch 'port-port-port' into 'master'
2.2's random client port

See merge request KartKrew/Kart-Public!201
2020-08-20 12:19:52 -04:00
Sal 67b37e54b6 Merge branch 'snapback' into 'master'
Instantaneous lookback camera (v2 backport)

See merge request KartKrew/Kart-Public!203
2020-08-20 12:19:41 -04:00
Sal 4c363db516 Merge branch 'gme-fixes-cleanup' into 'master'
GME cleanup and fixes

See merge request KartKrew/Kart-Public!202
2020-08-20 02:07:19 -04:00
lachwright d0d6128053 Instantaneous lookback camera (v2 backport) 2020-08-20 13:41:03 +08:00
Steel Titanium e3f07b33bb GME cleanup and fixes
Just some stuff backported from SRB2 2.2, well mostly

get_zlib_error function to reduce code duplication

Return false if it fails to load the VGZ lump

Reduce redundant calls to gme_set_equalizer

Fix sometimes loading a VGZ crashing the game
2020-08-19 22:39:12 -04:00
James R 94512c49e4 -clientport (it's back!) and -serverport, which is an alias to -port
If you ever need to, you can change the client port number.

(cherry picked from commit 843d9b9f0a345330d97c579e94f208eb2b65c156)
2020-08-19 18:16:54 -07:00
James R b77541b51d Use a pointer for port_name
Using strcpy is stupid because we don't know how long the argument would be.
There's no need for a buffer anyway.

(cherry picked from commit 4e321012894b2aa87e312597f19be26b30545a8b)
2020-08-19 18:16:53 -07:00
James R b1f5e66a23 Use a random port when connecting
(cherry picked from commit f584b61c93a97e1a9852f306acba673ced21e03a)
2020-08-19 18:16:53 -07:00
Sal a335d6b583 Merge branch 'fix-nocurl' into 'master'
Fix NOCURL compiling

See merge request KartKrew/Kart-Public!197
2020-08-19 20:36:14 -04:00
Sal c6f85cde59 Merge branch 'httpsource-without-curl' into 'master'
Let servers send httpsource without curl

See merge request KartKrew/Kart-Public!196
2020-08-19 20:36:06 -04:00
Sal 8ee7443705 Merge branch 'kimmy-osx-fixes' into 'master'
[OSX] Fix "SIGILL: illegal instruction" on macOS Catalina

See merge request KartKrew/Kart-Public!194
2020-08-18 03:52:47 -04:00
James R 7a05a8acf7 Do not do master server things when NOCURL 2020-08-16 21:42:58 -07:00
James R 5dc3ca3934 Remove HAVE_CURL guards on sending httpsource 2020-08-16 20:39:46 -07:00
Kimberly Wilber 1bfcec9242 [OSX] Fix "SIGILL: illegal instruction" on macOS Catalina
on OSX, strncpy may copy to overlapping (protected) memory. this
sometimes happens when loading WAD files.

This patch eliminates these problems for me
2020-08-15 12:16:05 -04:00
James R a772096757 dumbass doesn't test changes before pushing directly to next
(cherry picked from commit be14b8a564a89a5afb84ac19f1586f3db7f68367)
2020-08-14 08:27:25 -07:00
Sal 06f36224ee Merge branch 'http-mserv' into 'master'
Make the HTTP Master Server official

See merge request KartKrew/Kart-Public!193
2020-08-10 16:49:47 -04:00
James R 1a1c215a91 Add http-mserv to fuck 2020-08-09 23:32:43 -07:00
Sal 9590a769ba Merge branch 'maxnetnodes-2-electric-boogaloo' into 'master'
Bump MAXNETNODES to 127

See merge request KartKrew/Kart-Public!192
2020-08-09 22:28:50 -04:00
James R 9d9f8fd8a3 Bump MAXNETNODES to 127 2020-08-09 18:26:34 -07:00
Sal b320256a47 Merge branch 'master' into 'master'
Clarify addon-related messages

See merge request KartKrew/Kart-Public!190
2020-08-05 06:48:44 -04:00
AJ Martinez 8284caf1bc Clarify addon-related messages 2020-08-05 00:40:56 -05:00
Sal c3c466575c Merge branch 'fix-pk3-leak' into 'master'
Fix memory leak in W_ReadLumpHeaderPwad

See merge request KartKrew/Kart-Public!182
2020-07-01 18:36:48 -04:00
Sal 9f4b4d84a6 Merge branch 'http-useragent-fix' into 'master'
Fix user agent for HTTP downloads being set as SRB2Kart/v1.1.2

See merge request KartKrew/Kart-Public!185
2020-07-01 18:36:33 -04:00
Sal d2098c23fc Merge branch 'ogl-color-fix3' into 'master'
Ogl colormap fix third attempt

See merge request KartKrew/Kart-Public!184
2020-07-01 18:36:19 -04:00
Sal b6272fa299 Merge branch 'chatbug-fix' into 'master'
clientside ack fix

See merge request KartKrew/Kart-Public!186
2020-07-01 18:35:57 -04:00
Ashnal ad94b29558 Experiemntal clientside ack fix
Stops the client from using reliable packets before joining a server
Clients can time out during addon loading
sending reliable packets before then can cause out of order acks
This causes joinbug, chatbug, and chatspam, as well as
general server instability due to unnecesary packetspam
2020-06-27 23:43:15 -04:00
Steel Titanium 3af4aaff9c Fix user agent for HTTP downloads being set as SRB2Kart/v1.1.2 2020-06-23 18:39:02 -04:00
James R bae37aea2c ADD to the buffer size 2020-06-14 19:13:22 -07:00
Hannu Hanhi 44159de7f3 Colormap alpha handling was still wrong, hopefully it's correct now 2020-06-14 15:03:40 +03:00
Sal eea8c3776c Merge branch 'ogl-color-fix-fix' into 'master'
Fix bug in the OpenGL colormap bugfix

See merge request KartKrew/Kart-Public!183
2020-06-13 22:45:47 -04:00
Hannu Hanhi c382794109 Fix uninitialized alpha when reading colormaps 2020-06-13 23:34:13 +03:00
Hannu Hanhi 38c3d78d8a Cleaner version of the W_ReadLumpHeaderPwad memory leak fix 2020-06-13 21:37:33 +03:00
Hannu Hanhi 2f65955496 Add missing inflateEnd to fix memory leak in W_ReadLumpHeaderPwad 2020-06-13 17:07:05 +03:00
James R e7d949aeb2 masterserver_token is back 2020-06-12 23:47:08 -07:00
James R 9b3456a860 Merge remote-tracking branch 'origin/master' into http-mserv 2020-06-12 23:36:39 -07:00
Sal f7e74e8884 Merge branch 'ogl-encore-color-fix' into 'master'
Fix bug in OpenGL encore colormaps

See merge request KartKrew/Kart-Public!180
2020-06-12 22:39:18 -04:00
Hannu Hanhi d9e2336277 Guil's encore color bugfix with some additional cleanup 2020-06-01 21:14:17 +03:00
Sal 691a567f5d Merge branch 'fix-ogl-log-crash' into 'master'
Fix opengl crashing on startup due to lack of checks

See merge request KartKrew/Kart-Public!179
2020-05-28 09:47:16 -04:00
Steel Titanium 3f3cb2c976 Fix opengl crashing on startup due to lack of checks
Also fixes the log file not being written to the home directory.
2020-05-23 16:21:26 -04:00
Sryder e229aabf22 Merge branch 'fix-clang-compile' into 'master'
Fix clang compiling

See merge request KartKrew/Kart-Public!176
2020-05-20 11:49:47 -04:00
Sryder 6b8ea22bdb Merge branch 'opengl-maybe-uninitialised' into 'master'
Some uninitialised variables that GCC 4.4 complains about

See merge request KartKrew/Kart-Public!177
2020-05-20 11:49:34 -04:00
Sal 5f70d3e170 Merge branch 'visplane-fix' into 'master'
Fix visplane getting allocated twice

See merge request KartKrew/Kart-Public!172
2020-05-20 10:11:06 -04:00
Sryder 66930a0277 Initialise these to 0 just to stop GCC 4.4 from complaining.
This should be okay since 0 generally means "nothing" for these, and they should always be set before being used later on.
2020-05-20 11:47:22 +01:00
Sryder 290abe4fce D_ModifierKeyResponder is unused now so remove it. 2020-05-20 11:37:38 +01:00
Sryder c70cf4806b Merge branch 'extra-travis-deploy' into 'master'
Fix Travis Deployment

See merge request KartKrew/Kart-Public!174
2020-05-19 20:10:42 -04:00
Sal e42ae1ed79 Merge branch 'freeplay-be-nice' into 'master'
Also apply HUD translucency to FREE PLAY

See merge request KartKrew/Kart-Public!161
2020-05-19 17:29:05 -04:00
Sal bb7481a13e Merge branch 'mr-ogl-boostpad-fix' into 'master'
Fix wrong orientation in some boost pads in ogl

See merge request KartKrew/Kart-Public!173
2020-05-19 17:27:24 -04:00
Sryder bca1dd42a3 Use xenial to build all the versions newer than trusty
I'm not 100% sure why we can't use newer series to build the newer installers. But this seems to be what vanilla does
2020-05-19 20:45:49 +01:00
Sal cb9e6473a0 Merge branch 'use-extern-you-idiot' into 'master'
Fix GCC 10 linking errors

See merge request KartKrew/Kart-Public!170
2020-05-16 09:01:46 -04:00
Hannu Hanhi c3e1e1df26 Fix wrong orientation some boost pads in ogl 2020-05-16 13:47:21 +03:00
filpAM 5acafa5a87 Fix visplane getting allocated twice 2020-05-16 00:20:52 +00:00
Sal f60d05764d Merge branch 'clearbans-please' into 'master'
Write empty file on clearbans

See merge request KartKrew/Kart-Public!156
2020-05-15 19:29:11 -04:00
Sal f0f4b7bc1e Merge branch 'nomixer-fix' into 'master'
Fix "NOMIXER" flag compiling

See merge request KartKrew/Kart-Public!159
2020-05-15 19:28:54 -04:00
Sal 43874c3a4d Merge branch 'now-we-spin-in-spinout-only' into 'master'
No more first person hyper spin

See merge request KartKrew/Kart-Public!160
2020-05-15 19:28:38 -04:00
Sal e4766bbaf1 Merge branch 'ferror-errno-yareyare' into 'master'
Fix false file error reporting

See merge request KartKrew/Kart-Public!162
2020-05-15 19:27:08 -04:00
Sal f2a9981299 Merge branch 'alias-recursion-fix' into 'master'
Fix alias recursion never counting down

See merge request KartKrew/Kart-Public!166
2020-05-15 19:24:02 -04:00
Sryder e0aa6ef252 Use bionic to build focal version because it has GCC 4.8? 2020-05-16 00:02:33 +01:00
James R fcbe4e668f Set timeout on HMS connections 2020-05-15 13:20:40 -07:00
James R bd3ea52cba ok
(cherry picked from commit 0b9c20cc7086000548e02b39c1abf94ffb56feae)
2020-05-15 11:21:40 -07:00
James R 6bd6b3f38e Add missing extern to colortranslations 2020-05-15 10:00:05 -07:00
Monster Iestyn 697c7f859e added missing extern keyword for ms_RoomId in mserv.h (the definition is already in the .c file in this case)
(cherry picked from commit 064f4bcf349e9600552a0b99bd0fbfb3cbcf0958)
2020-05-15 09:58:49 -07:00
Monster Iestyn f89400c728 turn all non-extern variables in s_sound.h into externs (and put their real definitions in the .c file)
(cherry picked from commit dab212dc56936dd92a935d0c81003ff1d35ee2ee)
2020-05-15 09:58:28 -07:00
Monster Iestyn 05c8865528 make savegamename in doomdef.h an extern, put the actual definition in d_main.c
(cherry picked from commit 89cd756cd83e4a03a34d1f16da18142d8167d889)
2020-05-15 09:52:16 -07:00
James R e8a2397dea Rename hms123311.c to http-mserv.c
HMS lives on in our hearts!
2020-05-14 17:26:10 -07:00
James R a6ce21b450 Use Unlock_state here too 2020-05-14 17:23:06 -07:00
James R 85fef2655c Resize response body buffer as needed 2020-05-14 17:19:25 -07:00
Sryder dbcbbf1ae4 Remove now unsupported distros from deployer
Add new supported distros to deployer
2020-05-14 13:16:49 +01:00
Monster Iestyn db5cb986ee Detect infinite alias self-recursion mixed with other commands, such as in the case of `alias a "echo test; a"; a`.
(Unfortunately, this does not work if "wait" is used instead of "echo", but oh well)

(cherry picked from commit 797ca99f42)
2020-05-13 16:03:26 -07:00
James R 430fb27ec8 Bind HMS connection with -bindaddr 2020-05-13 15:29:17 -07:00
James R 9dc72f46a2 Identify this branch with VERSIONSTRING
This is temporary.
2020-05-12 19:27:54 -07:00
James R 2f63f97692 Reset the masterserver address if the old one was set by the config 2020-05-12 19:22:30 -07:00
James R 72852ab341 Clarify where debug prints go when using masterserver_debug 2020-05-12 19:22:15 -07:00
James R be3da445c3 Use IPv4 for master server connections
Your server's address is gathered from the request, so it needs to be IPv4!
2020-05-12 18:52:55 -07:00
James R bdcae79cd2 Use new two digit version number for HMS 2020-05-12 17:51:27 -07:00
James R 233e6627de Merge remote-tracking branch 'origin/master' into http-mserv 2020-05-12 17:50:32 -07:00
James R e2733600cd Oops a debug condition snuck in there 2020-04-28 14:35:03 -07:00
James R a1aa2a5e12 Fix switching the master server 2020-04-28 14:21:57 -07:00
James R e950efa5fc Put some mutex on CONS_Printf etc. hahaha 2020-04-28 13:08:43 -07:00
James R e20dccafd4 Fucking multithreading in the server registration
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2020-04-28 12:33:50 -07:00
James R 8f3820db66 Wait for threads before SDL_Quit (lol) 2020-04-27 18:03:10 -07:00
James R bdddeb9ecf Create cond if it doesn't exist when signaling 2020-04-27 18:01:27 -07:00
James R 88bcac0168 Use malloc for hms 2020-04-26 21:56:59 -07:00
Steel Titanium ba989dce10 Support for http downloads
(cherry picked from commit 6fcc06bf72)

(cherry picked just the libcurl stuff)
2020-04-26 20:01:15 -07:00
James R c96506dd3b Make mod update, room list and server list multithreaded
This took fucking ages and it still fails sometimes in edge cases, but I
don't give a FUCK right now.
2020-04-26 19:46:35 -07:00
James R c472a9f50d Multithreading in my SRB2??? 2020-04-17 20:05:29 -07:00
James R 7b714a225b WHY THE FUCK DID I DO THIS 2020-04-15 22:04:55 -07:00
James R 60bc61ef70 Oops 2020-04-14 19:41:32 -07:00
James R 30b5ec14fd Handle NULL hms buffer 2020-04-14 16:55:14 -07:00
James R 7488991ecd Compiler errors: won't stop, can't stop 2020-04-13 23:31:26 -07:00
James R a0de059235 masterserver_update_rate cvar determines wait between updates in minutes
The new default is 15 minutes as well. And if you think that's too long, I have
confirmed that the Master Server delists inactive servers after a whopping 40
minutes, at least.
2020-04-13 23:10:06 -07:00
James R ee6de3800e Don't try to update right after registering 2020-04-13 22:54:58 -07:00
James R 2c5566b013 Add a hack so the 'All' room isn't display for hosting 2020-04-13 22:31:11 -07:00
James R 1201e89132 Kill the old mserv, long live HMS! 2020-04-13 22:23:01 -07:00
James R 7255d360e1 Clean up header text 2020-04-13 21:20:29 -07:00
James R 032adadd86 HTTP update alert 2020-04-12 20:37:46 -07:00
James R 48b2112af7 Fix some goofs 2020-04-12 18:33:53 -07:00
James R 03caf27d92 Bruh 2020-04-12 18:27:01 -07:00
James R 269746fe01 Clean up a bunch of stuff and follow the Master Server API more closely 2020-04-12 18:25:59 -07:00
James R 3f4224ed37 Windows certs do work, thanks Steel! 2020-04-12 17:51:30 -07:00
James R 969fe0b28e Handle more errors 2020-04-12 17:51:05 -07:00
James R ef71bef6f3 Kill masterserver_token 2020-04-12 17:15:39 -07:00
James R f0cc851b29 This will be the Master Server in 2020 2020-03-20 20:37:26 -07:00
James R 3f9f07af84 Use https because my web server redirects 2020-03-01 12:31:49 -08:00
James R 56fac10b14 strtok can return NULL 2020-03-01 12:15:48 -08:00
James R 9d42a5ad5e This time I fucked up 2020-03-01 11:59:54 -08:00
James R aca2e97c84 Windows gaysed: the sequel 2020-03-01 11:54:21 -08:00
James R ceb332e580 Windows is weird 2020-03-01 11:46:02 -08:00
James R 32a34cc1b2 masterserver_debug to set CURLOPT_VERBOSE 2020-03-01 11:39:27 -08:00
James R 1959a9b107 Don't show "All" room when hosting 2020-03-01 11:19:59 -08:00
James R 8756ef15a2 I don't even know my own website 2020-03-01 11:17:56 -08:00
James R 47a5f9ef94 lol 2020-03-01 10:59:25 -08:00
James R e2507f390f The big bad HTTP master server
Cvars:

http_masterserver is the url to the master server's API.
masterserver_token may be an authentication token.
2020-03-01 02:36:56 -08:00
James R 1d6020883c Forgot includes 2019-10-07 18:10:33 -07:00
James R abaefa05b1 ferror does not return errno, are you stupid?
Use M_FileError to return the proper error description, or "end-of-file".
2019-10-07 17:55:31 -07:00
James R 5e9082fb77 Also apply HUD translucency to FREE PLAY 2019-09-19 20:29:51 -07:00
James R 3801f93181 Let first person camera work in demos 2019-09-15 00:32:01 -07:00
filpAM fe4cbd7ba1 Fix "NOMIXER" flag compiling 2019-09-13 13:20:44 -04:00
James R 3838700f2c Save bans when cleared too
(Why doesn't it work for I_Quit?)
2019-08-22 15:18:14 -07:00
77 changed files with 2477 additions and 2437 deletions

View File

@ -439,6 +439,30 @@ matrix:
# List Ubuntu LTS, newest to oldest
# Then list non-LTS, newest to oldest
################################
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.8
compiler: gcc-4.8
dist: xenial
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
AND env(DPL_TERMINATE_MAIN) != "1"
env:
- _DPL_JOB_ENABLED=1
- _DPL_JOB_NAME=focal
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=focal
- PACKAGE_SUBVERSION=~20.04focal
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
- os: linux
addons:
apt:
@ -463,6 +487,30 @@ matrix:
- PACKAGE_DISTRO=bionic
- PACKAGE_SUBVERSION=~18.04bionic
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.8
compiler: gcc-4.8
dist: xenial
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
AND env(DPL_TERMINATE_MAIN) != "1"
env:
- _DPL_JOB_ENABLED=1
- _DPL_JOB_NAME=xenial
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=xenial
- PACKAGE_SUBVERSION=~16.04xenial
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
- os: linux
addons:
apt:
@ -505,59 +553,11 @@ matrix:
AND env(DPL_TERMINATE_MAIN) != "1"
env:
- _DPL_JOB_ENABLED=1
- _DPL_JOB_NAME=disco
- _DPL_JOB_NAME=eoan
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=disco
- PACKAGE_SUBVERSION=~19.04disco
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.8
compiler: gcc-4.8
dist: xenial
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
AND env(DPL_TERMINATE_MAIN) != "1"
env:
- _DPL_JOB_ENABLED=1
- _DPL_JOB_NAME=cosmic
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=cosmic
- PACKAGE_SUBVERSION=~18.10cosmic
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.8
compiler: gcc-4.8
dist: xenial
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
AND env(DPL_TERMINATE_MAIN) != "1"
env:
- _DPL_JOB_ENABLED=1
- _DPL_JOB_NAME=xenial
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=xenial
- PACKAGE_SUBVERSION=~16.04xenial
- PACKAGE_DISTRO=eoan
- PACKAGE_SUBVERSION=~19.10eoan
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
allow_failures:
- compiler: clang-3.5

View File

@ -35,6 +35,7 @@ set(SRB2_CORE_SOURCES
m_random.c
md5.c
mserv.c
http-mserv.c
s_sound.c
screen.c
sounds.c

View File

@ -63,7 +63,6 @@
# Compile with extra warnings, add 'WARNINGMODE=1'
# Compile without NASM's tmap.nas, add 'NOASM=1'
# Compile without 3D hardware support, add 'NOHW=1'
# Compile without 3D sound support, add 'NOHS=1'
# Compile with GDBstubs, add 'RDB=1'
# Compile without PNG, add 'NOPNG=1'
# Compile without zlib, add 'NOZLIB=1'
@ -136,7 +135,6 @@ NOPNG=1
NOZLIB=1
NONET=1
NOHW=1
NOHS=1
NOASM=1
NOIPX=1
EXENAME?=srb2dummy
@ -167,7 +165,6 @@ endif
ifdef PANDORA
NONX86=1
NOHW=1
NOHS=1
endif
ifdef WII
@ -217,7 +214,6 @@ NOPNG=1
NOZLIB=1
NONET=1
#NOHW=1
NOHS=1
NOASM=1
NOIPX=1
NONX86=1
@ -287,13 +283,6 @@ endif
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o
endif
ifdef NOHS
OPTS+=-DNOHS
else
OPTS+=-DHW3SOUND
OBJS+=$(OBJDIR)/hw3sound.o
endif
OPTS += -DCOMPVERSION
ifndef NONX86
@ -548,6 +537,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/w_wad.o \
$(OBJDIR)/filesrch.o \
$(OBJDIR)/mserv.o \
$(OBJDIR)/http-mserv.o\
$(OBJDIR)/i_tcp.o \
$(OBJDIR)/lzf.o \
$(OBJDIR)/vid_copy.o \
@ -941,19 +931,6 @@ $(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
endif
ifndef NOHS
$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_ds3d.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_ds3d/s_ds3d.c
$(OBJDIR)/s_fmod.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_fmod/s_fmod.c
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_openal/s_openal.c
endif
endif
endif

View File

@ -862,10 +862,8 @@ static inline void AM_drawWalls(void)
{
size_t i;
static mline_t l;
#ifdef ESLOPE
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
#endif
for (i = 0; i < numlines; i++)
{
@ -873,7 +871,6 @@ static inline void AM_drawWalls(void)
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
#ifdef ESLOPE
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
@ -888,7 +885,6 @@ static inline void AM_drawWalls(void)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
}
#undef SLOPEPARAMS
#endif
if (!lines[i].backsector) // 1-sided
{
@ -897,19 +893,11 @@ static inline void AM_drawWalls(void)
else
AM_drawMline(&l, WALLCOLORS);
}
#ifdef ESLOPE
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
{
if (backf1 == backc1 && backf2 == backc2
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
#else
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
{
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
#endif
{
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
@ -927,20 +915,10 @@ static inline void AM_drawWalls(void)
else
{
if (lines[i].flags & ML_NOCLIMB) {
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
}
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) {
#else
else if (lines[i].backsector->ceilingheight
!= lines[i].frontsector->ceilingheight) {
#endif
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
}
else
@ -948,20 +926,10 @@ static inline void AM_drawWalls(void)
}
else
{
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, FDWALLCOLORS); // floor level change
}
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) {
#else
else if (lines[i].backsector->ceilingheight
!= lines[i].frontsector->ceilingheight) {
#endif
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
}
else

View File

@ -543,10 +543,7 @@ static void COM_ExecuteString(char *ptext)
if (!stricmp(com_argv[0], a->name))
{
if (recursion > MAX_ALIAS_RECURSION)
{
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
recursion = 0;
}
else
{
char buf[1024];
@ -578,8 +575,10 @@ static void COM_ExecuteString(char *ptext)
}
WRITESTRING(write, read);
// Monster Iestyn: keep track of how many levels of recursion we're in
recursion++;
COM_BufInsertText(buf);
recursion--;
}
return;
}

View File

@ -31,6 +31,7 @@
#include "i_video.h"
#include "z_zone.h"
#include "i_system.h"
#include "i_threads.h"
#include "d_main.h"
#include "m_menu.h"
#include "filesrch.h"
@ -45,6 +46,16 @@
#define MAXHUDLINES 20
#ifdef HAVE_THREADS
I_mutex con_mutex;
# define Lock_state() I_lock_mutex(&con_mutex)
# define Unlock_state() I_unlock_mutex(con_mutex)
#else/*HAVE_THREADS*/
# define Lock_state()
# define Unlock_state()
#endif/*HAVE_THREADS*/
static boolean con_started = false; // console has been initialised
boolean con_startup = false; // true at game startup, screen need refreshing
static boolean con_forcepic = true; // at startup toggle console translucency when first off
@ -170,6 +181,8 @@ static void CONS_hudlines_Change(void)
{
INT32 i;
Lock_state();
// Clear the currently displayed lines
for (i = 0; i < con_hudlines; i++)
con_hudtime[i] = 0;
@ -181,6 +194,8 @@ static void CONS_hudlines_Change(void)
con_hudlines = cons_hudlines.value;
Unlock_state();
CONS_Printf(M_GetText("Number of console HUD lines is now %d\n"), con_hudlines);
}
@ -188,12 +203,16 @@ static void CONS_hudlines_Change(void)
//
static void CONS_Clear_f(void)
{
Lock_state();
memset(con_buffer, 0, CON_BUFFERSIZE);
con_cx = 0;
con_cy = con_totallines-1;
con_line = &con_buffer[con_cy*con_width];
con_scrollup = 0;
Unlock_state();
}
// Choose english keymap
@ -369,20 +388,29 @@ void CON_Init(void)
for (i = 0; i < NUMINPUTS; i++)
bindtable[i] = NULL;
Lock_state();
// clear all lines
memset(con_buffer, 0, CON_BUFFERSIZE);
// make sure it is ready for the loading screen
con_width = 0;
Unlock_state();
CON_RecalcSize();
CON_SetupColormaps();
Lock_state();
//note: CON_Ticker should always execute at least once before D_Display()
con_clipviewtop = -1; // -1 does not clip
con_hudlines = atoi(cons_hudlines.defaultvalue);
Unlock_state();
// setup console input filtering
CON_InputInit();
@ -391,15 +419,23 @@ void CON_Init(void)
COM_AddCommand("cls", CONS_Clear_f);
//COM_AddCommand("english", CONS_English_f);
// set console full screen for game startup MAKE SURE VID_Init() done !!!
Lock_state();
con_destlines = vid.height;
con_curlines = vid.height;
Unlock_state();
if (!dedicated)
{
Lock_state();
con_started = true;
con_startup = true; // need explicit screen refresh until we are in Doom loop
consoletoggle = false;
Unlock_state();
CV_RegisterVar(&cons_msgtimeout);
CV_RegisterVar(&cons_hudlines);
CV_RegisterVar(&cons_speed);
@ -411,19 +447,27 @@ void CON_Init(void)
}
else
{
Lock_state();
con_started = true;
con_startup = false; // need explicit screen refresh until we are in Doom loop
consoletoggle = true;
Unlock_state();
}
}
// Console input initialization
//
static void CON_InputInit(void)
{
Lock_state();
// prepare the first prompt line
memset(inputlines, 0, sizeof (inputlines));
inputline = 0;
input_cur = input_sel = input_len = 0;
Unlock_state();
}
//======================================================================
@ -439,6 +483,8 @@ static void CON_RecalcSize(void)
char *tmp_buffer;
char *string;
Lock_state();
switch (cv_constextsize.value)
{
case V_NOSCALEPATCH:
@ -476,11 +522,18 @@ static void CON_RecalcSize(void)
// check for change of video width
if (conw == con_width)
{
Unlock_state();
return; // didn't change
}
Unlock_state();
tmp_buffer = Z_Malloc(CON_BUFFERSIZE, PU_STATIC, NULL);
string = Z_Malloc(CON_BUFFERSIZE, PU_STATIC, NULL); // BP: it is a line but who know
Lock_state();
oldcon_width = con_width;
oldnumlines = con_totallines;
oldcon_cy = con_cy;
@ -501,6 +554,8 @@ static void CON_RecalcSize(void)
con_line = &con_buffer[con_cy*con_width];
con_scrollup = 0;
Unlock_state();
// re-arrange console text buffer to keep text
if (oldcon_width) // not the first time
{
@ -525,7 +580,11 @@ static void CON_RecalcSize(void)
static void CON_ChangeHeight(void)
{
INT32 minheight = 20 * con_scalefactor; // 20 = 8+8+4
INT32 minheight;
Lock_state();
minheight = 20 * con_scalefactor; // 20 = 8+8+4
// toggle console in
con_destlines = (cons_height.value*vid.height)/100;
@ -535,13 +594,19 @@ static void CON_ChangeHeight(void)
con_destlines = vid.height;
con_destlines &= ~0x3; // multiple of text row height
Unlock_state();
}
// Handles Console moves in/out of screen (per frame)
//
static void CON_MoveConsole(void)
{
const fixed_t conspeed = FixedDiv(cons_speed.value*vid.fdupy, FRACUNIT);
fixed_t conspeed;
Lock_state();
conspeed = FixedDiv(cons_speed.value*vid.fdupy, FRACUNIT);
// instant
if (!cons_speed.value)
@ -563,6 +628,8 @@ static void CON_MoveConsole(void)
if (con_curlines < con_destlines)
con_curlines = con_destlines;
}
Unlock_state();
}
INT32 CON_ShiftChar(INT32 ch)
@ -587,27 +654,44 @@ void CON_ClearHUD(void)
{
INT32 i;
Lock_state();
for (i = 0; i < con_hudlines; i++)
con_hudtime[i] = 0;
Unlock_state();
}
// Force console to move out immediately
// note: con_ticker will set consoleready false
void CON_ToggleOff(void)
{
Lock_state();
if (!con_destlines)
{
Unlock_state();
return;
}
con_destlines = 0;
con_curlines = 0;
CON_ClearHUD();
con_forcepic = 0;
con_clipviewtop = -1; // remove console clipping of view
Unlock_state();
}
boolean CON_Ready(void)
{
return consoleready;
boolean ready;
Lock_state();
{
ready = consoleready;
}
Unlock_state();
return ready;
}
// Console ticker: handles console move in/out, cursor blinking
@ -615,7 +699,11 @@ boolean CON_Ready(void)
void CON_Ticker(void)
{
INT32 i;
INT32 minheight = 20 * con_scalefactor; // 20 = 8+8+4
INT32 minheight;
Lock_state();
minheight = 20 * con_scalefactor; // 20 = 8+8+4
// cursor blinking
con_tick++;
@ -673,6 +761,8 @@ void CON_Ticker(void)
if (con_hudtime[i] < 0)
con_hudtime[i] = 0;
}
Unlock_state();
}
//
@ -684,32 +774,51 @@ void CON_Ticker(void)
static void CON_InputClear(void)
{
Lock_state();
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
input_cur = input_sel = input_len = 0;
Unlock_state();
}
static void CON_InputSetString(const char *c)
{
Lock_state();
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
strcpy(inputlines[inputline], c);
input_cur = input_sel = input_len = strlen(c);
Unlock_state();
}
static void CON_InputAddString(const char *c)
{
size_t csize = strlen(c);
Lock_state();
if (input_len + csize > CON_MAXPROMPTCHARS-1)
{
Unlock_state();
return;
}
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur+csize], &inputlines[inputline][input_cur], input_len-input_cur);
memcpy(&inputlines[inputline][input_cur], c, csize);
input_len += csize;
input_sel = (input_cur += csize);
Unlock_state();
}
static void CON_InputDelSelection(void)
{
size_t start, end, len;
Lock_state();
if (input_cur > input_sel)
{
start = input_sel;
@ -728,27 +837,39 @@ static void CON_InputDelSelection(void)
input_len -= len;
input_sel = input_cur = start;
Unlock_state();
}
static void CON_InputAddChar(char c)
{
if (input_len >= CON_MAXPROMPTCHARS-1)
return;
Lock_state();
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur+1], &inputlines[inputline][input_cur], input_len-input_cur);
inputlines[inputline][input_cur++] = c;
inputlines[inputline][++input_len] = 0;
input_sel = input_cur;
Unlock_state();
}
static void CON_InputDelChar(void)
{
if (!input_cur)
return;
Lock_state();
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur-1], &inputlines[inputline][input_cur], input_len-input_cur);
inputlines[inputline][--input_len] = 0;
input_sel = --input_cur;
Unlock_state();
}
//
@ -1174,6 +1295,8 @@ static void CON_Print(char *msg)
S_StartSound(NULL, sfx_radio);
}
Lock_state();
if (!(*msg & 0x80))
{
con_line[con_cx++] = '\x80';
@ -1234,7 +1357,10 @@ static void CON_Print(char *msg)
}
if (*msg == '\0')
{
Unlock_state();
return;
}
// printable character
for (l = 0; l < (con_width-11) && msg[l] > ' '; l++)
@ -1252,6 +1378,8 @@ static void CON_Print(char *msg)
for (; l > 0; l--)
con_line[con_cx++] = *(msg++);
}
Unlock_state();
}
void CON_LogMessage(const char *msg)
@ -1283,6 +1411,7 @@ void CONS_Printf(const char *fmt, ...)
{
va_list argptr;
static char *txt = NULL;
boolean startup;
if (txt == NULL)
txt = malloc(8192);
@ -1315,11 +1444,16 @@ void CONS_Printf(const char *fmt, ...)
CON_LogMessage(txt);
#endif
Lock_state();
// make sure new text is visible
con_scrollup = 0;
startup = con_startup;
Unlock_state();
// if not in display loop, force screen update
if (con_startup)
if (startup)
{
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
@ -1633,8 +1767,13 @@ static void CON_DrawConsole(void)
//
void CON_Drawer(void)
{
Lock_state();
if (!con_started || !graphics_started)
{
Unlock_state();
return;
}
if (con_recalc)
CON_RecalcSize();
@ -1644,4 +1783,6 @@ void CON_Drawer(void)
else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS)
CON_DrawHudlines();
Unlock_state();
}

View File

@ -12,6 +12,7 @@
#include "d_event.h"
#include "command.h"
#include "i_threads.h"
#ifdef _WII
void CON_InitWii(void);
@ -21,6 +22,10 @@ void CON_Init(void);
boolean CON_Responder(event_t *ev);
#ifdef HAVE_THREADS
extern I_mutex con_mutex;
#endif
// set true when screen size has changed, to adapt console
extern boolean con_recalc;

View File

@ -76,7 +76,7 @@
boolean server = true; // true or false but !server == client
#define client (!server)
boolean nodownload = false;
static boolean serverrunning = false;
boolean serverrunning = false;
INT32 serverplayer = 0;
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
@ -1270,7 +1270,7 @@ static boolean CL_AskFileList(INT32 firstfile)
netbuffer->packettype = PT_TELLFILESNEEDED;
netbuffer->u.filesneedednum = firstfile;
return HSendPacket(servernode, true, 0, sizeof (INT32));
return HSendPacket(servernode, false, 0, sizeof (INT32));
}
/** Sends a special packet to declare how many players in local
@ -1306,13 +1306,75 @@ static boolean CL_SendJoin(void)
return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak));
}
static void
CopyCaretColors (char *p, const char *s, int n)
{
char *t;
int m;
int c;
if (!n)
return;
while (( t = strchr(s, '^') ))
{
m = ( t - s );
if (m >= n)
{
memcpy(p, s, n);
return;
}
else
memcpy(p, s, m);
p += m;
n -= m;
s += m;
if (!n)
return;
if (s[1])
{
c = toupper(s[1]);
if (isdigit(c))
c = 0x80 + ( c - '0' );
else if (c >= 'A' && c <= 'F')
c = 0x80 + ( c - 'A' );
else
c = 0;
if (c)
{
*p++ = c;
n--;
if (!n)
return;
}
else
{
if (n < 2)
break;
memcpy(p, s, 2);
p += 2;
n -= 2;
}
s += 2;
}
else
break;
}
strncpy(p, s, n);
}
static void SV_SendServerInfo(INT32 node, tic_t servertime)
{
UINT8 *p;
#ifdef HAVE_CURL
size_t mirror_length;
const char *httpurl = cv_httpsource.string;
#endif
netbuffer->packettype = PT_SERVERINFO;
netbuffer->u.serverinfo._255 = 255;
@ -1336,8 +1398,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
(dedicated ? SV_DEDICATED : 0)
);
strncpy(netbuffer->u.serverinfo.servername, cv_servername.string,
CopyCaretColors(netbuffer->u.serverinfo.servername, cv_servername.string,
MAXSERVERNAME);
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7);
@ -1401,7 +1462,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
#ifdef HAVE_CURL
mirror_length = strlen(httpurl);
if (mirror_length > MAX_MIRROR_LENGTH)
mirror_length = MAX_MIRROR_LENGTH;
@ -1411,7 +1471,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
strncpy(netbuffer->u.serverinfo.httpsource, "", mirror_length);
netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = '\0';
#endif
p = PutFileNeeded(0);
@ -1748,7 +1807,7 @@ static void CL_LoadReceivedSavegame(void)
#endif
#ifndef NONET
static void SendAskInfo(INT32 node, boolean viams)
static void SendAskInfo(INT32 node)
{
const tic_t asktime = I_GetTime();
netbuffer->packettype = PT_ASKINFO;
@ -1759,10 +1818,6 @@ static void SendAskInfo(INT32 node, boolean viams)
// now allowed traffic from the host to us in, so once the MS relays
// our address to the host, it'll be able to speak to us.
HSendPacket(node, false, 0, sizeof (askinfo_pak));
// Also speak to the MS.
if (viams && node != 0 && node != BROADCASTADDR)
SendAskInfoViaMS(node, asktime);
}
serverelem_t serverlist[MAXSERVERLIST];
@ -1828,13 +1883,95 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList();
}
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
struct Fetch_servers_ctx
{
int room;
int id;
};
static void
Fetch_servers_thread (struct Fetch_servers_ctx *ctx)
{
msg_server_t *server_list;
server_list = GetShortServersList(ctx->room, ctx->id);
if (server_list)
{
I_lock_mutex(&ms_QueryId_mutex);
{
if (ctx->id != ms_QueryId)
{
free(server_list);
server_list = NULL;
}
}
I_unlock_mutex(ms_QueryId_mutex);
if (server_list)
{
I_lock_mutex(&m_menu_mutex);
{
if (m_waiting_mode == M_WAITING_SERVERS)
m_waiting_mode = M_NOT_WAITING;
}
I_unlock_mutex(m_menu_mutex);
I_lock_mutex(&ms_ServerList_mutex);
{
ms_ServerList = server_list;
}
I_unlock_mutex(ms_ServerList_mutex);
}
}
free(ctx);
}
#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
void CL_QueryServerList (msg_server_t *server_list)
{
INT32 i;
for (i = 0; server_list[i].header.buffer[0]; i++)
{
// Make sure MS version matches our own, to
// thwart nefarious servers who lie to the MS.
/* lol bruh, that version COMES from the servers */
//if (strcmp(version, server_list[i].version) == 0)
{
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
if (node == -1)
break; // no more node free
SendAskInfo(node);
// Force close the connection so that servers can't eat
// up nodes forever if we never get a reply back from them
// (usually when they've not forwarded their ports).
//
// Don't worry, we'll get in contact with the working
// servers again when they send SERVERINFO to us later!
//
// (Note: as a side effect this probably means every
// server in the list will probably be using the same node (e.g. node 1),
// not that it matters which nodes they use when
// the connections are closed afterwards anyway)
// -- Monster Iestyn 12/11/18
Net_CloseConnection(node|FORCECLOSE);
}
}
}
void CL_UpdateServerList(boolean internetsearch, INT32 room)
{
(void)internetsearch;
(void)room;
SL_ClearServerList(0);
if (!netgame && I_NetOpenSocket)
{
MSCloseUDPSocket(); // Tidy up before wiping the slate.
if (I_NetOpenSocket())
{
netgame = true;
@ -1844,57 +1981,41 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
// search for local servers
if (netgame)
SendAskInfo(BROADCASTADDR, false);
SendAskInfo(BROADCASTADDR);
#ifdef MASTERSERVER
if (internetsearch)
{
const msg_server_t *server_list;
INT32 i = -1;
server_list = GetShortServersList(room);
#ifdef HAVE_THREADS
struct Fetch_servers_ctx *ctx;
ctx = malloc(sizeof *ctx);
/* This called from M_Refresh so I don't use a mutex */
m_waiting_mode = M_WAITING_SERVERS;
I_lock_mutex(&ms_QueryId_mutex);
{
ctx->id = ms_QueryId;
}
I_unlock_mutex(ms_QueryId_mutex);
ctx->room = room;
I_spawn_thread("fetch-servers", (I_thread_fn)Fetch_servers_thread, ctx);
#else
msg_server_t *server_list;
server_list = GetShortServersList(room, 0);
if (server_list)
{
char version[8] = "";
#if VERSION > 0 || SUBVERSION > 0
snprintf(version, sizeof (version), "%d.%d", VERSION, SUBVERSION);
#else
strcpy(version, GetRevisionString());
CL_QueryServerList(server_list);
free(server_list);
}
#endif
version[sizeof (version) - 1] = '\0';
for (i = 0; server_list[i].header.buffer[0]; i++)
{
// Make sure MS version matches our own, to
// thwart nefarious servers who lie to the MS.
if (strcmp(version, server_list[i].version) == 0)
{
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
if (node == -1)
break; // no more node free
SendAskInfo(node, true);
// Force close the connection so that servers can't eat
// up nodes forever if we never get a reply back from them
// (usually when they've not forwarded their ports).
//
// Don't worry, we'll get in contact with the working
// servers again when they send SERVERINFO to us later!
//
// (Note: as a side effect this probably means every
// server in the list will probably be using the same node (e.g. node 1),
// not that it matters which nodes they use when
// the connections are closed afterwards anyway)
// -- Monster Iestyn 12/11/18
Net_CloseConnection(node|FORCECLOSE);
}
}
}
//no server list?(-1) or no servers?(0)
if (!i)
{
; /// TODO: display error or warning?
}
}
#endif/*MASTERSERVER*/
}
#endif // ifndef NONET
@ -1923,11 +2044,11 @@ static boolean CL_FinishedFileList(void)
CL_Reset();
D_StartTitle();
M_StartMessage(M_GetText(
"You have WAD files loaded or have\n"
"modified the game in some way, and\n"
"your file list does not match\n"
"the server's file list.\n"
"Please restart SRB2Kart before connecting.\n\n"
"You have the wrong addons loaded.\n\n"
"To play on this server, restart\n"
"the game and don't load any addons.\n"
"SRB2Kart will automatically add\n"
"everything you need when you join.\n\n"
"Press ESC\n"
), NULL, MM_NOTHING);
return false;
@ -1948,11 +2069,12 @@ static boolean CL_FinishedFileList(void)
CL_Reset();
D_StartTitle();
M_StartMessage(M_GetText(
"You cannot connect to this server\n"
"because you cannot download the files\n"
"that you are missing from the server.\n\n"
"See the console or log file for\n"
"more details.\n\n"
"An error occured when trying to\n"
"download missing addons.\n"
"(This is almost always a problem\n"
"with the server, not your game.)\n\n"
"See the console or log file\n"
"for additional details.\n\n"
"Press ESC\n"
), NULL, MM_NOTHING);
return false;
@ -1973,14 +2095,13 @@ static boolean CL_FinishedFileList(void)
/** Called by CL_ServerConnectionTicker
*
* \param viams ???
* \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit.
* \return False if the connection was aborted
* \sa CL_ServerConnectionTicker
* \sa CL_ConnectToServer
*
*/
static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
{
#ifndef NONET
INT32 i;
@ -2044,11 +2165,10 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
// Ask the info to the server (askinfo packet)
if (*asksent + NEWTICRATE < I_GetTime())
{
SendAskInfo(servernode, viams);
SendAskInfo(servernode);
*asksent = I_GetTime();
}
#else
(void)viams;
(void)asksent;
// No netgames, so we skip this state.
cl_mode = CL_ASKJOIN;
@ -2059,7 +2179,6 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
/** Called by CL_ConnectToServer
*
* \param viams ???
* \param tmpsave The name of the gamestate file???
* \param oldtic Used for knowing when to poll events and redraw
* \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit.
@ -2068,7 +2187,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
* \sa CL_ConnectToServer
*
*/
static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic_t *oldtic, tic_t *asksent)
static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic_t *asksent)
{
boolean waitmore;
INT32 i;
@ -2080,7 +2199,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
switch (cl_mode)
{
case CL_SEARCHING:
if (!CL_ServerConnectionSearchTicker(viams, asksent))
if (!CL_ServerConnectionSearchTicker(asksent))
return false;
break;
@ -2245,11 +2364,10 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
/** Use adaptive send using net_bandwidth and stat.sendbytes
*
* \param viams ???
* \todo Better description...
*
*/
static void CL_ConnectToServer(boolean viams)
static void CL_ConnectToServer(void)
{
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
tic_t oldtic;
@ -2321,9 +2439,9 @@ static void CL_ConnectToServer(boolean viams)
{
// If the connection was aborted for some reason, leave
#ifndef NONET
if (!CL_ServerConnectionTicker(viams, tmpsave, &oldtic, &asksent))
if (!CL_ServerConnectionTicker(tmpsave, &oldtic, &asksent))
#else
if (!CL_ServerConnectionTicker(viams, (char*)NULL, &oldtic, (tic_t *)NULL))
if (!CL_ServerConnectionTicker((char*)NULL, &oldtic, (tic_t *)NULL))
#endif
return;
@ -2449,6 +2567,7 @@ static void Command_ClearBans(void)
return;
I_ClearBans();
D_SaveBan();
reasontail = NULL;
while (reasonhead)
{
@ -2503,9 +2622,6 @@ static void Command_ReloadBan(void) //recheck ban.txt
static void Command_connect(void)
{
// Assume we connect directly.
boolean viams = false;
if (COM_Argc() < 2 || *COM_Argv(1) == 0)
{
CONS_Printf(M_GetText(
@ -2539,9 +2655,6 @@ static void Command_connect(void)
if (netgame && !stricmp(COM_Argv(1), "node"))
{
servernode = (SINT8)atoi(COM_Argv(2));
// Use MS to traverse NAT firewalls.
viams = true;
}
else if (netgame)
{
@ -2550,7 +2663,6 @@ static void Command_connect(void)
}
else if (I_NetOpenSocket)
{
MSCloseUDPSocket(); // Tidy up before wiping the slate.
I_NetOpenSocket();
netgame = true;
multiplayer = true;
@ -2579,7 +2691,7 @@ static void Command_connect(void)
}
botingame = false;
botskin = 0;
CL_ConnectToServer(viams);
CL_ConnectToServer();
}
#endif
@ -3376,8 +3488,10 @@ void D_QuitNetGame(void)
for (i = 0; i < MAXNETNODES; i++)
if (nodeingame[i])
HSendPacket(i, true, 0, 0);
#ifdef MASTERSERVER
if (serverrunning && ms_RoomId > 0)
UnregisterServer();
#endif
}
else if (servernode > 0 && servernode < MAXNETNODES && nodeingame[(UINT8)servernode])
{
@ -3624,15 +3738,16 @@ boolean SV_SpawnServer(void)
SV_GenContext();
if (netgame && I_NetOpenSocket)
{
MSCloseUDPSocket(); // Tidy up before wiping the slate.
I_NetOpenSocket();
#ifdef MASTERSERVER
if (ms_RoomId > 0)
RegisterServer();
#endif
}
// non dedicated server just connect to itself
if (!dedicated)
CL_ConnectToServer(false);
CL_ConnectToServer();
else doomcom->numslots = 1;
}
@ -3835,6 +3950,7 @@ static void HandleTimeout(SINT8 node)
*/
static void HandleServerInfo(SINT8 node)
{
char servername[MAXSERVERNAME];
// compute ping in ms
const tic_t ticnow = I_GetTime();
const tic_t ticthen = (tic_t)LONG(netbuffer->u.serverinfo.time);
@ -3843,6 +3959,8 @@ static void HandleServerInfo(SINT8 node)
netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0;
netbuffer->u.serverinfo.application
[sizeof netbuffer->u.serverinfo.application - 1] = '\0';
memcpy(servername, netbuffer->u.serverinfo.servername, MAXSERVERNAME);
CopyCaretColors(netbuffer->u.serverinfo.servername, servername, MAXSERVERNAME);
netbuffer->u.serverinfo.gametype = (UINT8)((netbuffer->u.serverinfo.gametype == VANILLA_GT_MATCH) ? GT_MATCH : GT_RACE);
SL_InsertServer(&netbuffer->u.serverinfo, node);
@ -5345,7 +5463,9 @@ FILESTAMP
GetPackets();
FILESTAMP
#ifdef MASTERSERVER
MasterClient_Ticker();
#endif
if (client)
{
@ -5402,7 +5522,9 @@ FILESTAMP
// client send the command after a receive of the server
// the server send before because in single player is beter
#ifdef MASTERSERVER
MasterClient_Ticker(); // Acking the Master Server
#endif
if (client)
{
@ -5458,7 +5580,13 @@ FILESTAMP
if (nowtime > resptime)
{
resptime = nowtime;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Ticker();
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
CON_Ticker();
}
SV_FileSendTicker();

View File

@ -18,6 +18,7 @@
#include "d_netcmd.h"
#include "tables.h"
#include "d_player.h"
#include "mserv.h"
/*
The 'packet version' is used to distinguish packet formats.
@ -531,6 +532,7 @@ typedef enum
} kickreason_t;
extern boolean server;
extern boolean serverrunning;
#define client (!server)
extern boolean dedicated; // For dedicated server
extern UINT16 software_MAXPACKETLENGTH;
@ -577,6 +579,7 @@ void CL_RemoveSplitscreenPlayer(UINT8 p);
void CL_Reset(void);
void CL_ClearPlayer(INT32 playernum);
void CL_RemovePlayer(INT32 playernum, INT32 reason);
void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(boolean internetsearch, INT32 room);
// Is there a game running
boolean Playing(void);

View File

@ -50,6 +50,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "hu_stuff.h"
#include "i_sound.h"
#include "i_system.h"
#include "i_threads.h"
#include "i_video.h"
#include "m_argv.h"
#include "m_menu.h"
@ -143,6 +144,8 @@ boolean advancedemo;
INT32 debugload = 0;
#endif
char savegamename[256];
#ifdef _arch_dreamcast
char srb2home[256] = "/cd";
char srb2path[256] = "/cd";
@ -185,35 +188,6 @@ UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
//
// D_ModifierKeyResponder
// Sets global shift/ctrl/alt variables, never actually eats events
//
static inline void D_ModifierKeyResponder(event_t *ev)
{
if (ev->type == ev_keydown || ev->type == ev_console) switch (ev->data1)
{
case KEY_LSHIFT: shiftdown |= 0x1; return;
case KEY_RSHIFT: shiftdown |= 0x2; return;
case KEY_LCTRL: ctrldown |= 0x1; return;
case KEY_RCTRL: ctrldown |= 0x2; return;
case KEY_LALT: altdown |= 0x1; return;
case KEY_RALT: altdown |= 0x2; return;
case KEY_CAPSLOCK: capslock = !capslock; return;
default: return;
}
else if (ev->type == ev_keyup) switch (ev->data1)
{
case KEY_LSHIFT: shiftdown &= ~0x1; return;
case KEY_RSHIFT: shiftdown &= ~0x2; return;
case KEY_LCTRL: ctrldown &= ~0x1; return;
case KEY_RCTRL: ctrldown &= ~0x2; return;
case KEY_LALT: altdown &= ~0x1; return;
case KEY_RALT: altdown &= ~0x2; return;
default: return;
}
}
//
// D_ProcessEvents
@ -223,6 +197,8 @@ void D_ProcessEvents(void)
{
event_t *ev;
boolean eaten;
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
{
ev = &events[eventtail];
@ -244,7 +220,17 @@ void D_ProcessEvents(void)
}
// Menu input
if (M_Responder(ev))
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
{
eaten = M_Responder(ev);
}
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
if (eaten)
continue; // menu ate the event
// Demo input:
@ -253,7 +239,17 @@ void D_ProcessEvents(void)
continue; // demo ate the event
// console input
if (CON_Responder(ev))
#ifdef HAVE_THREADS
I_lock_mutex(&con_mutex);
#endif
{
eaten = CON_Responder(ev);
}
#ifdef HAVE_THREADS
I_unlock_mutex(con_mutex);
#endif
if (eaten)
continue; // ate the event
G_Responder(ev);
@ -280,7 +276,7 @@ static void D_Display(void)
{
if (nodrawers)
return; // for comparative timing/profiling
// check for change of screen size (video mode)
if (setmodeneeded && !wipe)
SCR_SetMode(); // change video mode
@ -549,7 +545,13 @@ static void D_Display(void)
if (gamestate != GS_TIMEATTACK)
CON_Drawer();
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of everything
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
// focus lost moved to M_Drawer
//

View File

@ -19,7 +19,9 @@
#define __D_NET__
// Max computers in a game
#define MAXNETNODES 64
// 127 is probably as high as this can go, because
// SINT8 is used for nodes sometimes >:(
#define MAXNETNODES 127
#define BROADCASTADDR MAXNETNODES
#define NETSPLITSCREEN // Kart's splitscreen netgame feature
@ -41,6 +43,8 @@ extern SINT8 nodetoplayer4[MAXNETNODES]; // Say the numplayer for this node if a
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
extern boolean serverrunning;
INT32 Net_GetFreeAcks(boolean urgent);
void Net_AckTicker(void);

View File

@ -768,7 +768,7 @@ void SV_FileSendTicker(void)
if (ram)
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
else if (fread(p->data, 1, size, transfer[i].currentfile) != size)
I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, strerror(ferror(transfer[i].currentfile)));
I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile));
p->position = LONG(transfer[i].position);
// Put flag so receiver knows the total size
if (transfer[i].position + size == f->size)
@ -847,7 +847,7 @@ void Got_Filetxpak(void)
// We can receive packet in the wrong order, anyway all os support gaped file
fseek(file->file, pos, SEEK_SET);
if (fwrite(netbuffer->u.filetxpak.data,size,1,file->file) != 1)
I_Error("Can't write to %s: %s\n",filename, strerror(ferror(file->file)));
I_Error("Can't write to %s: %s\n",filename, M_FileError(file->file));
file->currentsize += size;
// Finished?
@ -1088,7 +1088,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
// Only allow HTTP and HTTPS
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
// Follow a redirect request, if sent by the server.
curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L);

View File

@ -8622,13 +8622,11 @@ struct {
{"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
#ifdef ESLOPE
// Slope flags
{"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope
{"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it
{"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position
{"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things
#endif
// Angles
{"ANG1",ANG1},

View File

@ -30,7 +30,6 @@
#ifdef HAVE_MIXER
//#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X)
#define SOUND SOUND_MIXER
#define NOHS // No HW3SOUND
#ifdef HW3SOUND
#undef HW3SOUND
#endif
@ -47,7 +46,6 @@
// Use FMOD?
#ifdef HAVE_FMOD
#define SOUND SOUND_FMOD
#define NOHS // No HW3SOUND
#ifdef HW3SOUND
#undef HW3SOUND
#endif
@ -64,10 +62,6 @@
#if !defined (HWRENDER) && !defined (NOHW)
#define HWRENDER
#endif
// judgecutor: 3D sound support
#if !defined(HW3SOUND) && !defined (NOHS)
#define HW3SOUND
#endif
#endif
#if defined (_WIN32) || defined (_WIN32_WCE)
@ -506,7 +500,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG;
// Things that used to be in dstrings.h
#define SAVEGAMENAME "srb2sav"
char savegamename[256];
extern char savegamename[256];
// m_misc.h
#ifdef GETTEXT
@ -606,11 +600,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
#define ESLOPE
#ifdef ESLOPE
/// Backwards compatibility with SRB2CB's slope linedef types.
/// \note A simple shim that prints a warning.
#define ESLOPE_TYPESHIM
#endif
/// Delete file while the game is running.
/// \note EXTREMELY buggy, tends to crash game.
@ -681,4 +673,10 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Hardware renderer: OpenGL
#define GL_SHADERS
#if defined (HAVE_CURL) && ! defined (NONET)
#define MASTERSERVER
#else
#undef UPDATE_ALERT
#endif
#endif // __DOOMDEF__

View File

@ -24,6 +24,7 @@
#include "w_wad.h"
#include "z_zone.h"
#include "i_system.h"
#include "i_threads.h"
#include "m_menu.h"
#include "dehacked.h"
#include "g_input.h"
@ -317,7 +318,13 @@ void F_IntroDrawer(void)
{
I_OsPolling();
I_UpdateNoBlit();
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001
}
}

View File

@ -22,6 +22,7 @@
#include "z_zone.h"
#include "i_system.h"
#include "i_threads.h"
#include "m_menu.h"
#include "console.h"
#include "d_main.h"
@ -379,7 +380,15 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
I_UpdateNoBlit();
if (drawMenu)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
}
I_FinishUpdate(); // page flip or blit buffer

View File

@ -6326,8 +6326,8 @@ void G_RecordDemo(const char *name)
maxsize = 1024*1024*2;
if (M_CheckParm("-maxdemo") && M_IsNextParm())
maxsize = atoi(M_GetNextParm()) * 1024;
// if (demobuffer)
// free(demobuffer);
if (demobuffer)
free(demobuffer);
demo_p = NULL;
demobuffer = malloc(maxsize);
demoend = demobuffer + maxsize;
@ -7153,6 +7153,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7181,6 +7182,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7193,6 +7195,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7212,6 +7215,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7272,6 +7276,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7342,6 +7347,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7355,6 +7361,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7379,6 +7386,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7422,6 +7430,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7477,6 +7486,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -7491,6 +7501,7 @@ void G_DoPlayDemo(char *defdemoname)
M_StartMessage(msg, NULL, MM_NOTHING);
Z_Free(pdemoname);
Z_Free(demobuffer);
demobuffer = NULL;
demo.playback = false;
demo.title = false;
return;
@ -8140,6 +8151,7 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
saved = FIL_WriteFile(va("%sMS.LMP", G_BuildMapName(gamemap)), demobuffer, demo_p - demobuffer); // finally output the file.
}
free(demobuffer);
demobuffer = NULL;
metalrecording = false;
if (saved)
I_Error("Saved to %sMS.LMP", G_BuildMapName(gamemap));
@ -8320,6 +8332,7 @@ void G_SaveDemo(void)
if (FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer)) // finally output the file.
demo.savemode = DSM_SAVED;
free(demobuffer);
demobuffer = NULL;
demo.recording = false;
if (modeattacking != ATTACKING_RECORD)

View File

@ -407,7 +407,7 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
if (angle) // Only needs to be done if there's an altered angle
{
angle = (InvAngle(angle)+ANGLE_180)>>ANGLETOFINESHIFT;
angle = InvAngle(angle)>>ANGLETOFINESHIFT;
// This needs to be done so that it scrolls in a different direction after rotation like software
/*tempxsow = FLOAT_TO_FIXED(scrollx);
@ -439,7 +439,7 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
tempxsow = FLOAT_TO_FIXED(v3d->s);
tempytow = FLOAT_TO_FIXED(v3d->t);
v3d->s = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
v3d->t = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
v3d->t = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
}
//v3d->s = (float)(v3d->s - flatxref + scrollx);
@ -4733,6 +4733,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
}
R_SetupFrame(player, false); // This can stay false because it is only used to set viewsky in r_main.c, which isn't used here
framecount++; // for timedemo
HWR_RenderFrame(viewnumber, player, false);
}

View File

@ -143,7 +143,7 @@ static const GLfloat byte2float[256] = {
// -----------------+
#ifdef DEBUG_TO_FILE
FILE *gllogstream;
FILE *gllogstream = NULL;
#endif
FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
@ -152,14 +152,14 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
char str[4096] = "";
va_list arglist;
if (!gllogstream)
gllogstream = fopen("ogllog.txt", "w");
if (gllogstream)
{
va_start(arglist, format);
vsnprintf(str, 4096, format, arglist);
va_end(arglist);
va_start(arglist, format);
vsnprintf(str, 4096, format, arglist);
va_end(arglist);
fwrite(str, strlen(str), 1, gllogstream);
fwrite(str, strlen(str), 1, gllogstream);
}
#else
(void)format;
#endif
@ -823,7 +823,7 @@ EXPORT boolean HWRAPI(LoadShaders) (void)
#ifdef GL_SHADERS
GLuint gl_vertShader, gl_fragShader;
GLint i, result;
if (!pglUseProgram) return false;
gl_customvertexshaders[0] = NULL;
@ -2002,11 +2002,11 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
boolean stopFlag = false;
boolean changeState = false;
boolean changeShader = false;
GLuint nextShader;
GLuint nextShader = 0U;
boolean changeTexture = false;
GLuint nextTexture;
GLuint nextTexture = 0U;
boolean changePolyFlags = false;
FBITFIELD nextPolyFlags;
FBITFIELD nextPolyFlags = 0U;
boolean changeSurfaceInfo = false;
FSurfaceInfo nextSurfaceInfo;
@ -2307,7 +2307,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
pglColor4ubv((GLubyte*)&pSurf->PolyColor.s);
}
// Tint color
tint.red = byte2float[pSurf->TintColor.s.red];
tint.green = byte2float[pSurf->TintColor.s.green];

683
src/http-mserv.c Normal file
View File

@ -0,0 +1,683 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by James R.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
// \brief HTTP based master server
/*
Documentation available here.
<http://mb.srb2.org/MS/tools/api/v1/>
*/
#ifdef HAVE_CURL
#include <curl/curl.h>
#endif
#include "doomdef.h"
#include "d_clisrv.h"
#include "command.h"
#include "m_argv.h"
#include "m_menu.h"
#include "mserv.h"
#include "i_tcp.h"/* for current_port */
#include "i_threads.h"
/* reasonable default I guess?? */
#define DEFAULT_BUFFER_SIZE (4096)
/* I just stop myself from making macros anymore. */
#define Blame( ... ) \
CONS_Printf("\x85" __VA_ARGS__)
static void MasterServer_Debug_OnChange (void);
consvar_t cv_masterserver_timeout = {
"masterserver_timeout", "5", CV_SAVE, CV_Unsigned,
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
};
consvar_t cv_masterserver_debug = {
"masterserver_debug", "Off", CV_SAVE|CV_CALL, CV_OnOff,
MasterServer_Debug_OnChange, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
};
consvar_t cv_masterserver_token = {
"masterserver_token", "", CV_SAVE, NULL,
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
};
#ifdef MASTERSERVER
static int hms_started;
static char *hms_api;
#ifdef HAVE_THREADS
static I_mutex hms_api_mutex;
#endif
static char *hms_server_token;
struct HMS_buffer
{
CURL *curl;
char *buffer;
int needle;
int end;
};
static void
Contact_error (void)
{
CONS_Alert(CONS_ERROR,
"There was a problem contacting the master server...\n"
);
}
static size_t
HMS_on_read (char *s, size_t _1, size_t n, void *userdata)
{
struct HMS_buffer *buffer;
size_t blocks;
(void)_1;
buffer = userdata;
if (n >= (size_t)( buffer->end - buffer->needle ))
{
/* resize to next multiple of buffer size */
blocks = ( n / DEFAULT_BUFFER_SIZE + 1 );
buffer->end += ( blocks * DEFAULT_BUFFER_SIZE );
buffer->buffer = realloc(buffer->buffer, buffer->end);
}
memcpy(&buffer->buffer[buffer->needle], s, n);
buffer->needle += n;
return n;
}
static struct HMS_buffer *
HMS_connect (const char *format, ...)
{
va_list ap;
CURL *curl;
char *url;
char *quack_token;
size_t seek;
size_t token_length;
struct HMS_buffer *buffer;
if (! hms_started)
{
if (curl_global_init(CURL_GLOBAL_ALL) != 0)
{
Contact_error();
Blame("From curl_global_init.\n");
return NULL;
}
else
{
atexit(curl_global_cleanup);
hms_started = 1;
}
}
curl = curl_easy_init();
if (! curl)
{
Contact_error();
Blame("From curl_easy_init.\n");
return NULL;
}
if (cv_masterserver_token.string[0])
{
quack_token = curl_easy_escape(curl, cv_masterserver_token.string, 0);
token_length = ( sizeof "?token="-1 )+ strlen(quack_token);
}
else
{
quack_token = NULL;
token_length = 0;
}
#ifdef HAVE_THREADS
I_lock_mutex(&hms_api_mutex);
#endif
seek = strlen(hms_api) + 1;/* + '/' */
va_start (ap, format);
url = malloc(seek + vsnprintf(0, 0, format, ap) + token_length + 1);
va_end (ap);
sprintf(url, "%s/", hms_api);
#ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex);
#endif
va_start (ap, format);
seek += vsprintf(&url[seek], format, ap);
va_end (ap);
if (quack_token)
sprintf(&url[seek], "?token=%s", quack_token);
CONS_Printf("HMS: connecting '%s'...\n", url);
buffer = malloc(sizeof *buffer);
buffer->curl = curl;
buffer->end = DEFAULT_BUFFER_SIZE;
buffer->buffer = malloc(buffer->end);
buffer->needle = 0;
if (cv_masterserver_debug.value)
{
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_STDERR, logstream);
}
if (M_CheckParm("-bindaddr") && M_IsNextParm())
{
curl_easy_setopt(curl, CURLOPT_INTERFACE, M_GetNextParm());
}
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
curl_free(quack_token);
free(url);
return buffer;
}
static int
HMS_do (struct HMS_buffer *buffer)
{
CURLcode cc;
long status;
char *p;
cc = curl_easy_perform(buffer->curl);
if (cc != CURLE_OK)
{
Contact_error();
Blame(
"From curl_easy_perform: %s\n",
curl_easy_strerror(cc)
);
return 0;
}
buffer->buffer[buffer->needle] = '\0';
curl_easy_getinfo(buffer->curl, CURLINFO_RESPONSE_CODE, &status);
if (status != 200)
{
p = strchr(buffer->buffer, '\n');
if (p)
*p = '\0';
Contact_error();
Blame(
"Master server error %ld: %s%s\n",
status,
buffer->buffer,
( (p) ? "" : " (malformed)" )
);
return 0;
}
else
return 1;
}
static void
HMS_end (struct HMS_buffer *buffer)
{
curl_easy_cleanup(buffer->curl);
free(buffer->buffer);
free(buffer);
}
int
HMS_fetch_rooms (int joining, int query_id)
{
struct HMS_buffer *hms;
int ok;
int doing_shit;
char *id;
char *title;
char *room_motd;
int id_no;
char *p;
char *end;
int i;
(void)query_id;
hms = HMS_connect("rooms");
if (! hms)
return 0;
if (HMS_do(hms))
{
doing_shit = 1;
p = hms->buffer;
for (i = 0; i < NUM_LIST_ROOMS && ( end = strstr(p, "\n\n\n") );)
{
*end = '\0';
id = strtok(p, "\n");
title = strtok(0, "\n");
room_motd = strtok(0, "");
if (id && title && room_motd)
{
id_no = atoi(id);
/*
Don't show the 'All' room if hosting. And it's a hack like this
because I'm way too lazy to add another feature to the MS.
*/
if (joining || id_no != 0)
{
#ifdef HAVE_THREADS
I_lock_mutex(&ms_QueryId_mutex);
{
if (query_id != ms_QueryId)
doing_shit = 0;
}
I_unlock_mutex(ms_QueryId_mutex);
if (! doing_shit)
break;
#endif
room_list[i].header.buffer[0] = 1;
room_list[i].id = id_no;
strlcpy(room_list[i].name, title, sizeof room_list[i].name);
strlcpy(room_list[i].motd, room_motd, sizeof room_list[i].motd);
i++;
}
p = ( end + 3 );/* skip the three linefeeds */
}
else
break;
}
if (doing_shit)
room_list[i].header.buffer[0] = 0;
ok = 1;
if (doing_shit)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
{
for (i = 0; room_list[i].header.buffer[0]; i++)
{
if(*room_list[i].name != '\0')
{
MP_RoomMenu[i+1].text = room_list[i].name;
roomIds[i] = room_list[i].id;
MP_RoomMenu[i+1].status = IT_STRING|IT_CALL;
}
}
}
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
}
}
else
ok = 0;
HMS_end(hms);
return ok;
}
int
HMS_register (void)
{
struct HMS_buffer *hms;
int ok;
char post[256];
char *title;
hms = HMS_connect("rooms/%d/register", ms_RoomId);
if (! hms)
return 0;
title = curl_easy_escape(hms->curl, cv_servername.string, 0);
snprintf(post, sizeof post,
"port=%d&"
"title=%s&"
"version=%d.%d",
current_port,
title,
VERSION,
SUBVERSION
);
curl_free(title);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms);
if (ok)
{
hms_server_token = strdup(strtok(hms->buffer, "\n"));
}
HMS_end(hms);
return ok;
}
int
HMS_unlist (void)
{
struct HMS_buffer *hms;
int ok;
hms = HMS_connect("servers/%s/unlist", hms_server_token);
if (! hms)
return 0;
curl_easy_setopt(hms->curl, CURLOPT_CUSTOMREQUEST, "POST");
ok = HMS_do(hms);
HMS_end(hms);
free(hms_server_token);
return ok;
}
int
HMS_update (void)
{
struct HMS_buffer *hms;
int ok;
char post[256];
char *title;
hms = HMS_connect("servers/%s/update", hms_server_token);
if (! hms)
return 0;
title = curl_easy_escape(hms->curl, cv_servername.string, 0);
snprintf(post, sizeof post,
"title=%s",
title
);
curl_free(title);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms);
HMS_end(hms);
return ok;
}
void
HMS_list_servers (void)
{
struct HMS_buffer *hms;
char *p;
hms = HMS_connect("servers");
if (! hms)
return;
if (HMS_do(hms))
{
p = &hms->buffer[strlen(hms->buffer)];
while (*--p == '\n')
;
CONS_Printf("%s\n", hms->buffer);
}
HMS_end(hms);
}
msg_server_t *
HMS_fetch_servers (msg_server_t *list, int room_number, int query_id)
{
struct HMS_buffer *hms;
int doing_shit;
char local_version[9];
char *room;
char *address;
char *port;
char *title;
char *version;
char *end;
char *section_end;
char *p;
int i;
(void)query_id;
if (room_number > 0)
{
hms = HMS_connect("rooms/%d/servers", room_number);
}
else
hms = HMS_connect("servers");
if (! hms)
return NULL;
if (HMS_do(hms))
{
doing_shit = 1;
snprintf(local_version, sizeof local_version,
"%d.%d",
VERSION,
SUBVERSION
);
p = hms->buffer;
i = 0;
do
{
section_end = strstr(p, "\n\n");
room = strtok(p, "\n");
p = strtok(0, "");
if (! p)
break;
while (i < MAXSERVERLIST && ( end = strchr(p, '\n') ))
{
*end = '\0';
address = strtok(p, " ");
port = strtok(0, " ");
title = strtok(0, " ");
version = strtok(0, "");
if (address && port && title && version)
{
#ifdef HAVE_THREADS
I_lock_mutex(&ms_QueryId_mutex);
{
if (query_id != ms_QueryId)
doing_shit = 0;
}
I_unlock_mutex(ms_QueryId_mutex);
if (! doing_shit)
break;
#endif
if (strcmp(version, local_version) == 0)
{
strlcpy(list[i].ip, address, sizeof list[i].ip);
strlcpy(list[i].port, port, sizeof list[i].port);
strlcpy(list[i].name, title, sizeof list[i].name);
strlcpy(list[i].version, version, sizeof list[i].version);
list[i].room = atoi(room);
list[i].header.buffer[0] = 1;
i++;
}
if (end == section_end)/* end of list for this room */
break;
else
p = ( end + 1 );/* skip server delimiter */
}
else
{
section_end = 0;/* malformed so quit the parsing */
break;
}
}
if (! doing_shit)
break;
p = ( section_end + 2 );
}
while (section_end) ;
if (doing_shit)
list[i].header.buffer[0] = 0;
}
else
list = NULL;
HMS_end(hms);
return list;
}
int
HMS_compare_mod_version (char *buffer, size_t buffer_size)
{
struct HMS_buffer *hms;
int ok;
char *version;
char *version_name;
hms = HMS_connect("versions/%d", MODID);
if (! hms)
return 0;
ok = 0;
if (HMS_do(hms))
{
version = strtok(hms->buffer, " ");
version_name = strtok(0, "\n");
if (version && version_name)
{
if (atoi(version) != MODVERSION)
{
strlcpy(buffer, version_name, buffer_size);
ok = 1;
}
else
ok = -1;
}
}
HMS_end(hms);
return ok;
}
void
HMS_set_api (char *api)
{
#ifdef HAVE_THREADS
I_lock_mutex(&hms_api_mutex);
#endif
{
free(hms_api);
hms_api = api;
}
#ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex);
#endif
}
#endif/*MASTERSERVER*/
static void
MasterServer_Debug_OnChange (void)
{
#ifdef MASTERSERVER
/* TODO: change to 'latest-log.txt' for log files revision. */
if (cv_masterserver_debug.value)
CONS_Printf("Master server debug messages will appear in log.txt\n");
#endif
}

View File

@ -246,7 +246,8 @@ static size_t numbans = 0;
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
static boolean init_tcp_driver = false;
static char port_name[8] = DEFAULTPORT;
static const char *serverport_name = DEFAULTPORT;
static const char *clientport_name;/* any port */
#ifndef NONET
@ -924,6 +925,7 @@ static boolean UDP_Socket(void)
#ifdef HAVE_IPV6
const INT32 b_ipv6 = M_CheckParm("-ipv6");
#endif
const char *serv;
for (s = 0; s < mysocketses; s++)
@ -939,11 +941,16 @@ static boolean UDP_Socket(void)
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
if (serverrunning)
serv = serverport_name;
else
serv = clientport_name;
if (M_CheckParm("-bindaddr"))
{
while (M_IsNextParm())
{
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
@ -964,7 +971,7 @@ static boolean UDP_Socket(void)
}
else
{
gaie = I_getaddrinfo("0.0.0.0", port_name, &hints, &ai);
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
@ -979,8 +986,8 @@ static boolean UDP_Socket(void)
#ifdef HAVE_MINIUPNPC
if (UPNP_support)
{
I_UPnP_rem(port_name, "UDP");
I_UPnP_add(NULL, port_name, "UDP");
I_UPnP_rem(serverport_name, "UDP");
I_UPnP_add(NULL, serverport_name, "UDP");
}
#endif
}
@ -997,7 +1004,7 @@ static boolean UDP_Socket(void)
{
while (M_IsNextParm())
{
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
@ -1018,7 +1025,7 @@ static boolean UDP_Socket(void)
}
else
{
gaie = I_getaddrinfo("::", port_name, &hints, &ai);
gaie = I_getaddrinfo("::", serv, &hints, &ai);
if (gaie == 0)
{
runp = ai;
@ -1475,15 +1482,19 @@ boolean I_InitTcpNetwork(void)
if (!I_InitTcpDriver())
return false;
if (M_CheckParm("-port"))
if (M_CheckParm("-port") || M_CheckParm("-serverport"))
// Combined -udpport and -clientport into -port
// As it was really redundant having two seperate parms that does the same thing
/* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */
{
if (M_IsNextParm())
strcpy(port_name, M_GetNextParm());
else
strcpy(port_name, "0");
/*
If it's NULL, that's okay! Because then
we'll get a random port from getaddrinfo.
*/
serverport_name = M_GetNextParm();
}
if (M_CheckParm("-clientport"))
clientport_name = M_GetNextParm();
// parse network game options,
if (M_CheckParm("-server") || dedicated)

39
src/i_threads.h Normal file
View File

@ -0,0 +1,39 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by James R.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file i_threads.h
/// \brief Multithreading abstraction
#ifdef HAVE_THREADS
#ifndef I_THREADS_H
#define I_THREADS_H
typedef void (*I_thread_fn)(void *userdata);
typedef void * I_mutex;
typedef void * I_cond;
void I_start_threads (void);
void I_stop_threads (void);
void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
/* check in your thread whether to return early */
int I_thread_is_stopped (void);
void I_lock_mutex (I_mutex *);
void I_unlock_mutex (I_mutex);
void I_hold_cond (I_cond *, I_mutex);
void I_wake_one_cond (I_cond *);
void I_wake_all_cond (I_cond *);
#endif/*I_THREADS_H*/
#endif/*HAVE_THREADS*/

View File

@ -2893,14 +2893,12 @@ void K_SpawnBoostTrail(player_t *player)
{
newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
#ifdef ESLOPE
if (player->mo->standingslope)
{
ground = P_GetZAt(player->mo->standingslope, newx, newy);
if (player->mo->eflags & MFE_VERTICALFLIP)
ground -= FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale);
}
#endif
flame = P_SpawnMobj(newx, newy, ground, MT_SNEAKERTRAIL);
P_SetTarget(&flame->target, player->mo);
@ -3604,9 +3602,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
if (mo->eflags & MFE_SPRUNG)
return;
#ifdef ESLOPE
mo->standingslope = NULL;
#endif
mo->eflags |= MFE_SPRUNG;
@ -8634,7 +8630,7 @@ void K_drawKartFreePlay(UINT32 flashtime)
return;
V_DrawKartString((BASEVIDWIDTH - (LAPS_X+1)) - (12*9), // mirror the laps thingy
LAPS_Y+3, V_SNAPTOBOTTOM|V_SNAPTORIGHT, "FREE PLAY");
LAPS_Y+3, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, "FREE PLAY");
}
static void K_drawDistributionDebugger(void)

View File

@ -11,7 +11,7 @@
#define KART_FULLTURN 800
UINT8 colortranslations[MAXTRANSLATIONS][16];
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
extern const char *KartColor_Names[MAXSKINCOLORS];
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);

View File

@ -14,9 +14,7 @@
#ifdef HAVE_BLUA
#include "p_local.h"
#include "p_setup.h" // So we can have P_SetupLevelSky
#ifdef ESLOPE
#include "p_slopes.h" // P_GetZAt
#endif
#include "z_zone.h"
#include "r_main.h"
#include "r_things.h"
@ -1575,7 +1573,6 @@ static int lib_evCrumbleChain(lua_State *L)
return 0;
}
#ifdef ESLOPE
// P_SLOPES
////////////
@ -1591,7 +1588,6 @@ static int lib_pGetZAt(lua_State *L)
lua_pushfixed(L, P_GetZAt(slope, x, y));
return 1;
}
#endif
// R_DEFS
////////////
@ -3083,10 +3079,8 @@ static luaL_Reg lib[] = {
{"P_StartQuake",lib_pStartQuake},
{"EV_CrumbleChain",lib_evCrumbleChain},
#ifdef ESLOPE
// p_slopes
{"P_GetZAt",lib_pGetZAt},
#endif
// r_defs
{"R_PointToAngle",lib_rPointToAngle},

View File

@ -79,9 +79,7 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
{
INT32 offset;
const INT32 *list; // Big blockmap
#ifdef POLYOBJECTS
polymaplink_t *plink; // haleyjd 02/22/06
#endif
line_t *ld;
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
@ -89,7 +87,6 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
offset = y*bmapwidth + x;
#ifdef POLYOBJECTS
// haleyjd 02/22/06: consider polyobject lines
plink = polyblocklinks[offset];
@ -132,7 +129,6 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
}
plink = (polymaplink_t *)(plink->link.next);
}
#endif
offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];

View File

@ -40,11 +40,9 @@ extern lua_State *gL;
#define META_SUBSECTOR "SUBSECTOR_T*"
#define META_SECTOR "SECTOR_T*"
#define META_FFLOOR "FFLOOR_T*"
#ifdef ESLOPE
#define META_SLOPE "PSLOPE_T*"
#define META_VECTOR2 "VECTOR2_T"
#define META_VECTOR3 "VECTOR3_T"
#endif
#define META_MAPHEADER "MAPHEADER_T*"
#define META_CVAR "CONSVAR_T*"

View File

@ -16,9 +16,7 @@
#include "p_local.h"
#include "p_setup.h"
#include "z_zone.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "r_main.h"
#include "lua_script.h"
@ -43,13 +41,9 @@ enum sector_e {
sector_heightsec,
sector_camsec,
sector_lines,
#ifdef ESLOPE
sector_ffloors,
sector_fslope,
sector_cslope
#else
sector_ffloors
#endif
};
static const char *const sector_opt[] = {
@ -66,10 +60,8 @@ static const char *const sector_opt[] = {
"camsec",
"lines",
"ffloors",
#ifdef ESLOPE
"f_slope",
"c_slope",
#endif
NULL};
enum subsector_e {
@ -175,10 +167,8 @@ enum ffloor_e {
ffloor_toplightlevel,
ffloor_bottomheight,
ffloor_bottompic,
#ifdef ESLOPE
ffloor_tslope,
ffloor_bslope,
#endif
ffloor_sector,
ffloor_flags,
ffloor_master,
@ -195,10 +185,8 @@ static const char *const ffloor_opt[] = {
"toplightlevel",
"bottomheight",
"bottompic",
#ifdef ESLOPE
"t_slope",
"b_slope",
#endif
"sector", // secnum pushed as control sector userdata
"flags",
"master", // control linedef
@ -208,7 +196,6 @@ static const char *const ffloor_opt[] = {
"alpha",
NULL};
#ifdef ESLOPE
enum slope_e {
slope_valid = 0,
slope_o,
@ -247,7 +234,6 @@ static const char *const vector_opt[] = {
"y",
"z",
NULL};
#endif
static const char *const array_opt[] ={"iterate",NULL};
static const char *const valid_opt[] ={"valid",NULL};
@ -463,14 +449,12 @@ static int sector_get(lua_State *L)
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
return 1;
#ifdef ESLOPE
case sector_fslope: // f_slope
LUA_PushUserdata(L, sector->f_slope, META_SLOPE);
return 1;
case sector_cslope: // c_slope
LUA_PushUserdata(L, sector->c_slope, META_SLOPE);
return 1;
#endif
}
return 0;
}
@ -495,10 +479,8 @@ static int sector_set(lua_State *L)
case sector_heightsec: // heightsec
case sector_camsec: // camsec
case sector_ffloors: // ffloors
#ifdef ESLOPE
case sector_fslope: // f_slope
case sector_cslope: // c_slope
#endif
default:
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
case sector_floorheight: { // floorheight
@ -1134,14 +1116,12 @@ static int ffloor_get(lua_State *L)
lua_pushlstring(L, levelflat->name, i);
return 1;
}
#ifdef ESLOPE
case ffloor_tslope:
LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE);
return 1;
case ffloor_bslope:
LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE);
return 1;
#endif
case ffloor_sector:
LUA_PushUserdata(L, &sectors[ffloor->secnum], META_SECTOR);
return 1;
@ -1183,10 +1163,8 @@ static int ffloor_set(lua_State *L)
switch(field)
{
case ffloor_valid: // valid
#ifdef ESLOPE
case ffloor_tslope: // t_slope
case ffloor_bslope: // b_slope
#endif
case ffloor_sector: // sector
case ffloor_master: // master
case ffloor_target: // target
@ -1247,7 +1225,6 @@ static int ffloor_set(lua_State *L)
return 0;
}
#ifdef ESLOPE
static int slope_get(lua_State *L)
{
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
@ -1422,7 +1399,6 @@ static int vector3_get(lua_State *L)
return 0;
}
#endif
static int lib_getMapheaderinfo(lua_State *L)
{
@ -1614,7 +1590,6 @@ int LUA_MapLib(lua_State *L)
lua_setfield(L, -2, "__newindex");
lua_pop(L, 1);
#ifdef ESLOPE
luaL_newmetatable(L, META_SLOPE);
lua_pushcfunction(L, slope_get);
lua_setfield(L, -2, "__index");
@ -1632,7 +1607,6 @@ int LUA_MapLib(lua_State *L)
lua_pushcfunction(L, vector3_get);
lua_setfield(L, -2, "__index");
lua_pop(L, 1);
#endif
luaL_newmetatable(L, META_MAPHEADER);
lua_pushcfunction(L, mapheaderinfo_get);

View File

@ -82,9 +82,7 @@ enum mobj_e {
mobj_extravalue2,
mobj_cusval,
mobj_cvmem,
#ifdef ESLOPE
mobj_standingslope,
#endif
mobj_colorized
};
@ -145,9 +143,7 @@ static const char *const mobj_opt[] = {
"extravalue2",
"cusval",
"cvmem",
#ifdef ESLOPE
"standingslope",
#endif
"colorized",
NULL};
@ -352,11 +348,9 @@ static int mobj_get(lua_State *L)
case mobj_cvmem:
lua_pushinteger(L, mo->cvmem);
break;
#ifdef ESLOPE
case mobj_standingslope:
LUA_PushUserdata(L, mo->standingslope, META_SLOPE);
break;
#endif
case mobj_colorized:
lua_pushboolean(L, mo->colorized);
break;
@ -670,10 +664,8 @@ static int mobj_set(lua_State *L)
case mobj_cvmem:
mo->cvmem = luaL_checkinteger(L, 3);
break;
#ifdef ESLOPE
case mobj_standingslope:
return NOSET;
#endif
case mobj_colorized:
mo->colorized = luaL_checkboolean(L, 3);
break;

View File

@ -22,9 +22,7 @@
#include "byteptr.h"
#include "p_saveg.h"
#include "p_local.h"
#ifdef ESLOPE
#include "p_slopes.h" // for P_SlopeById
#endif
#ifdef LUA_ALLOW_BYTECODE
#include "d_netfil.h" // for LUA_DumpFile
#endif
@ -472,9 +470,7 @@ enum
ARCH_SIDE,
ARCH_SUBSECTOR,
ARCH_SECTOR,
#ifdef ESLOPE
ARCH_SLOPE,
#endif
ARCH_MAPHEADER,
ARCH_TEND=0xFF,
@ -494,9 +490,7 @@ static const struct {
{META_SIDE, ARCH_SIDE},
{META_SUBSECTOR,ARCH_SUBSECTOR},
{META_SECTOR, ARCH_SECTOR},
#ifdef ESLOPE
{META_SLOPE, ARCH_SLOPE},
#endif
{META_MAPHEADER, ARCH_MAPHEADER},
{NULL, ARCH_NULL}
};
@ -701,7 +695,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
}
break;
}
#ifdef ESLOPE
case ARCH_SLOPE:
{
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
@ -713,7 +706,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
}
break;
}
#endif
case ARCH_MAPHEADER:
{
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
@ -915,7 +907,6 @@ static UINT8 ArchiveValueDemo(int TABLESINDEX, int myindex)
}
break;
}
#ifdef ESLOPE
case ARCH_SLOPE:
{
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
@ -927,7 +918,6 @@ static UINT8 ArchiveValueDemo(int TABLESINDEX, int myindex)
}
break;
}
#endif
case ARCH_MAPHEADER:
{
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
@ -1233,11 +1223,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
case ARCH_SECTOR:
LUA_PushUserdata(gL, &sectors[READUINT16(save_p)], META_SECTOR);
break;
#ifdef ESLOPE
case ARCH_SLOPE:
LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE);
break;
#endif
case ARCH_MAPHEADER:
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER);
break;
@ -1336,11 +1324,9 @@ static UINT8 UnArchiveValueDemo(int TABLESINDEX, char field[1024])
case ARCH_SECTOR:
LUA_PushUserdata(gL, &sectors[READUINT16(demo_p)], META_SECTOR);
break;
#ifdef ESLOPE
case ARCH_SLOPE:
LUA_PushUserdata(gL, P_SlopeById(READUINT16(demo_p)), META_SLOPE);
break;
#endif
case ARCH_MAPHEADER:
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(demo_p)], META_MAPHEADER);
break;

View File

@ -16,6 +16,7 @@
#include "doomdef.h"
#include "command.h"
#include "m_argv.h"
#include "m_misc.h"
/** \brief number of arg
*/
@ -166,7 +167,7 @@ void M_FindResponseFile(void)
if (!file)
I_Error("No more free memory for the response file");
if (fread(file, size, 1, handle) != 1)
I_Error("Couldn't read response file because %s", strerror(ferror(handle)));
I_Error("Couldn't read response file because %s", M_FileError(handle));
fclose(handle);
// keep all the command line arguments following @responsefile

View File

@ -862,13 +862,9 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
if (ceiling)
{
#ifdef ESLOPE
// Truncate position to match where mapthing would be when spawned
// (this applies to every further P_GetZAt call as well)
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{
@ -879,11 +875,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{
CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"),
@ -931,20 +923,12 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
mt->y = (INT16)(player->mo->y>>FRACBITS);
if (ceiling)
{
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
}
mt->options <<= ZSHIFT;
@ -1001,11 +985,7 @@ void OP_NightsObjectplace(player_t *player)
UINT16 angle = (UINT16)(player->anotherflyangle % 360);
INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle
sector_t *sec = player->mo->subsector->sector;
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
player->pflags |= PF_ATTACKDOWN;
@ -1162,20 +1142,12 @@ void OP_ObjectplaceMovement(player_t *player)
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP))
{
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS);
}
op_displayflags <<= ZSHIFT;

View File

@ -32,6 +32,7 @@
#include "sounds.h"
#include "s_sound.h"
#include "i_system.h"
#include "i_threads.h"
// Addfile
#include "filesrch.h"
@ -118,6 +119,12 @@ typedef enum
NUM_QUITMESSAGES
} text_enum;
#ifdef HAVE_THREADS
I_mutex m_menu_mutex;
#endif
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
const char *quitmsg[NUM_QUITMESSAGES];
// Stuff for customizing the player select screen Tails 09-22-2003
@ -1039,7 +1046,7 @@ enum
FIRSTSERVERLINE
};
static menuitem_t MP_RoomMenu[] =
menuitem_t MP_RoomMenu[] =
{
{IT_STRING | IT_CALL, NULL, "<Offline Mode>", M_ChooseRoom, 9},
{IT_DISABLED, NULL, "", M_ChooseRoom, 18},
@ -2896,7 +2903,6 @@ boolean M_Responder(event_t *ev)
//make sure the game doesn't still think we're in a netgame.
if (!Playing() && netgame && multiplayer)
{
MSCloseUDPSocket(); // Clean up so we can re-open the connection later.
netgame = false;
multiplayer = false;
}
@ -3304,6 +3310,30 @@ void M_SetupNextMenu(menu_t *menudef)
{
INT16 i;
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
if (currentMenu == &MP_RoomDef || currentMenu == &MP_ConnectDef)
{
I_lock_mutex(&ms_QueryId_mutex);
{
ms_QueryId++;
}
I_unlock_mutex(ms_QueryId_mutex);
}
if (currentMenu == &MP_ConnectDef)
{
I_lock_mutex(&ms_ServerList_mutex);
{
if (ms_ServerList)
{
free(ms_ServerList);
ms_ServerList = NULL;
}
}
I_unlock_mutex(ms_ServerList_mutex);
}
#endif/*HAVE_THREADS*/
if (currentMenu->quitroutine)
{
// If you're going from a menu to itself, why are you running the quitroutine? You're not quitting it! -SH
@ -3361,6 +3391,19 @@ void M_Ticker(void)
if (--vidm_testingmode == 0)
setmodeneeded = vidm_previousmode + 1;
}
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
I_lock_mutex(&ms_ServerList_mutex);
{
if (ms_ServerList)
{
CL_QueryServerList(ms_ServerList);
free(ms_ServerList);
ms_ServerList = NULL;
}
}
I_unlock_mutex(ms_ServerList_mutex);
#endif
}
//
@ -4833,7 +4876,7 @@ static boolean M_AddonsRefresh(void)
else if (majormods && !prevmajormods)
{
S_StartSound(NULL, sfx_s221);
message = va("%c%s\x80\nGameplay has now been modified.\nIf you wish to play Record Attack mode, restart the game to clear existing addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
prevmajormods = majormods;
}
@ -8327,22 +8370,65 @@ static INT32 menuRoomIndex = 0;
static void M_DrawRoomMenu(void)
{
static int frame = -12;
int dot_frame;
char text[4];
const char *rmotd;
const char *waiting_message;
int dots;
if (m_waiting_mode)
{
dot_frame = frame / 4;
dots = dot_frame + 3;
strcpy(text, " ");
if (dots > 0)
{
if (dot_frame < 0)
dot_frame = 0;
strncpy(&text[dot_frame], "...", min(dots, 3 - dot_frame));
}
if (++frame == 12)
frame = -12;
currentMenu->menuitems[0].text = text;
}
// use generic drawer for cursor, items and title
M_DrawGenericMenu();
V_DrawString(currentMenu->x - 16, currentMenu->y, highlightflags, M_GetText("Select a room"));
M_DrawTextBox(144, 24, 20, 20);
if (m_waiting_mode == M_NOT_WAITING)
{
M_DrawTextBox(144, 24, 20, 20);
if (itemOn == 0)
rmotd = M_GetText("Don't connect to the Master Server.");
else
rmotd = room_list[itemOn-1].motd;
if (itemOn == 0)
rmotd = M_GetText("Don't connect to the Master Server.");
else
rmotd = room_list[itemOn-1].motd;
rmotd = V_WordWrap(0, 20*8, 0, rmotd);
V_DrawString(144+8, 32, V_ALLOWLOWERCASE|V_RETURN8, rmotd);
rmotd = V_WordWrap(0, 20*8, 0, rmotd);
V_DrawString(144+8, 32, V_ALLOWLOWERCASE|V_RETURN8, rmotd);
}
if (m_waiting_mode)
{
// Display a little "please wait" message.
M_DrawTextBox(52, BASEVIDHEIGHT/2-10, 25, 3);
if (m_waiting_mode == M_WAITING_VERSION)
waiting_message = "Checking for updates...";
else
waiting_message = "Fetching room info...";
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, 0, waiting_message);
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2)+12, 0, "Please wait.");
}
}
static void M_DrawConnectMenu(void)
@ -8416,6 +8502,14 @@ static void M_DrawConnectMenu(void)
localservercount = serverlistcount;
M_DrawGenericMenu();
if (m_waiting_mode)
{
// Display a little "please wait" message.
M_DrawTextBox(52, BASEVIDHEIGHT/2-10, 25, 3);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, 0, "Searching for servers...");
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2)+12, 0, "Please wait.");
}
}
static boolean M_CancelConnect(void)
@ -8497,10 +8591,10 @@ void M_SortServerList(void)
#ifndef NONET
#ifdef UPDATE_ALERT
static boolean M_CheckMODVersion(void)
static boolean M_CheckMODVersion(int id)
{
char updatestring[500];
const char *updatecheck = GetMODVersion();
const char *updatecheck = GetMODVersion(id);
if(updatecheck)
{
sprintf(updatestring, UPDATE_ALERT_STRING, VERSIONSTRING, updatecheck);
@ -8509,7 +8603,64 @@ static boolean M_CheckMODVersion(void)
} else
return true;
}
#endif/*UPDATE_ALERT*/
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
static void
Check_new_version_thread (int *id)
{
int hosting;
int okay;
okay = 0;
#ifdef UPDATE_ALERT
if (M_CheckMODVersion(*id))
#endif
{
I_lock_mutex(&ms_QueryId_mutex);
{
okay = ( *id == ms_QueryId );
}
I_unlock_mutex(ms_QueryId_mutex);
if (okay)
{
I_lock_mutex(&m_menu_mutex);
{
m_waiting_mode = M_WAITING_ROOMS;
hosting = ( currentMenu->prevMenu == &MP_ServerDef );
}
I_unlock_mutex(m_menu_mutex);
GetRoomsList(hosting, *id);
}
}
else
{
I_lock_mutex(&ms_QueryId_mutex);
{
okay = ( *id == ms_QueryId );
}
I_unlock_mutex(ms_QueryId_mutex);
}
if (okay)
{
I_lock_mutex(&m_menu_mutex);
{
if (m_waiting_mode)
{
m_waiting_mode = M_NOT_WAITING;
MP_RoomMenu[0].text = "<Offline Mode>";
}
}
I_unlock_mutex(m_menu_mutex);
}
free(id);
}
#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
static void M_ConnectMenu(INT32 choice)
{
@ -8538,18 +8689,21 @@ static void M_ConnectMenuModChecks(INT32 choice)
if (modifiedgame)
{
M_StartMessage(M_GetText("Addons are currently loaded.\n\nYou will only be able to join a server if\nit has the same ones loaded in the same order, which may be unlikely.\n\nIf you wish to play on other servers,\nrestart the game to clear existing addons.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER);
M_StartMessage(M_GetText("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER);
return;
}
M_ConnectMenu(-1);
}
static UINT32 roomIds[NUM_LIST_ROOMS];
UINT32 roomIds[NUM_LIST_ROOMS];
static void M_RoomMenu(INT32 choice)
{
INT32 i;
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
int *id;
#endif
(void)choice;
@ -8562,34 +8716,54 @@ static void M_RoomMenu(INT32 choice)
if (rendermode == render_soft)
I_FinishUpdate(); // page flip or blit buffer
if (GetRoomsList(currentMenu == &MP_ServerDef) < 0)
return;
#ifdef UPDATE_ALERT
if (!M_CheckMODVersion())
return;
#endif
for (i = 1; i < NUM_LIST_ROOMS+1; ++i)
MP_RoomMenu[i].status = IT_DISABLED;
memset(roomIds, 0, sizeof(roomIds));
for (i = 0; room_list[i].header.buffer[0]; i++)
{
if(*room_list[i].name != '\0')
{
MP_RoomMenu[i+1].text = room_list[i].name;
roomIds[i] = room_list[i].id;
MP_RoomMenu[i+1].status = IT_STRING|IT_CALL;
}
}
MP_RoomDef.prevMenu = currentMenu;
M_SetupNextMenu(&MP_RoomDef);
#ifdef MASTERSERVER
#ifdef HAVE_THREADS
#ifdef UPDATE_ALERT
m_waiting_mode = M_WAITING_VERSION;
#else/*UPDATE_ALERT*/
m_waiting_mode = M_WAITING_ROOMS;
#endif/*UPDATE_ALERT*/
MP_RoomMenu[0].text = "";
id = malloc(sizeof *id);
I_lock_mutex(&ms_QueryId_mutex);
{
*id = ms_QueryId;
}
I_unlock_mutex(ms_QueryId_mutex);
I_spawn_thread("check-new-version",
(I_thread_fn)Check_new_version_thread, id);
#else/*HAVE_THREADS*/
#ifdef UPDATE_ALERT
if (M_CheckMODVersion(0))
#endif/*UPDATE_ALERT*/
{
GetRoomsList(currentMenu->prevMenu == &MP_ServerDef, 0);
}
#endif/*HAVE_THREADS*/
#endif/*MASTERSERVER*/
}
static void M_ChooseRoom(INT32 choice)
{
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
I_lock_mutex(&ms_QueryId_mutex);
{
ms_QueryId++;
}
I_unlock_mutex(ms_QueryId_mutex);
#endif
if (choice == 0)
ms_RoomId = -1;
else

View File

@ -17,6 +17,8 @@
#include "d_event.h"
#include "command.h"
#include "i_threads.h"
#include "mserv.h"
#include "r_things.h" // for SKINNAMESIZE
//
@ -72,6 +74,18 @@ typedef enum
} menumessagetype_t;
void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype);
typedef enum
{
M_NOT_WAITING,
M_WAITING_VERSION,
M_WAITING_ROOMS,
M_WAITING_SERVERS,
}
M_waiting_mode_t;
extern M_waiting_mode_t m_waiting_mode;
// Called by linux_x/i_video_xshm.c
void M_QuitResponse(INT32 ch);
@ -161,6 +175,9 @@ typedef struct menuitem_s
extern menuitem_t PlayerMenu[MAXSKINS];
extern menuitem_t MP_RoomMenu[];
extern UINT32 roomIds[NUM_LIST_ROOMS];
typedef struct menu_s
{
const char *menutitlepic;
@ -176,6 +193,10 @@ typedef struct menu_s
void M_SetupNextMenu(menu_t *menudef);
void M_ClearMenus(boolean callexitmenufunc);
#ifdef HAVE_THREADS
extern I_mutex m_menu_mutex;
#endif
extern menu_t *currentMenu;
extern menu_t MainDef;

View File

@ -23,6 +23,8 @@
#include <unistd.h>
#endif
#include <errno.h>
// Extended map support.
#include <ctype.h>
@ -2363,3 +2365,13 @@ void M_SetupMemcpy(void)
M_Memcpy = cpu_cpy;
#endif
}
/** Return the appropriate message for a file error or end of file.
*/
const char *M_FileError(FILE *fp)
{
if (ferror(fp))
return strerror(errno);
else
return "end-of-file";
}

View File

@ -100,6 +100,8 @@ void strcatbf(char *s1, const char *s2, const char *s3);
void M_SetupMemcpy(void);
const char *M_FileError(FILE *handle);
// counting bits, for weapon ammo code, usually
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
// Copyright (C) 2020 by James R.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -13,7 +14,7 @@
#ifndef _MSERV_H_
#define _MSERV_H_
#define MASTERSERVERS21 // MasterServer v2.1
#include "i_threads.h"
// lowered from 32 due to menu changes
#define NUM_LIST_ROOMS 16
@ -64,33 +65,47 @@ typedef struct
// ================================ GLOBALS ===============================
extern consvar_t cv_masterserver, cv_servername;
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;
// < 0 to not connect (usually -1) (offline mode)
// == 0 to show all rooms, not a valid hosting room
// anything else is whatever room the MS assigns to that number (online mode)
INT16 ms_RoomId;
extern INT16 ms_RoomId;
const char *GetMasterServerPort(void);
const char *GetMasterServerIP(void);
#ifdef HAVE_THREADS
extern int ms_QueryId;
extern I_mutex ms_QueryId_mutex;
void MSOpenUDPSocket(void);
void MSCloseUDPSocket(void);
void SendAskInfoViaMS(INT32 node, tic_t asktime);
extern msg_server_t *ms_ServerList;
extern I_mutex ms_ServerList_mutex;
#endif
void RegisterServer(void);
void UnregisterServer(void);
void MasterClient_Ticker(void);
const msg_server_t *GetShortServersList(INT32 room);
INT32 GetRoomsList(boolean hosting);
msg_server_t *GetShortServersList(INT32 room, int id);
INT32 GetRoomsList(boolean hosting, int id);
#ifdef UPDATE_ALERT
const char *GetMODVersion(void);
char *GetMODVersion(int id);
void GetMODVersion_Console(void);
#endif
extern msg_rooms_t room_list[NUM_LIST_ROOMS+1];
void AddMServCommands(void);
/* HTTP */
void HMS_set_api (char *api);
int HMS_fetch_rooms (int joining, int id);
int HMS_register (void);
int HMS_unlist (void);
int HMS_update (void);
void HMS_list_servers (void);
msg_server_t * HMS_fetch_servers (msg_server_t *list, int room, int id);
int HMS_compare_mod_version (char *buffer, size_t size_of_buffer);
#endif

View File

@ -5795,13 +5795,8 @@ void A_MixUp(mobj_t *actor)
P_SetThingPosition(players[i].mo);
#ifdef ESLOPE
players[i].mo->floorz = P_GetFloorZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
players[i].mo->ceilingz = P_GetCeilingZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
#else
players[i].mo->floorz = players[i].mo->subsector->sector->floorheight;
players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight;
#endif
P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y);
}

View File

@ -328,9 +328,7 @@ extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
extern camera_t *mapcampointer;
extern fixed_t tmx;
extern fixed_t tmy;
#ifdef ESLOPE
extern pslope_t *tmfloorslope, *tmceilingslope;
#endif
/* cphipps 2004/08/30 */
extern void P_MapStart(void);

View File

@ -31,9 +31,7 @@
#include "r_splats.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "z_zone.h"
@ -56,9 +54,7 @@ fixed_t tmfloorz, tmceilingz;
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
#ifdef ESLOPE
pslope_t *tmfloorslope, *tmceilingslope;
#endif
// keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls
@ -135,9 +131,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
return false;
}
#ifdef ESLOPE
object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you.
#endif
object->eflags |= MFE_SPRUNG; // apply this flag asap!
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
@ -275,9 +269,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
zdist = object->z - spring->z;
}
#ifdef ESLOPE
object->standingslope = NULL; // No launching off at silly angles for you.
#endif
switch (spring->type)
{
@ -1758,9 +1750,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->z + thing->height > tmfloorz)
{
tmfloorz = thing->z + thing->height;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
}
return true;
}
@ -1777,17 +1767,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
&& tmthing->z + tmthing->height < tmthing->ceilingz)
{
tmfloorz = tmceilingz = topz; // block while in air
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision
}
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
{
tmceilingz = topz;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
tmfloorthing = thing; // thing we may stand on
}
}
@ -1801,9 +1787,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->z < tmceilingz)
{
tmceilingz = thing->z;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
}
return true;
}
@ -1820,17 +1804,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
&& tmthing->z > tmthing->floorz)
{
tmfloorz = tmceilingz = topz; // block while in air
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision
}
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
{
tmfloorz = topz;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
tmfloorthing = thing; // thing we may stand on
}
}
@ -1964,17 +1944,13 @@ if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a
{
tmceilingz = opentop;
ceilingline = ld;
#ifdef ESLOPE
tmceilingslope = opentopslope;
#endif
}
if (openbottom > tmfloorz)
{
tmfloorz = openbottom;
#ifdef ESLOPE
tmfloorslope = openbottomslope;
#endif
}
if (highceiling > tmdrpoffceilz)
@ -2053,10 +2029,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
// will adjust them.
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
#ifdef ESLOPE
tmfloorslope = newsubsec->sector->f_slope;
tmceilingslope = newsubsec->sector->c_slope;
#endif
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
if (newsubsec->sector->ffloors)
@ -2096,18 +2070,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{
if (tmfloorz < topheight - sinklevel) {
tmfloorz = topheight - sinklevel;
#ifdef ESLOPE
tmfloorslope = *rover->t_slope;
#endif
}
}
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
{
if (tmceilingz > bottomheight + sinklevel) {
tmceilingz = bottomheight + sinklevel;
#ifdef ESLOPE
tmceilingslope = *rover->b_slope;
#endif
}
}
}
@ -2129,9 +2099,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{
if (tmfloorz < thing->z) {
tmfloorz = thing->z;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
}
}
// Quicksand blocks never change heights otherwise.
@ -2147,18 +2115,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
&& !(rover->flags & FF_REVERSEPLATFORM))
{
tmfloorz = tmdropoffz = topheight;
#ifdef ESLOPE
tmfloorslope = *rover->t_slope;
#endif
}
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
&& !(rover->flags & FF_PLATFORM)
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
{
tmceilingz = tmdrpoffceilz = bottomheight;
#ifdef ESLOPE
tmceilingslope = *rover->b_slope;
#endif
}
}
}
@ -2175,7 +2139,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
BMBOUNDFIX(xl, xh, yl, yh);
#ifdef POLYOBJECTS
// Check polyobjects and see if tmfloorz/tmceilingz need to be altered
{
validcount++;
@ -2233,23 +2196,18 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) {
tmfloorz = tmdropoffz = polytop;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
}
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
tmceilingz = tmdrpoffceilz = polybottom;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
}
}
plink = (polymaplink_t *)(plink->link.next);
}
}
}
#endif
// tmfloorthing is set when tmfloorz comes from a thing's top
tmfloorthing = NULL;
@ -2407,7 +2365,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
BMBOUNDFIX(xl, xh, yl, yh);
#ifdef POLYOBJECTS
// Check polyobjects and see if tmfloorz/tmceilingz need to be altered
{
validcount++;
@ -2478,7 +2435,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
}
}
}
#endif
// check lines
for (bx = xl; bx <= xh; bx++)
@ -2657,10 +2613,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
mobj_t *oldthing = tmthing;
line_t *oldceilline = ceilingline;
line_t *oldblockline = blockingline;
#ifdef ESLOPE
pslope_t *oldfslope = tmfloorslope;
pslope_t *oldcslope = tmceilingslope;
#endif
// Move the player
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
@ -2673,10 +2627,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
P_SetTarget(&tmthing, oldthing);
ceilingline = oldceilline;
blockingline = oldblockline;
#ifdef ESLOPE
tmfloorslope = oldfslope;
tmceilingslope = oldcslope;
#endif
thing->momz = stand->momz;
}
else
@ -2698,9 +2650,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
fixed_t tryy = thing->y;
fixed_t radius = thing->radius;
fixed_t thingtop = thing->z + thing->height;
#ifdef ESLOPE
fixed_t startingonground = P_IsObjectOnGround(thing);
#endif
floatok = false;
if (radius < MAXRADIUS/2)
@ -2791,26 +2741,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#ifdef ESLOPE
else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep)
{
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#endif
}
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
{
thing->z = thing->floorz = tmfloorz;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#ifdef ESLOPE
else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
{
thing->z = thing->floorz = tmfloorz;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#endif
}
if (thing->eflags & MFE_VERTICALFLIP)
@ -2872,7 +2818,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->floorz = tmfloorz;
thing->ceilingz = tmceilingz;
#ifdef ESLOPE
if (!(thing->flags & MF_NOCLIPHEIGHT))
{
// Assign thing's standingslope if needed
@ -2893,7 +2838,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
else // don't set standingslope if you're not going to clip against it
thing->standingslope = NULL;
#endif
thing->x = x;
thing->y = y;
@ -4674,10 +4618,8 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
sector_t *sec = R_PointInSubsector(x, y)->sector;
fixed_t floorz = sec->floorheight;
#ifdef ESLOPE
if (sec->f_slope)
floorz = P_GetZAt(sec->f_slope, x, y);
#endif
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
if (sec->ffloors)
@ -4697,12 +4639,10 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, x, y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, x, y);
#endif
if (rover->flags & FF_QUICKSAND)
{

View File

@ -308,9 +308,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
// OPTIMIZE: keep this precalculated
//
fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
pslope_t *opentopslope, *openbottomslope;
#endif
// P_CameraLineOpening
// P_LineOpening, but for camera
@ -337,24 +335,20 @@ void P_CameraLineOpening(line_t *linedef)
{
frontfloor = sectors[front->camsec].floorheight;
frontceiling = sectors[front->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera[0].x, camera[0].y);
if (sectors[front->camsec].c_slope)
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else if (front->heightsec >= 0)
{
frontfloor = sectors[front->heightsec].floorheight;
frontceiling = sectors[front->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera[0].x, camera[0].y);
if (sectors[front->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else
{
@ -365,23 +359,19 @@ void P_CameraLineOpening(line_t *linedef)
{
backfloor = sectors[back->camsec].floorheight;
backceiling = sectors[back->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera[0].x, camera[0].y);
if (sectors[back->camsec].c_slope)
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else if (back->heightsec >= 0)
{
backfloor = sectors[back->heightsec].floorheight;
backceiling = sectors[back->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera[0].x, camera[0].y);
if (sectors[back->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else
{
@ -501,14 +491,12 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
}
// Treat polyobjects kind of like 3D Floors
#ifdef POLYOBJECTS
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
{
front = linedef->frontsector;
back = linedef->frontsector;
}
else
#endif
{
front = linedef->frontsector;
back = linedef->backsector;
@ -527,17 +515,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
opentop = frontheight;
highceiling = backheight;
#ifdef ESLOPE
opentopslope = front->c_slope;
#endif
}
else
{
opentop = backheight;
highceiling = frontheight;
#ifdef ESLOPE
opentopslope = back->c_slope;
#endif
}
frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
@ -547,17 +531,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
openbottom = frontheight;
lowfloor = backheight;
#ifdef ESLOPE
openbottomslope = front->f_slope;
#endif
}
else
{
openbottom = backheight;
lowfloor = frontheight;
#ifdef ESLOPE
openbottomslope = back->f_slope;
#endif
}
}
@ -625,9 +605,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
// Check for fake floors in the sector.
if (front->ffloors || back->ffloors
#ifdef POLYOBJECTS
|| linedef->polyobj
#endif
)
{
ffloor_t *rover;
@ -637,10 +615,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
fixed_t highestfloor = openbottom;
fixed_t lowestfloor = lowfloor;
fixed_t delta1, delta2;
#ifdef ESLOPE
pslope_t *ceilingslope = opentopslope;
pslope_t *floorslope = openbottomslope;
#endif
// Check for frontsector's fake floors
for (rover = front->ffloors; rover; rover = rover->next)
@ -665,9 +641,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (bottomheight < lowestceiling) {
lowestceiling = bottomheight;
#ifdef ESLOPE
ceilingslope = *rover->b_slope;
#endif
}
else if (bottomheight < highestceiling)
highestceiling = bottomheight;
@ -677,9 +651,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (topheight > highestfloor) {
highestfloor = topheight;
#ifdef ESLOPE
floorslope = *rover->t_slope;
#endif
}
else if (topheight > lowestfloor)
lowestfloor = topheight;
@ -709,9 +681,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (bottomheight < lowestceiling) {
lowestceiling = bottomheight;
#ifdef ESLOPE
ceilingslope = *rover->b_slope;
#endif
}
else if (bottomheight < highestceiling)
highestceiling = bottomheight;
@ -721,16 +691,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (topheight > highestfloor) {
highestfloor = topheight;
#ifdef ESLOPE
floorslope = *rover->t_slope;
#endif
}
else if (topheight > lowestfloor)
lowestfloor = topheight;
}
}
#ifdef POLYOBJECTS
// Treat polyobj's backsector like a 3D Floor
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
{
@ -740,38 +707,29 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
if (polysec->floorheight < lowestceiling && delta1 >= delta2) {
lowestceiling = polysec->floorheight;
#ifdef ESLOPE
ceilingslope = NULL;
#endif
}
else if (polysec->floorheight < highestceiling && delta1 >= delta2)
highestceiling = polysec->floorheight;
if (polysec->ceilingheight > highestfloor && delta1 < delta2) {
highestfloor = polysec->ceilingheight;
#ifdef ESLOPE
floorslope = NULL;
#endif
}
else if (polysec->ceilingheight > lowestfloor && delta1 < delta2)
lowestfloor = polysec->ceilingheight;
}
#endif
if (highestceiling < highceiling)
highceiling = highestceiling;
if (highestfloor > openbottom) {
openbottom = highestfloor;
#ifdef ESLOPE
openbottomslope = floorslope;
#endif
}
if (lowestceiling < opentop) {
opentop = lowestceiling;
#ifdef ESLOPE
opentopslope = ceilingslope;
#endif
}
if (lowestfloor > lowfloor)
@ -1023,9 +981,7 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
{
INT32 offset;
const INT32 *list; // Big blockmap
#ifdef POLYOBJECTS
polymaplink_t *plink; // haleyjd 02/22/06
#endif
line_t *ld;
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
@ -1033,7 +989,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
offset = y*bmapwidth + x;
#ifdef POLYOBJECTS
// haleyjd 02/22/06: consider polyobject lines
plink = polyblocklinks[offset];
@ -1057,7 +1012,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
}
plink = (polymaplink_t *)(plink->link.next);
}
#endif
offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];

View File

@ -55,9 +55,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
extern pslope_t *opentopslope, *openbottomslope;
#endif
void P_LineOpening(line_t *plinedef, mobj_t *mobj);

View File

@ -31,9 +31,7 @@
#include "i_video.h"
#include "lua_hook.h"
#include "b_bot.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "k_kart.h"
@ -646,12 +644,10 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (mobj->z > topheight)
return false;
@ -662,7 +658,6 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
return true;
}
#ifdef ESLOPE
// P_GetFloorZ (and its ceiling counterpart)
// Gets the floor height (or ceiling height) of the mobj's contact point in sector, assuming object's center if moved to [x, y]
// If line is supplied, it's a divider line on the sector. Set it to NULL if you're not checking for collision with a line
@ -766,15 +761,11 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
P_GetZAt(slope, v2.x, v2.y)
);
}
#endif
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->f_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@ -844,25 +835,13 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the floor height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->floorheight;
}
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->c_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@ -932,26 +911,14 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the ceiling height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->ceilingheight;
}
// Now do the same as all above, but for cameras because apparently cameras are special?
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->f_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@ -1021,25 +988,13 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the floor height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->floorheight;
}
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->c_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@ -1109,15 +1064,6 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the ceiling height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->ceilingheight;
}
static void P_PlayerFlip(mobj_t *mo)
@ -1406,9 +1352,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
#ifdef ESLOPE
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
#endif
)
{
// if in a walking frame, stop moving
@ -1556,11 +1500,9 @@ void P_XYMovement(mobj_t *mo)
fixed_t xmove, ymove;
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
boolean moved;
#ifdef ESLOPE
pslope_t *oldslope = NULL;
vector3_t slopemom;
fixed_t predictedz = 0;
#endif
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
@ -1590,7 +1532,6 @@ void P_XYMovement(mobj_t *mo)
oldx = mo->x;
oldy = mo->y;
#ifdef ESLOPE
// adjust various things based on slope
if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) {
if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing!
@ -1612,7 +1553,6 @@ void P_XYMovement(mobj_t *mo)
}
} else if (P_IsObjectOnGround(mo) && !mo->momz)
predictedz = mo->z;
#endif
// Pushables can break some blocks
if (CheckForBustableBlocks && mo->flags & MF_PUSHABLE)
@ -1799,7 +1739,6 @@ void P_XYMovement(mobj_t *mo)
if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;;
return;
#ifdef ESLOPE
if (moved && oldslope) { // Check to see if we ran off
if (oldslope != mo->standingslope) { // First, compare different slopes
@ -1847,7 +1786,6 @@ void P_XYMovement(mobj_t *mo)
//CONS_Printf("Launched off of flat surface running into downward slope\n");
}
}
#endif
// Check the gravity status.
P_CheckGravity(mo, false);
@ -1898,11 +1836,9 @@ void P_XYMovement(mobj_t *mo)
if (player && player->pflags & PF_NIGHTSMODE)
return; // no friction for NiGHTS players
#ifdef ESLOPE
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
return;
#endif
//{ SRB2kart stuff
if (mo->type == MT_ORBINAUT || mo->type == MT_JAWZ_DUD || mo->type == MT_JAWZ || mo->type == MT_BALLHOG) //(mo->type == MT_JAWZ && !mo->tracer))
@ -2140,9 +2076,7 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
{
fixed_t topheight =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
#endif
*rover->topheight;
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
@ -2179,7 +2113,6 @@ static boolean P_ZMovement(mobj_t *mo)
}
mo->z += mo->momz;
#ifdef ESLOPE
if (mo->standingslope)
{
if (mo->flags & MF_NOCLIPHEIGHT)
@ -2187,7 +2120,6 @@ static boolean P_ZMovement(mobj_t *mo)
else if (!P_IsObjectOnGround(mo))
P_SlopeLaunch(mo);
}
#endif
switch (mo->type)
{
@ -2378,7 +2310,6 @@ static boolean P_ZMovement(mobj_t *mo)
else
mo->z = mo->floorz;
#ifdef ESLOPE
if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here?
{
mo->momz = 0;
@ -2391,7 +2322,6 @@ static boolean P_ZMovement(mobj_t *mo)
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
// hit the floor
if (mo->type == MT_FIREBALL) // special case for the fireball
@ -2491,13 +2421,11 @@ static boolean P_ZMovement(mobj_t *mo)
else
mom.y -= FixedMul(6*FRACUNIT, mo->scale);
}
#ifdef ESLOPE
else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)
{
// Pop the object up a bit to encourage bounciness
//mom.z = P_MobjFlip(mo)*mo->scale;
}
#endif
else
{
mom.x = mom.y = mom.z = 0;
@ -2543,11 +2471,9 @@ static boolean P_ZMovement(mobj_t *mo)
|| tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER))
mom.z = tmfloorthing->momz;
#ifdef ESLOPE
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
mo->momx = mom.x;
mo->momy = mom.y;
@ -2665,7 +2591,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|| mo->player->playerstate == PST_REBORN)
return;
#ifdef ESLOPE
if (mo->standingslope)
{
if (mo->flags & MF_NOCLIPHEIGHT)
@ -2673,7 +2598,6 @@ static void P_PlayerZMovement(mobj_t *mo)
else if (!P_IsObjectOnGround(mo))
P_SlopeLaunch(mo);
}
#endif
// clip movement
if (P_IsObjectOnGround(mo) && !(mo->flags & MF_NOCLIPHEIGHT))
@ -2702,19 +2626,15 @@ static void P_PlayerZMovement(mobj_t *mo)
&& mo->player->kartstuff[k_spinouttimer] == 0 && mo->player->kartstuff[k_squishedtimer] == 0) // SRB2kart
P_SetPlayerMobjState(mo, S_KART_STND1);
#ifdef ESLOPE
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
// Handle landing on slope during Z movement
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
}
#endif
#ifdef ESLOPE
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
// Handle landing on slope during Z movement
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
}
#endif
if (P_MobjFlip(mo)*mo->momz < 0) // falling
{
@ -2732,7 +2652,6 @@ static void P_PlayerZMovement(mobj_t *mo)
if (mo->eflags & MFE_JUSTHITFLOOR)
{
#ifdef POLYOBJECTS
// Check if we're on a polyobject
// that triggers a linedef executor.
msecnode_t *node;
@ -2792,7 +2711,6 @@ static void P_PlayerZMovement(mobj_t *mo)
}
if (!stopmovecut)
#endif
// Cut momentum in half when you hit the ground and
// aren't pressing any controls.
@ -2961,7 +2879,6 @@ static boolean P_SceneryZMovement(mobj_t *mo)
// set standingslope
P_TryMove(mo, mo->x, mo->y, true);
mo->momz = -mo->momz;
#ifdef ESLOPE
if (mo->standingslope)
{
if (mo->flags & MF_NOCLIPHEIGHT)
@ -2969,7 +2886,6 @@ static boolean P_SceneryZMovement(mobj_t *mo)
else if (!P_IsObjectOnGround(mo))
P_SlopeLaunch(mo);
}
#endif
S_StartSound(mo, mo->info->activesound);
}
break;
@ -3138,13 +3054,11 @@ void P_MobjCheckWater(mobj_t *mobj)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (mobj->eflags & MFE_VERTICALFLIP)
{
@ -3387,13 +3301,11 @@ static void P_SceneryCheckWater(mobj_t *mobj)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (topheight <= mobj->z
|| bottomheight > (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale)))
@ -3439,13 +3351,9 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
continue;
if (halfheight >= (
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
#endif
*rover->topheight) || halfheight <= (
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
#endif
*rover->bottomheight))
continue;
@ -3475,13 +3383,9 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
continue;
if (halfheight >= (
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
#endif
*rover->topheight) || halfheight <= (
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
#endif
*rover->bottomheight))
continue;
@ -3681,9 +3585,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
P_MobjCheckWater(mobj);
#ifdef ESLOPE
P_ButteredSlope(mobj);
#endif
// momentum movement
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
@ -3840,9 +3742,7 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
else
return;
mobj->floorz =
#ifdef ESLOPE
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
#endif
mobjsecsubsec->floorheight;
if (mobjsecsubsec->ffloors)
{
@ -3858,11 +3758,9 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
continue;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
else
#endif
topheight = *rover->topheight;
if (topheight > mobj->floorz)
@ -9343,7 +9241,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
mobj->eflags &= ~MFE_JUSTHITFLOOR;
}
#ifdef ESLOPE // Sliding physics for slidey mobjs!
if (mobj->type == MT_FLINGRING
|| mobj->type == MT_FLINGCOIN
|| P_WeaponOrPanel(mobj->type)
@ -9356,7 +9253,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
//if (mobj->standingslope) CONS_Printf("slope physics on mobj\n");
P_ButteredSlope(mobj);
}
#endif
if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
&& P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz
@ -9660,14 +9556,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
P_SetScale(mobj, mobj->destscale);
mobj->floorz =
#ifdef ESLOPE
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->subsector->sector->floorheight;
mobj->ceilingz =
#ifdef ESLOPE
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->subsector->sector->ceilingheight;
// Tells MobjCheckWater that the water height was not set.
@ -10184,14 +10076,10 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
P_SetPrecipitationThingPosition(mobj);
mobj->floorz = starting_floorz =
#ifdef ESLOPE
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->subsector->sector->floorheight;
mobj->ceilingz =
#ifdef ESLOPE
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->subsector->sector->ceilingheight;
mobj->z = z;
@ -10710,9 +10598,7 @@ void P_RespawnSpecials(void)
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
#ifdef ESLOPE
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
#endif
ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT;
if (mthing->options & MTF_AMBUSH
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i)))
@ -10722,9 +10608,7 @@ void P_RespawnSpecials(void)
else
{
z = (
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT;
if (mthing->options & MTF_AMBUSH
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i)))
@ -10981,14 +10865,10 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
sector = R_PointInSubsector(x, y)->sector;
floor =
#ifdef ESLOPE
sector->f_slope ? P_GetZAt(sector->f_slope, x, y) :
#endif
sector->floorheight;
ceiling =
#ifdef ESLOPE
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
#endif
sector->ceilingheight;
if (mthing)
@ -11060,14 +10940,10 @@ void P_MovePlayerToStarpost(INT32 playernum)
sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
floor =
#ifdef ESLOPE
sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
#endif
sector->floorheight;
ceiling =
#ifdef ESLOPE
sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
#endif
sector->ceilingheight;
if (mobj->player->kartstuff[k_starpostflip])
@ -11242,9 +11118,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS);
mthing->z = (INT16)(((
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) :
#endif
ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT));
if (numhuntemeralds < MAXHUNTEMERALDS)
@ -11360,9 +11234,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
if (i == MT_NIGHTSBUMPER)
z = (
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS);
else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE)
z = ONFLOORZ;
@ -11371,9 +11243,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
#ifdef ESLOPE
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
#endif
ss->sector->ceilingheight);
if (mthing->options & MTF_AMBUSH) // Special flag for rings
@ -11386,9 +11256,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
else
{
z = (
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
ss->sector->floorheight);
if (mthing->options & MTF_AMBUSH) // Special flag for rings
@ -11410,15 +11278,11 @@ void P_SpawnMapThing(mapthing_t *mthing)
// base positions
if (flip)
z = (
#ifdef ESLOPE
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
#endif
ss->sector->ceilingheight) - mobjinfo[i].height;
else
z = (
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
ss->sector->floorheight);
// offsetting
@ -11985,9 +11849,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
//hoopcenter->flags |= MF_NOTHINK;
z +=
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight;
hoopcenter->z = z - hoopcenter->height/2;
@ -12128,9 +11990,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
hoopcenter->spawnpoint = mthing;
z +=
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight;
hoopcenter->z = z - hoopcenter->height/2;
@ -12250,9 +12110,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum)
{
z =
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12304,9 +12162,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
#ifdef ESLOPE
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
#endif
sec->ceilingheight) - mobjinfo[ringthing].height;
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12314,9 +12170,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
else
{
z =
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12370,9 +12224,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
#ifdef ESLOPE
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
#endif
sec->ceilingheight) - mobjinfo[ringthing].height - dist*r;
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12380,9 +12232,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
else
{
z = (
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight) + dist*r;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12428,9 +12278,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
#ifdef ESLOPE
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
#endif
sec->ceilingheight) - mobjinfo[ringthing].height - 64*FRACUNIT*r;
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12438,9 +12286,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
else
{
z = (
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight) + 64*FRACUNIT*r;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
@ -12473,9 +12319,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
}
z =
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);

View File

@ -368,9 +368,7 @@ typedef struct mobj_s
INT32 cusval;
INT32 cvmem;
#ifdef ESLOPE
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
#endif
boolean colorized; // Whether the mobj uses the rainbow colormap

View File

@ -28,7 +28,6 @@
#include "r_state.h"
#include "r_defs.h"
#ifdef POLYOBJECTS
/*
Theory behind Polyobjects:
@ -2864,6 +2863,5 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata)
return 1;
}
#endif // ifdef POLYOBJECTS
// EOF

View File

@ -19,7 +19,6 @@
#include "r_defs.h"
// haleyjd: temporary define
#ifdef POLYOBJECTS
//
// Defines
//
@ -303,7 +302,6 @@ extern polyobj_t *PolyObjects;
extern INT32 numPolyObjects;
extern polymaplink_t **polyblocklinks; // polyobject blockmap
#endif // ifdef POLYOBJECTS
#endif

View File

@ -30,9 +30,7 @@
#include "r_sky.h"
#include "p_polyobj.h"
#include "lua_script.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
savedata_t savedata;
UINT8 *save_p;
@ -949,9 +947,7 @@ typedef enum
MD2_HPREV = 1<<8,
MD2_COLORIZED = 1<<9,
MD2_WAYPOINTCAP = 1<<10
#ifdef ESLOPE
, MD2_SLOPE = 1<<11
#endif
} mobj_diff2_t;
typedef enum
@ -985,7 +981,6 @@ typedef enum
tc_noenemies,
tc_eachtime,
tc_disappear,
#ifdef POLYOBJECTS
tc_polyrotate, // haleyjd 03/26/06: polyobjects
tc_polymove,
tc_polywaypoint,
@ -993,7 +988,6 @@ typedef enum
tc_polyswingdoor,
tc_polyflag,
tc_polydisplace,
#endif
tc_end
} specials_e;
@ -1142,10 +1136,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff2 |= MD2_HNEXT;
if (mobj->hprev)
diff2 |= MD2_HPREV;
#ifdef ESLOPE
if (mobj->standingslope)
diff2 |= MD2_SLOPE;
#endif
if (mobj->colorized)
diff2 |= MD2_COLORIZED;
if (mobj == waypointcap)
@ -1265,10 +1257,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, mobj->hnext->mobjnum);
if (diff2 & MD2_HPREV)
WRITEUINT32(save_p, mobj->hprev->mobjnum);
#ifdef ESLOPE
if (diff2 & MD2_SLOPE)
WRITEUINT16(save_p, mobj->standingslope->id);
#endif
if (diff2 & MD2_COLORIZED)
WRITEUINT8(save_p, mobj->colorized);
@ -1552,7 +1542,6 @@ static void SaveDisappearThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->exists);
}
#ifdef POLYOBJECTS
//
// SavePolyrotateThinker
@ -1662,7 +1651,6 @@ static void SavePolydisplaceThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->oldHeights);
}
#endif
/*
//
// SaveWhatThinker
@ -1842,7 +1830,6 @@ static void P_NetArchiveThinkers(void)
SaveDisappearThinker(th, tc_disappear);
continue;
}
#ifdef POLYOBJECTS
else if (th->function.acp1 == (actionf_p1)T_PolyObjRotate)
{
SavePolyrotatetThinker(th, tc_polyrotate);
@ -1878,7 +1865,6 @@ static void P_NetArchiveThinkers(void)
SavePolydisplaceThinker(th, tc_polydisplace);
continue;
}
#endif
#ifdef PARANOIA
else if (th->function.acv != P_RemoveThinkerDelayed) // wait garbage collection
I_Error("unknown thinker type %p", th->function.acp1);
@ -2142,10 +2128,8 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p);
if (diff2 & MD2_HPREV)
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
#ifdef ESLOPE
if (diff2 & MD2_SLOPE)
mobj->standingslope = P_SlopeById(READUINT16(save_p));
#endif
if (diff2 & MD2_COLORIZED)
mobj->colorized = READUINT8(save_p);
@ -2517,7 +2501,6 @@ static inline void LoadDisappearThinker(actionf_p1 thinker)
P_AddThinker(&ht->thinker);
}
#ifdef POLYOBJECTS
//
// LoadPolyrotateThinker
@ -2637,7 +2620,6 @@ static inline void LoadPolydisplaceThinker(actionf_p1 thinker)
ht->oldHeights = READFIXED(save_p);
P_AddThinker(&ht->thinker);
}
#endif
/*
//
@ -2806,7 +2788,6 @@ static void P_NetUnArchiveThinkers(void)
case tc_disappear:
LoadDisappearThinker((actionf_p1)T_Disappear);
break;
#ifdef POLYOBJECTS
case tc_polyrotate:
LoadPolyrotatetThinker((actionf_p1)T_PolyObjRotate);
break;
@ -2834,7 +2815,6 @@ static void P_NetUnArchiveThinkers(void)
case tc_polydisplace:
LoadPolydisplaceThinker((actionf_p1)T_PolyObjDisplace);
break;
#endif
case tc_scroll:
LoadScrollThinker((actionf_p1)T_Scroll);
break;
@ -2875,7 +2855,6 @@ static void P_NetUnArchiveThinkers(void)
//
// haleyjd 03/26/06: PolyObject saving code
//
#ifdef POLYOBJECTS
#define PD_FLAGS 0x01
#define PD_TRANS 0x02
@ -2964,7 +2943,6 @@ static inline void P_UnArchivePolyObjects(void)
for (i = 0; i < numSavedPolys; ++i)
P_UnArchivePolyObj(&PolyObjects[i]);
}
#endif
//
// P_FinishMobjs
//
@ -3445,9 +3423,7 @@ void P_SaveNetGame(void)
if (gamestate == GS_LEVEL)
{
P_NetArchiveWorld();
#ifdef POLYOBJECTS
P_ArchivePolyObjects();
#endif
P_NetArchiveThinkers();
P_NetArchiveSpecials();
}
@ -3489,9 +3465,7 @@ boolean P_LoadNetGame(void)
if (gamestate == GS_LEVEL)
{
P_NetUnArchiveWorld();
#ifdef POLYOBJECTS
P_UnArchivePolyObjects();
#endif
P_NetUnArchiveThinkers();
P_NetUnArchiveSpecials();
P_RelinkPointers();

View File

@ -78,9 +78,7 @@
#include "hardware/hw_light.h"
#endif
#ifdef ESLOPE
#include "p_slopes.h"
#endif
// SRB2Kart
#include "k_kart.h"
@ -1004,9 +1002,7 @@ static void P_LoadThings(void)
// Z for objects
mt->z = (INT16)(
#ifdef ESLOPE
mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) :
#endif
mtsector->floorheight)>>FRACBITS;
if (mt->type == 1700 // MT_AXIS
@ -1277,9 +1273,7 @@ static void P_LoadRawLineDefs(UINT8 *data, size_t i)
if (ld->sidenum[1] != 0xffff && ld->special)
sides[ld->sidenum[1]].special = ld->special;
#ifdef POLYOBJECTS
ld->polyobj = NULL;
#endif
}
}
@ -1407,8 +1401,6 @@ static void P_LoadRawSideDefs2(void *data)
{
UINT16 i;
INT32 num;
size_t j;
UINT32 cr, cg, cb;
for (i = 0; i < numsides; i++)
{
@ -1475,6 +1467,8 @@ static void P_LoadRawSideDefs2(void *data)
|| (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6]))
{
char *col;
RGBA_t color;
size_t j;
sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
msd->bottomtexture);
@ -1490,23 +1484,21 @@ static void P_LoadRawSideDefs2(void *data)
// encore mode colormaps!
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
// do this for both the start and fade colormaps.
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
#ifdef GLENCORE
if (encoremap)
{
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
cr = pLocalPalette[j].s.red;
cg = pLocalPalette[j].s.green;
cb = pLocalPalette[j].s.blue;
color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below
}
#endif
sec->extra_colormap->rgba = cr + cg + cb;
color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly
sec->extra_colormap->rgba = color.rgba;
// alpha
if (msd->toptexture[7])
@ -1533,23 +1525,21 @@ static void P_LoadRawSideDefs2(void *data)
col = msd->bottomtexture;
// do the exact same thing as above here.
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
#ifdef GLENCORE
if (encoremap)
{
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
cr = pLocalPalette[j].s.red;
cg = pLocalPalette[j].s.green;
cb = pLocalPalette[j].s.blue;
color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below
}
#endif
sec->extra_colormap->fadergba = cr + cg + cb;
color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly
sec->extra_colormap->fadergba = color.rgba;
// alpha
if (msd->bottomtexture[7])
@ -1953,11 +1943,9 @@ static void P_CreateBlockMap(void)
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
blockmap = blockmaplump + 4;
#ifdef POLYOBJECTS
// haleyjd 2/22/06: setup polyobject blockmap
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
#endif
}
}
@ -2030,11 +2018,9 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
blockmap = blockmaplump+4;
#ifdef POLYOBJECTS
// haleyjd 2/22/06: setup polyobject blockmap
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
#endif
return true;
/* Original
blockmaplump = W_CacheLumpNum(lump, PU_LEVEL);
@ -2096,11 +2082,9 @@ static boolean P_LoadRawBlockMap(UINT8 *data, size_t count, const char *lumpname
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
blockmap = blockmaplump+4;
#ifdef POLYOBJECTS
// haleyjd 2/22/06: setup polyobject blockmap
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
#endif
return true;
#endif
}
@ -3120,9 +3104,7 @@ boolean P_SetupLevel(boolean skipprecip)
P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
}
#ifdef ESLOPE
P_ResetDynamicSlopes();
#endif
P_LoadThings();

View File

@ -99,7 +99,6 @@ static fixed_t P_InterceptVector2(divline_t *v2, divline_t *v1)
return frac;
}
#ifdef POLYOBJECTS
static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
{
size_t i;
@ -145,7 +144,6 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
return true;
}
#endif
//
// P_CrossSubsector
@ -156,9 +154,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
{
seg_t *seg;
INT32 count;
#ifdef POLYOBJECTS
polyobj_t *po; // haleyjd 02/23/06
#endif
#ifdef RANGECHECK
if (num >= numsubsectors)
@ -168,7 +164,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
// haleyjd 02/23/06: this assignment should be after the above check
seg = segs + subsectors[num].firstline;
#ifdef POLYOBJECTS
// haleyjd 02/23/06: check polyobject lines
if ((po = subsectors[num].polyList))
{
@ -183,7 +178,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
po = (polyobj_t *)(po->link.next);
}
}
#endif
for (count = subsectors[num].numlines; --count >= 0; seg++) // check lines
{
@ -334,15 +328,10 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
// killough 11/98: shortcut for melee situations
// same subsector? obviously visible
#ifndef POLYOBJECTS
if (t1->subsector == t2->subsector)
return true;
#else
// haleyjd 02/23/06: can't do this if there are polyobjects in the subsec
if (!t1->subsector->polyList &&
t1->subsector == t2->subsector)
return true;
#endif
// An unobstructed LOS is possible.
// Now look from eyes of t1 to any part of t2.

View File

@ -23,7 +23,6 @@
#include "p_maputl.h"
#include "w_wad.h"
#ifdef ESLOPE
static pslope_t *slopelist = NULL;
static UINT16 slopecount = 0;
@ -620,7 +619,6 @@ void P_ResetDynamicSlopes(void) {
size_t i;
#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
boolean warned = false;
#endif
slopelist = NULL;
slopecount = 0;

View File

@ -13,7 +13,6 @@
#ifndef P_SLOPES_H__
#define P_SLOPES_H__
#ifdef ESLOPE
void P_CalculateSlopeNormal(pslope_t *slope);
void P_ResetDynamicSlopes(void);
void P_RunDynamicSlopes(void);
@ -41,7 +40,6 @@ void P_SlopeLaunch(mobj_t *mo);
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
void P_ButteredSlope(mobj_t *mo);
#endif
// EOF
#endif // #ifdef ESLOPE

View File

@ -1242,7 +1242,6 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start)
}
// haleyjd: temporary define
#ifdef POLYOBJECTS
//
// PolyDoor
@ -1451,7 +1450,6 @@ static boolean PolyDisplace(line_t *line)
return EV_DoPolyObjDisplace(&pdd);
}
#endif // ifdef POLYOBJECTS
/** Changes a sector's tag.
* Used by the linedef executor tag changer and by crumblers.
@ -3200,7 +3198,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
}
#ifdef POLYOBJECTS
case 480: // Polyobj_DoorSlide
case 481: // Polyobj_DoorSwing
PolyDoor(line);
@ -3227,7 +3224,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 491:
PolyTranslucency(line);
break;
#endif
default:
break;
@ -4984,10 +4980,8 @@ void P_UpdateSpecials(void)
// POINT LIMIT
P_CheckPointLimit();
#ifdef ESLOPE
// Dynamic slopeness
P_RunDynamicSlopes();
#endif
// ANIMATE TEXTURES
for (anim = anims; anim < lastanim; anim++)
@ -5132,11 +5126,9 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
ffloor->topyoffs = &sec2->ceiling_yoffs;
ffloor->topangle = &sec2->ceilingpic_angle;
#ifdef ESLOPE
// Add slopes
ffloor->t_slope = &sec2->c_slope;
ffloor->b_slope = &sec2->f_slope;
#endif
if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
flags &= ~FF_BLOCKOTHERS;
@ -5583,15 +5575,11 @@ void T_LaserFlash(laserthink_t *flash)
sourcesec = ffloor->master->frontsector; // Less to type!
#ifdef ESLOPE
top = (*ffloor->t_slope) ? P_GetZAt(*ffloor->t_slope, sector->soundorg.x, sector->soundorg.y)
: *ffloor->topheight;
bottom = (*ffloor->b_slope) ? P_GetZAt(*ffloor->b_slope, sector->soundorg.x, sector->soundorg.y)
: *ffloor->bottomheight;
sector->soundorg.z = (top + bottom)/2;
#else
sector->soundorg.z = (*ffloor->topheight + *ffloor->bottomheight)/2;
#endif
S_StartSound(&sector->soundorg, sfx_laser);
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
@ -6688,13 +6676,11 @@ void P_SpawnSpecials(INT32 fromnetsave)
sectors[s].midmap = lines[i].frontsector->midmap;
break;
#ifdef ESLOPE // Slope copy specials. Handled here for sanity.
case 720:
case 721:
case 722:
P_CopySectorSlope(&lines[i]);
break;
#endif
default:
break;
@ -6708,7 +6694,6 @@ void P_SpawnSpecials(INT32 fromnetsave)
Z_Free(secthinkers);
#ifdef POLYOBJECTS
// haleyjd 02/20/06: spawn polyobjects
Polyobj_InitLevel();
@ -6725,7 +6710,6 @@ void P_SpawnSpecials(INT32 fromnetsave)
break;
}
}
#endif
P_RunLevelLoadExecutors();
}
@ -7246,11 +7230,9 @@ void T_Disappear(disappear_t *d)
if (!(lines[d->sourceline].flags & ML_NOCLIMB))
{
#ifdef ESLOPE
if (*rover->t_slope)
sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y);
else
#endif
sectors[s].soundorg.z = *rover->topheight;
S_StartSound(&sectors[s].soundorg, sfx_appear);
}

View File

@ -1781,13 +1781,8 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (mo->z + (mo->height/2) > topheight)
continue;
@ -1821,13 +1816,8 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (mo->z + flipoffset > topheight)
continue;
@ -1966,9 +1956,7 @@ static void P_CheckBouncySectors(player_t *player)
fixed_t oldx;
fixed_t oldy;
fixed_t oldz;
#ifdef ESLOPE
vector3_t momentum;
#endif
oldx = player->mo->x;
oldy = player->mo->y;
@ -2023,7 +2011,6 @@ static void P_CheckBouncySectors(player_t *player)
{
fixed_t newmom;
#ifdef ESLOPE
pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
slope = *rover->t_slope;
@ -2039,9 +2026,6 @@ static void P_CheckBouncySectors(player_t *player)
P_ReverseQuantizeMomentumToSlope(&momentum, slope);
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
#else
newmom = -FixedMul(player->mo->momz,linedist);
#endif
if (abs(newmom) < (linedist*2))
{
@ -2064,7 +2048,6 @@ static void P_CheckBouncySectors(player_t *player)
else if (newmom < -P_GetPlayerHeight(player)/2)
newmom = -P_GetPlayerHeight(player)/2;
#ifdef ESLOPE
momentum.z = newmom*2;
if (slope)
@ -2073,9 +2056,6 @@ static void P_CheckBouncySectors(player_t *player)
player->mo->momx = momentum.x;
player->mo->momy = momentum.y;
player->mo->momz = momentum.z/2;
#else
player->mo->momz = newmom;
#endif
if (player->pflags & PF_SPINNING)
{
@ -2132,13 +2112,8 @@ static void P_CheckQuicksand(player_t *player)
if (!(rover->flags & FF_QUICKSAND))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
{
@ -2506,15 +2481,10 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
floorclimb = true;
else
{
#ifdef ESLOPE
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
: glidesector->sector->floorheight;
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
: glidesector->sector->ceilingheight;
#else
floorheight = glidesector->sector->floorheight;
ceilingheight = glidesector->sector->ceilingheight;
#endif
if (glidesector->sector->ffloors)
{
@ -2528,13 +2498,8 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
floorclimb = true;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
// Only supports rovers that are moving like an 'elevator', not just the top or bottom.
if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
@ -2575,11 +2540,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
if (roverbelow == rover)
continue;
#ifdef ESLOPE
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
#else
bottomheight2 = *roverbelow->bottomheight;
#endif
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true;
@ -2625,11 +2586,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
if (roverbelow == rover)
continue;
#ifdef ESLOPE
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
#else
topheight2 = *roverbelow->topheight;
#endif
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true;
@ -2684,11 +2641,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue;
#ifdef ESLOPE
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
bottomheight = *rover->bottomheight;
#endif
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
{
@ -2729,11 +2682,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
#else
topheight = *rover->topheight;
#endif
if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
{
@ -3102,12 +3051,10 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
ceilingheight = sec->ceilingheight;
floorheight = sec->floorheight;
#ifdef ESLOPE
if (sec->c_slope)
ceilingheight = P_GetZAt(sec->c_slope, checkx, checky);
if (sec->f_slope)
floorheight = P_GetZAt(sec->f_slope, checkx, checky);
#endif
highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight;
lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight;
@ -3118,13 +3065,8 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
{
if (!(rover->flags & FF_EXISTS)) continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (P_CheckSolidLava(player->mo, rover))
;
@ -3196,7 +3138,6 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
BMBOUNDFIX(xl, xh, yl, yh);
// Polyobjects
#ifdef POLYOBJECTS
validcount++;
for (by = yl; by <= yh; by++)
@ -3290,7 +3231,6 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
plink = (polymaplink_t *)(plink->link.next);
}
}
#endif
if (teeter) // only bother with objects as a last resort if you were already teetering
{
mobj_t *oldtmthing = tmthing;
@ -3583,9 +3523,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused.
&& !P_PlayerInPain(player)) // subsequent revs
{
if ((cmd->buttons & BT_BRAKE) && player->speed < FixedMul(5<<FRACBITS, player->mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)
#ifdef ESLOPE
&& (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
#endif
)
{
player->mo->momx = player->cmomx;
@ -3616,9 +3554,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused.
// AKA Just go into a spin on the ground, you idiot. ;)
else if ((cmd->buttons & BT_BRAKE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20))
&& !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
#ifdef ESLOPE
|| (player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)
#endif
) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING))
{
player->pflags |= PF_SPINNING;
@ -3632,9 +3568,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused.
// Rolling normally
if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH)
&& player->speed < FixedMul(5*FRACUNIT,player->mo->scale)
#ifdef ESLOPE
&& (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
#endif
)
{
if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player)))
@ -3873,9 +3807,7 @@ static void P_2dMovement(player_t *player)
else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt
player->cmomx = player->cmomy = 0;
else if (player->onconveyor != 2 && player->onconveyor != 4
#ifdef POLYOBJECTS
&& player->onconveyor != 1
#endif
)
player->cmomx = player->cmomy = 0;
@ -4023,12 +3955,10 @@ static void P_3dMovement(player_t *player)
//fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
boolean analogmove = false;
fixed_t oldMagnitude, newMagnitude;
#ifdef ESLOPE
vector3_t totalthrust;
totalthrust.x = totalthrust.y = 0; // I forget if this is needed
totalthrust.z = FRACUNIT*P_MobjFlip(player->mo)/3; // A bit of extra push-back on slopes
#endif // ESLOPE
// Get the old momentum; this will be needed at the end of the function! -SH
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
@ -4072,9 +4002,7 @@ static void P_3dMovement(player_t *player)
else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt
player->cmomx = player->cmomy = 0;
else if (player->onconveyor != 2 && player->onconveyor != 4
#ifdef POLYOBJECTS
&& player->onconveyor != 1
#endif
)
player->cmomx = player->cmomy = 0;
@ -4152,12 +4080,8 @@ static void P_3dMovement(player_t *player)
movepushforward = 0;
}
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
#else
P_Thrust(player->mo, movepushangle, movepushforward);
#endif
}
else if (!(player->kartstuff[k_spinouttimer]))
{
@ -4172,15 +4096,10 @@ static void P_3dMovement(player_t *player)
else
movepushside = (cmd->sidemove * FRACUNIT/128) - FixedDiv(player->speed, K_GetKartSpeed(player, true));
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside);
totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside);
#else
P_Thrust(player->mo, movepushsideangle, movepushside);
#endif
}
#ifdef ESLOPE
if ((totalthrust.x || totalthrust.y)
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
// Factor thrust to slope, but only for the part pushing up it!
@ -4200,7 +4119,6 @@ static void P_3dMovement(player_t *player)
player->mo->momx += totalthrust.x;
player->mo->momy += totalthrust.y;
#endif
// Time to ask three questions:
// 1) Are we over topspeed?
@ -5601,14 +5519,12 @@ void P_ElementalFireTrail(player_t *player)
{
newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
#ifdef ESLOPE
if (player->mo->standingslope)
{
ground = P_GetZAt(player->mo->standingslope, newx, newy);
if (player->mo->eflags & MFE_VERTICALFLIP)
ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale);
}
#endif
flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE);
P_SetTarget(&flame->target, player->mo);
flame->angle = travelangle;
@ -7487,13 +7403,14 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled)
{
static UINT8 lookbackdelay[4] = {0,0,0,0};
static boolean lookbackactive[MAXSPLITSCREENPLAYERS];
static UINT8 lookbackdelay[MAXSPLITSCREENPLAYERS];
UINT8 num;
angle_t angle = 0, focusangle = 0, focusaiming = 0;
fixed_t x, y, z, dist, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
fixed_t x, y, z, dist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
fixed_t pan, xpan, ypan;
INT32 camrotate;
boolean camstill, lookback;
boolean camstill, lookback, lookbackdown;
UINT8 timeover;
mobj_t *mo;
fixed_t f1, f2;
@ -7684,15 +7601,19 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camstill = true;
else if (lookback || lookbackdelay[num]) // SRB2kart - Camera flipper
{
#define MAXLOOKBACKDELAY 2
camspeed = FRACUNIT;
if (lookback)
{
camrotate += 180;
lookbackdelay[num] = 2;
lookbackdelay[num] = MAXLOOKBACKDELAY;
}
else
lookbackdelay[num]--;
}
lookbackdown = (lookbackdelay[num] == MAXLOOKBACKDELAY) != lookbackactive[num];
lookbackactive[num] = (lookbackdelay[num] == MAXLOOKBACKDELAY);
#undef MAXLOOKBACKDELAY
if (mo->eflags & MFE_VERTICALFLIP)
camheight += thiscam->height;
@ -7735,8 +7656,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
thiscam->angle = angle;
}
height = camheight;
// sets ideal cam pos
dist = camdist;
@ -7745,10 +7664,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
dist += abs(thiscam->momz)/4;
if (player->kartstuff[k_boostcam])
{
dist -= FixedMul(11*dist/16, player->kartstuff[k_boostcam]);
height -= FixedMul(height, player->kartstuff[k_boostcam]);
}
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
@ -7845,7 +7761,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
}
#ifdef POLYOBJECTS
// Check polyobjects and see if floorz/ceilingz need to be altered
{
INT32 xl, xh, yl, yh, bx, by;
@ -7924,7 +7839,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
}
}
#endif
// crushed camera
if (myceilingz <= myfloorz + thiscam->height && !resetcalled && !cameranoclip)
@ -8070,6 +7984,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
thiscam->aiming = ANGLE_22h;
}
if (lookbackdown)
P_MoveChaseCamera(player, thiscam, false);
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
}
@ -8201,13 +8118,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
@ -8229,13 +8141,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
@ -8510,9 +8417,7 @@ void P_PlayerThink(player_t *player)
P_MobjCheckWater(player->mo);
#ifndef SECTORSPECIALSAFTERTHINK
#ifdef POLYOBJECTS
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
#endif
player->onconveyor = 0;
// check special sectors : damage & secrets
@ -8670,10 +8575,8 @@ void P_PlayerThink(player_t *player)
// it lasts for one tic.
player->pflags &= ~PF_FULLSTASIS;
#ifdef POLYOBJECTS
if (player->onconveyor == 1)
player->cmomy = player->cmomx = 0;
#endif
//P_DoSuperStuff(player);
//P_CheckSneakerAndLivesTimer(player);
@ -8921,9 +8824,7 @@ void P_PlayerAfterThink(player_t *player)
cmd = &player->cmd;
#ifdef SECTORSPECIALSAFTERTHINK
#ifdef POLYOBJECTS
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
#endif
player->onconveyor = 0;
// check special sectors : damage & secrets

View File

@ -371,15 +371,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
{
return (
#ifdef POLYOBJECTS
!line->polyseg &&
#endif
back->ceilingpic == front->ceilingpic
&& back->floorpic == front->floorpic
#ifdef ESLOPE
&& back->f_slope == front->f_slope
&& back->c_slope == front->c_slope
#endif
&& back->lightlevel == front->lightlevel
&& !line->sidedef->midtexture
// Check offsets too!
@ -494,7 +490,6 @@ static void R_AddLine(seg_t *line)
doorclosed = 0;
// Closed door.
#ifdef ESLOPE
if (frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)
{
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
@ -537,7 +532,6 @@ static void R_AddLine(seg_t *line)
}
}
else
#endif
{
if (viewsector != backsector && viewsector != frontsector)
{
@ -654,7 +648,6 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
return true;
}
#ifdef POLYOBJECTS
size_t numpolys; // number of polyobjects in current subsector
size_t num_po_ptrs; // number of polyobject pointers allocated
@ -819,7 +812,6 @@ static void R_AddPolyObjects(subsector_t *sub)
R_AddLine(po_ptrs[i]->segs[j]);
}
}
#endif
//
// R_Subsector
@ -860,15 +852,11 @@ static void R_Subsector(size_t num)
floorcolormap = ceilingcolormap = frontsector->extra_colormap;
floorcenterz =
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->floorheight;
ceilingcenterz =
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->ceilingheight;
// Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps.
@ -896,29 +884,21 @@ static void R_Subsector(size_t num)
sub->sector->extra_colormap = frontsector->extra_colormap;
if (((
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) :
#endif
frontsector->floorheight) < viewz || (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].ceilingpic == skyflatnum)))
{
floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel,
frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, frontsector->f_slope
#endif
, R_NoEncore(frontsector, false));
}
else
floorplane = NULL;
if (((
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) :
#endif
frontsector->ceilingheight) > viewz || frontsector->ceilingpic == skyflatnum
|| (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].floorpic == skyflatnum)))
@ -926,21 +906,15 @@ static void R_Subsector(size_t num)
ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic,
ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle,
ceilingcolormap, NULL
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, frontsector->c_slope
#endif
, R_NoEncore(frontsector, true));
}
else
ceilingplane = NULL;
numffloors = 0;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL;
if (frontsector->ffloors)
@ -966,15 +940,11 @@ static void R_Subsector(size_t num)
ffloor[numffloors].polyobj = NULL;
heightcheck =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) :
#endif
*rover->bottomheight;
planecenterz =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
*rover->bottomheight;
if (planecenterz <= ceilingcenterz
&& planecenterz >= floorcenterz
@ -987,21 +957,15 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic,
*frontsector->lightlist[light].lightlevel, *rover->bottomxoffs,
*rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, *rover->b_slope
#endif
, R_NoEncore(rover->master->frontsector, true));
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->b_slope;
// Tell the renderer this sector has slopes in it.
if (ffloor[numffloors].slope)
frontsector->hasslope = true;
#endif
ffloor[numffloors].height = heightcheck;
ffloor[numffloors].ffloor = rover;
@ -1013,15 +977,11 @@ static void R_Subsector(size_t num)
ffloor[numffloors].polyobj = NULL;
heightcheck =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) :
#endif
*rover->topheight;
planecenterz =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
*rover->topheight;
if (planecenterz >= floorcenterz
&& planecenterz <= ceilingcenterz
@ -1033,21 +993,15 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic,
*frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle,
frontsector->lightlist[light].extra_colormap, rover
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, *rover->t_slope
#endif
, R_NoEncore(rover->master->frontsector, false));
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->t_slope;
// Tell the renderer this sector has slopes in it.
if (ffloor[numffloors].slope)
frontsector->hasslope = true;
#endif
ffloor[numffloors].height = heightcheck;
ffloor[numffloors].ffloor = rover;
@ -1056,7 +1010,6 @@ static void R_Subsector(size_t num)
}
}
#ifdef POLYOBJECTS_PLANES
// Polyobjects have planes, too!
if (sub->polyList)
{
@ -1086,16 +1039,12 @@ static void R_Subsector(size_t num)
polysec->lightlevel, polysec->floor_xoffs, polysec->floor_yoffs,
polysec->floorpic_angle-po->angle,
NULL, NULL, po
#ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
, R_NoEncore(polysec, false));
ffloor[numffloors].height = polysec->floorheight;
ffloor[numffloors].polyobj = po;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
// ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
@ -1115,16 +1064,12 @@ static void R_Subsector(size_t num)
polysec->lightlevel, polysec->ceiling_xoffs, polysec->ceiling_yoffs,
polysec->ceilingpic_angle-po->angle,
NULL, NULL, po
#ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
, R_NoEncore(polysec, true));
ffloor[numffloors].polyobj = po;
ffloor[numffloors].height = polysec->ceilingheight;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
// ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
@ -1133,7 +1078,6 @@ static void R_Subsector(size_t num)
po = (polyobj_t *)(po->link.next);
}
}
#endif
#ifdef FLOORSPLATS
if (sub->splats)
@ -1156,18 +1100,14 @@ static void R_Subsector(size_t num)
firstseg = NULL;
#ifdef POLYOBJECTS
// haleyjd 02/19/06: draw polyobjects before static lines
if (sub->polyList)
R_AddPolyObjects(sub);
#endif
while (count--)
{
// CONS_Debug(DBG_GAMELOGIC, "Adding normal line %d...(%d)\n", line->linedef-lines, leveltime);
#ifdef POLYOBJECTS
if (!line->polyseg) // ignore segs that belong to polyobjects
#endif
R_AddLine(line);
line++;
curline = NULL; /* cph 2001/11/18 - must clear curline now we're done with it, so stuff doesn't try using it for other things */
@ -1186,11 +1126,9 @@ void R_Prep3DFloors(sector_t *sector)
fixed_t bestheight, maxheight;
INT32 count, i, mapnum;
sector_t *sec;
#ifdef ESLOPE
pslope_t *bestslope = NULL;
fixed_t heighttest; // I think it's better to check the Z height at the sector's center
// than assume unsloped heights are accurate indicators of order in sloped sectors. -Red
#endif
count = 1;
for (rover = sector->ffloors; rover; rover = rover->next)
@ -1213,14 +1151,10 @@ void R_Prep3DFloors(sector_t *sector)
else
memset(sector->lightlist, 0, sizeof (lightlist_t) * count);
#ifdef ESLOPE
heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight;
sector->lightlist[0].height = heighttest + 1;
sector->lightlist[0].slope = sector->c_slope;
#else
sector->lightlist[0].height = sector->ceilingheight + 1;
#endif
sector->lightlist[0].lightlevel = &sector->lightlevel;
sector->lightlist[0].caster = NULL;
sector->lightlist[0].extra_colormap = sector->extra_colormap;
@ -1238,7 +1172,6 @@ void R_Prep3DFloors(sector_t *sector)
&& !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES)))
continue;
#ifdef ESLOPE
heighttest = *rover->t_slope ? P_GetZAt(*rover->t_slope, sector->soundorg.x, sector->soundorg.y) : *rover->topheight;
if (heighttest > bestheight && heighttest < maxheight)
@ -1260,21 +1193,6 @@ void R_Prep3DFloors(sector_t *sector)
continue;
}
}
#else
if (*rover->topheight > bestheight && *rover->topheight < maxheight)
{
best = rover;
bestheight = *rover->topheight;
continue;
}
if (rover->flags & FF_DOUBLESHADOW && *rover->bottomheight > bestheight
&& *rover->bottomheight < maxheight)
{
best = rover;
bestheight = *rover->bottomheight;
continue;
}
#endif
}
if (!best)
{
@ -1285,9 +1203,7 @@ void R_Prep3DFloors(sector_t *sector)
sector->lightlist[i].height = maxheight = bestheight;
sector->lightlist[i].caster = best;
sector->lightlist[i].flags = best->flags;
#ifdef ESLOPE
sector->lightlist[i].slope = bestslope;
#endif
sec = &sectors[best->secnum];
mapnum = sec->midmap;
if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps)
@ -1313,12 +1229,8 @@ void R_Prep3DFloors(sector_t *sector)
if (best->flags & FF_DOUBLESHADOW)
{
#ifdef ESLOPE
heighttest = *best->b_slope ? P_GetZAt(*best->b_slope, sector->soundorg.x, sector->soundorg.y) : *best->bottomheight;
if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red
#else
if (bestheight == *best->bottomheight)
#endif
{
sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel;
sector->lightlist[i].extra_colormap =

View File

@ -44,13 +44,11 @@ void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
// no longer a static since this is used for encore in hw_main.c as well now:
boolean R_NoEncore(sector_t *sector, boolean ceiling);
#ifdef POLYOBJECTS
void R_SortPolyObjects(subsector_t *sub);
extern size_t numpolys; // number of polyobjects in current subsector
extern size_t num_po_ptrs; // number of polyobject pointers allocated
extern polyobj_t **po_ptrs; // temp ptr array to sort polyobject pointers
#endif
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
INT32 *ceilinglightlevel, boolean back);

View File

@ -91,9 +91,7 @@ typedef struct
fixed_t z; ///< Z coordinate.
} degenmobj_t;
#ifdef POLYOBJECTS
#include "p_polyobj.h"
#endif
// Store fake planes in a resizable array insted of just by
// heightsec. Allows for multiple fake planes.
@ -155,11 +153,9 @@ typedef struct ffloor_s
fixed_t *bottomyoffs;
angle_t *bottomangle;
#ifdef ESLOPE
// Pointers to pointers. Yup.
struct pslope_s **t_slope;
struct pslope_s **b_slope;
#endif
size_t secnum;
ffloortype_e flags;
@ -190,9 +186,7 @@ typedef struct lightlist_s
extracolormap_t *extra_colormap;
INT32 flags;
ffloor_t *caster;
#ifdef ESLOPE
struct pslope_s *slope; // FF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh.
#endif
} lightlist_t;
@ -226,7 +220,6 @@ typedef struct linechain_s
// Slopes
#ifdef ESLOPE
typedef enum {
SL_NOPHYSICS = 1, // Don't do momentum adjustment with this slope
SL_NODYNAMIC = 1<<1, // Slope will never need to move during the level, so don't fuss with recalculating it
@ -269,7 +262,6 @@ typedef struct pslope_s
struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later
} pslope_t;
#endif
typedef enum
{
@ -376,12 +368,10 @@ typedef struct sector_s
precipmobj_t *preciplist;
struct mprecipsecnode_s *touching_preciplist;
#ifdef ESLOPE
// Eternity engine slope
pslope_t *f_slope; // floor slope
pslope_t *c_slope; // ceiling slope
boolean hasslope; // The sector, or one of its visible FOFs, contains a slope
#endif
// these are saved for netgames, so do not let Lua touch these!
INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed
@ -437,9 +427,7 @@ typedef struct line_s
void *splats; // wallsplat_t list
#endif
INT32 firsttag, nexttag; // improves searches for tags.
#ifdef POLYOBJECTS
polyobj_t *polyobj; // Belongs to a polyobject?
#endif
char *text; // a concatination of all front and back texture names, for linedef specials that require a string.
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
@ -481,9 +469,7 @@ typedef struct subsector_s
sector_t *sector;
INT16 numlines;
UINT16 firstline;
#ifdef POLYOBJECTS
struct polyobj_s *polyList; // haleyjd 02/19/06: list of polyobjects
#endif
#if 1//#ifdef FLOORSPLATS
void *splats; // floorsplat_t list
#endif
@ -559,10 +545,8 @@ typedef struct seg_s
// Why slow things down by calculating lightlists for every thick side?
size_t numlights;
r_lightlist_t *rlights;
#ifdef POLYOBJECTS
polyobj_t *polyseg;
boolean dontrenderme;
#endif
} seg_t;
//
@ -639,11 +623,9 @@ typedef struct drawseg_s
UINT8 portalpass; // if > 0 and <= portalrender, do not affect sprite clipping
#ifdef ESLOPE
fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures
vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes
#endif
} drawseg_t;
typedef enum

View File

@ -112,11 +112,9 @@ fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
UINT8 *ds_source; // start of a 64*64 tile image
UINT8 *ds_transmap; // one of the translucency tables
#ifdef ESLOPE
pslope_t *ds_slope; // Current slope being used
floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
float focallengthf, zeroheight;
#endif
/** \brief Variable flat sizes
*/

View File

@ -62,7 +62,6 @@ extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern UINT8 *ds_source; // start of a 64*64 tile image
extern UINT8 *ds_transmap;
#ifdef ESLOPE
typedef struct {
float x, y, z;
} floatv3_t;
@ -70,7 +69,6 @@ typedef struct {
extern pslope_t *ds_slope; // Current slope being used
extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
extern float focallengthf, zeroheight;
#endif
// Variable flat sizes
extern UINT32 nflatxshift;
@ -157,12 +155,10 @@ void ASMCALL R_DrawSpan_8_MMX(void);
void R_DrawTranslatedColumn_8(void);
void R_DrawTranslatedTranslucentColumn_8(void);
void R_DrawSpan_8(void);
#ifdef ESLOPE
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void);
void R_DrawTiltedSplat_8(void);
#endif
void R_DrawSplat_8(void);
void R_DrawTranslucentSplat_8(void);
void R_DrawTranslucentSpan_8(void);

View File

@ -620,7 +620,6 @@ void R_DrawSpan_8 (void)
}
}
#ifdef ESLOPE
// R_CalcTiltedLighting
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
static INT32 tiltlighting[MAXVIDWIDTH];
@ -1058,7 +1057,6 @@ void R_DrawTiltedSplat_8(void)
}
#endif
}
#endif // ESLOPE
/** \brief The R_DrawSplat_8 function
Just like R_DrawSpan_8, but skips transparent pixels.

View File

@ -536,9 +536,7 @@ static void R_InitTextureMapping(void)
focallength = FixedDiv(projection,
FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2));
#ifdef ESLOPE
focallengthf = FIXED_TO_FLOAT(focallength);
#endif
for (i = 0; i < FINEANGLES/2; i++)
{
@ -1142,7 +1140,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
aimingangle = player->aiming;
viewangle = viewmobj->angle;
if (/*!demo.playback && */player->playerstate != PST_DEAD)
if (!demo.playback && player->playerstate != PST_DEAD)
{
if (player == &players[consoleplayer])
{

View File

@ -322,11 +322,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1;
#ifdef ESLOPE
if (currentplane->slope)
ds_colormap = colormaps;
else
#endif
ds_colormap = planezlight[pindex];
if (encoremap && !currentplane->noencore)
ds_colormap += (256*32);
@ -402,7 +400,7 @@ static visplane_t *new_visplane(unsigned hash)
visplane_t *check = freetail;
if (!check)
{
check = calloc(2, sizeof (*check));
check = calloc(1, sizeof (*check));
if (check == NULL) I_Error("%s: Out of memory", "new_visplane"); // FIXME: ugly
}
else
@ -424,20 +422,14 @@ static visplane_t *new_visplane(unsigned hash)
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap,
ffloor_t *pfloor
#ifdef POLYOBJECTS_PLANES
, polyobj_t *polyobj
#endif
#ifdef ESLOPE
, pslope_t *slope
#endif
, boolean noencore)
{
visplane_t *check;
unsigned hash;
#ifdef ESLOPE
if (slope); else // Don't mess with this right now if a slope is involved
#endif
{
xoff += viewx;
yoff -= viewy;
@ -452,7 +444,6 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
}
}
#ifdef POLYOBJECTS_PLANES
if (polyobj)
{
if (polyobj->angle != 0)
@ -467,7 +458,6 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
yoff += polyobj->centerPt.y;
}
}
#endif
// This appears to fix the Nimbus Ruins sky bug.
if (picnum == skyflatnum && pfloor)
@ -481,12 +471,10 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
for (check = visplanes[hash]; check; check = check->next)
{
#ifdef POLYOBJECTS_PLANES
if (check->polyobj && pfloor)
continue;
if (polyobj != check->polyobj)
continue;
#endif
if (height == check->height && picnum == check->picnum
&& lightlevel == check->lightlevel
&& xoff == check->xoffs && yoff == check->yoffs
@ -495,9 +483,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
&& check->viewx == viewx && check->viewy == viewy && check->viewz == viewz
&& check->viewangle == viewangle
&& check->plangle == plangle
#ifdef ESLOPE
&& check->slope == slope
#endif
&& check->noencore == noencore)
{
return check;
@ -520,12 +506,8 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
check->viewz = viewz;
check->viewangle = viewangle;
check->plangle = plangle;
#ifdef POLYOBJECTS_PLANES
check->polyobj = polyobj;
#endif
#ifdef ESLOPE
check->slope = slope;
#endif
check->noencore = noencore;
memset(check->top, 0xff, sizeof (check->top));
@ -593,12 +575,8 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
new_pl->viewz = pl->viewz;
new_pl->viewangle = pl->viewangle;
new_pl->plangle = pl->plangle;
#ifdef POLYOBJECTS_PLANES
new_pl->polyobj = pl->polyobj;
#endif
#ifdef ESLOPE
new_pl->slope = pl->slope;
#endif
new_pl->noencore = pl->noencore;
pl = new_pl;
pl->minx = start;
@ -623,11 +601,9 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
INT32 unionl, unionh;
// INT32 x;
#ifdef POLYOBJECTS_PLANES
// Don't expand polyobject planes here - we do that on our own.
if (pl->polyobj)
return;
#endif
if (start < pl->minx)
{
@ -742,9 +718,7 @@ void R_DrawPlanes(void)
}
if (pl->ffloor != NULL
#ifdef POLYOBJECTS_PLANES
|| pl->polyobj != NULL
#endif
)
continue;
@ -773,7 +747,6 @@ void R_DrawSinglePlane(visplane_t *pl)
#endif
spanfunc = basespanfunc;
#ifdef POLYOBJECTS_PLANES
if (pl->polyobj && pl->polyobj->translucency != 0) {
spanfunc = R_DrawTranslucentSpan_8;
@ -795,7 +768,6 @@ void R_DrawSinglePlane(visplane_t *pl)
light = LIGHTLEVELS-1;
} else
#endif
if (pl->ffloor)
{
// Don't draw planes that shouldn't be drawn.
@ -861,9 +833,7 @@ void R_DrawSinglePlane(visplane_t *pl)
#ifndef NOWATER
if (pl->ffloor->flags & FF_RIPPLE
#ifdef ESLOPE
&& !pl->slope
#endif
)
{
INT32 top, bottom;
@ -902,9 +872,7 @@ void R_DrawSinglePlane(visplane_t *pl)
}
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
#ifdef ESLOPE
if (!pl->slope) // Don't mess with angle on slopes! We'll handle this ourselves later
#endif
if (viewangle != pl->viewangle+pl->plangle)
{
memset(cachedheight, 0, sizeof (cachedheight));
@ -978,7 +946,6 @@ void R_DrawSinglePlane(visplane_t *pl)
if (light < 0)
light = 0;
#ifdef ESLOPE
if (pl->slope) {
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
// I copied ZDoom's code and adapted it to SRB2... -fickle
@ -1118,7 +1085,6 @@ void R_DrawSinglePlane(visplane_t *pl)
planezlight = scalelight[light];
} else
#endif // ESLOPE
planezlight = zlight[light];

View File

@ -45,12 +45,8 @@ typedef struct visplane_s
fixed_t xoffs, yoffs; // Scrolling flats.
struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
#endif
#ifdef ESLOPE
pslope_t *slope;
#endif
boolean noencore;
} visplane_t;
@ -83,12 +79,8 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
void R_DrawPlanes(void);
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
extracolormap_t *planecolormap, ffloor_t *ffloor
#ifdef POLYOBJECTS_PLANES
, polyobj_t *polyobj
#endif
#ifdef ESLOPE
, pslope_t *slope
#endif
, boolean noencore);
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
@ -108,18 +100,14 @@ typedef struct planemgr_s
INT16 f_clip[MAXVIDWIDTH];
INT16 c_clip[MAXVIDWIDTH];
#ifdef ESLOPE
// For slope rendering; the height at the other end
fixed_t f_pos_slope;
fixed_t b_pos_slope;
struct pslope_s *slope;
#endif
struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
#endif
} visffloor_t;
extern visffloor_t ffloor[MAXFFLOORS];

File diff suppressed because it is too large Load Diff

View File

@ -1052,10 +1052,8 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES))
continue;
#ifdef ESLOPE
if (sector->lightlist[i].slope)
testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy);
#endif
if (testheight >= sprite->gzt)
continue;
@ -1373,7 +1371,6 @@ static void R_ProjectSprite(mobj_t *thing)
if (thing->subsector->sector->numlights)
{
INT32 lightnum;
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
light = thing->subsector->sector->numlights - 1;
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) {
@ -1384,9 +1381,6 @@ static void R_ProjectSprite(mobj_t *thing)
break;
}
}
#else
light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
#endif
lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT);
if (lightnum < 0)
@ -1947,7 +1941,6 @@ static void R_CreateDrawNodes(void)
entry->ffloor = ds->thicksides[i];
}
}
#ifdef POLYOBJECTS_PLANES
// Check for a polyobject plane, but only if this is a front line
if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) {
plane = ds->curline->polyseg->visplane;
@ -1963,7 +1956,6 @@ static void R_CreateDrawNodes(void)
}
ds->curline->polyseg->visplane = NULL;
}
#endif
if (ds->maskedtexturecol)
{
entry = R_CreateDrawNode(&nodehead);
@ -2008,7 +2000,6 @@ static void R_CreateDrawNodes(void)
}
}
#ifdef POLYOBJECTS_PLANES
// find all the remaining polyobject planes and add them on the end of the list
// probably this is a terrible idea if we wanted them to be sorted properly
// but it works getting them in for now
@ -2029,7 +2020,6 @@ static void R_CreateDrawNodes(void)
// note: no seg is set, for what should be obvious reasons
PolyObjects[i].visplane = NULL;
}
#endif
if (visspritecount == 0)
return;
@ -2052,13 +2042,11 @@ static void R_CreateDrawNodes(void)
if (rover->szt > r2->plane->low || rover->sz < r2->plane->high)
continue;
#ifdef ESLOPE
// Effective height may be different for each comparison in the case of slopes
if (r2->plane->slope) {
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy);
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy);
} else
#endif
planeobjectz = planecameraz = r2->plane->height;
if (rover->mobjflags & MF_NOCLIPHEIGHT)
@ -2117,20 +2105,16 @@ static void R_CreateDrawNodes(void)
if (scale <= rover->sortscale)
continue;
#ifdef ESLOPE
if (*r2->ffloor->t_slope) {
topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy);
topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy);
} else
#endif
topplaneobjectz = topplanecameraz = *r2->ffloor->topheight;
#ifdef ESLOPE
if (*r2->ffloor->b_slope) {
botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy);
botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy);
} else
#endif
botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight;
if ((topplanecameraz > viewz && botplanecameraz < viewz) ||
@ -2762,7 +2746,7 @@ void R_AddSkins(UINT16 wadnum)
if (numskins >= MAXSKINS)
{
CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS);
CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS);
continue; // so we know how many skins couldn't be added
}
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);

View File

@ -236,7 +236,7 @@ void S_StopSoundByNum(sfxenum_t sfxnum);
#ifdef MUSICSLOT_COMPATIBILITY
// For compatibility with code/scripts relying on older versions
// This is a list of all the "special" slot names and their associated numbers
const char *compat_special_music_slots[16];
extern const char *compat_special_music_slots[16];
#endif
#endif

View File

@ -53,28 +53,6 @@ ifndef NOHW
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
endif
ifndef NOHS
ifdef OPENAL
OBJS+=$(OBJDIR)/s_openal.o
OPTS+=-DSTATIC3DS
STATICHS=1
else
ifdef FMOD
OBJS+=$(OBJDIR)/s_fmod.o
OPTS+=-DSTATIC3DS
STATICHS=1
else
ifdef MINGW
ifdef DS3D
OBJS+=$(OBJDIR)/s_ds3d.o
OPTS+=-DSTATIC3DS
STATICHS=1
endif
endif
endif
endif
endif
ifdef NOMIXER
i_sound_o=$(OBJDIR)/sdl_sound.o
else
@ -83,6 +61,11 @@ else
SDL_LDFLAGS+=-lSDL2_mixer
endif
ifndef NOTHREADS
OPTS+=-DHAVE_THREADS
OBJS+=$(OBJDIR)/i_threads.o
endif
ifdef SDL_TTF
OPTS+=-DHAVE_TTF
SDL_LDFLAGS+=-lSDL2_ttf -lfreetype -lz

View File

@ -249,6 +249,7 @@
<ClInclude Include="..\lzf.h" />
<ClInclude Include="..\md5.h" />
<ClInclude Include="..\mserv.h" />
<ClInclude Include="..\http-mserv.h" />
<ClInclude Include="..\m_aatree.h" />
<ClInclude Include="..\m_anigif.h" />
<ClInclude Include="..\m_argv.h" />
@ -399,6 +400,7 @@
<ClCompile Include="..\lzf.c" />
<ClCompile Include="..\md5.c" />
<ClCompile Include="..\mserv.c" />
<ClCompile Include="..\http-mserv.c" />
<ClCompile Include="..\m_aatree.c" />
<ClCompile Include="..\m_anigif.c" />
<ClCompile Include="..\m_argv.c" />

View File

@ -291,6 +291,9 @@
<ClInclude Include="..\mserv.h">
<Filter>I_Interface</Filter>
</ClInclude>
<ClInclude Include="..\http-mserv.h">
<Filter>I_Interface</Filter>
</ClInclude>
<ClInclude Include="..\lua_hook.h">
<Filter>LUA</Filter>
</ClInclude>
@ -663,6 +666,9 @@
<ClCompile Include="..\mserv.c">
<Filter>I_Interface</Filter>
</ClCompile>
<ClCompile Include="..\http-mserv.c">
<Filter>I_Interface</Filter>
</ClCompile>
<ClCompile Include="..\lua_baselib.c">
<Filter>LUA</Filter>
</ClCompile>

View File

@ -2782,6 +2782,50 @@
RelativePath="..\mserv.h"
>
</File>
<File
RelativePath="..\http-mserv.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\http-mserv.h"
>
</File>
</Filter>
<Filter
Name="M_Misc"

View File

@ -168,6 +168,7 @@ static char returnWadPath[256];
#include "../i_video.h"
#include "../i_sound.h"
#include "../i_system.h"
#include "../i_threads.h"
#include "../screen.h" //vid.WndParent
#include "../d_net.h"
#include "../g_game.h"
@ -3134,6 +3135,10 @@ INT32 I_StartupSystem(void)
SDL_version SDLlinked;
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
#ifdef HAVE_THREADS
I_start_threads();
I_AddExitFunc(I_stop_threads);
#endif
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
I_Fork();
@ -3655,6 +3660,18 @@ static const char *locateWad(void)
#endif
#ifdef DEFAULTDIR
I_OutputMsg(",HOME/" DEFAULTDIR);
// examine user jart directory
if ((envstr = I_GetEnv("HOME")) != NULL)
{
sprintf(returnWadPath, "%s" PATHSEP DEFAULTDIR, envstr);
if (isWadPathOk(returnWadPath))
return returnWadPath;
}
#endif
#ifdef CMAKECONFIG
#ifndef NDEBUG
I_OutputMsg(","CMAKE_ASSETS_DIR);

356
src/sdl/i_threads.c Normal file
View File

@ -0,0 +1,356 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by James R.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file i_threads.c
/// \brief Multithreading abstraction
#include "../doomdef.h"
#include "../i_threads.h"
#include <SDL.h>
typedef void * (*Create_fn)(void);
struct Link;
struct Thread;
typedef struct Link * Link;
typedef struct Thread * Thread;
struct Link
{
void * data;
Link next;
Link prev;
};
struct Thread
{
I_thread_fn entry;
void * userdata;
SDL_Thread * thread;
};
static Link i_thread_pool;
static Link i_mutex_pool;
static Link i_cond_pool;
static I_mutex i_thread_pool_mutex;
static I_mutex i_mutex_pool_mutex;
static I_mutex i_cond_pool_mutex;
static SDL_atomic_t i_threads_running = {1};
static Link
Insert_link (
Link * head,
Link link
){
link->prev = NULL;
link->next = (*head);
if ((*head))
(*head)->prev = link;
(*head) = link;
return link;
}
static void
Free_link (
Link * head,
Link link
){
if (link->prev)
link->prev->next = link->next;
else
(*head) = link->next;
if (link->next)
link->next->prev = link->prev;
free(link->data);
free(link);
}
static Link
New_link (void *data)
{
Link link;
link = malloc(sizeof *link);
if (! link)
abort();
link->data = data;
return link;
}
static void *
Identity (
Link * pool_anchor,
I_mutex pool_mutex,
void ** anchor,
Create_fn create_fn
){
void * id;
id = SDL_AtomicGetPtr(anchor);
if (! id)
{
I_lock_mutex(&pool_mutex);
{
id = SDL_AtomicGetPtr(anchor);
if (! id)
{
id = (*create_fn)();
if (! id)
abort();
Insert_link(pool_anchor, New_link(id));
SDL_AtomicSetPtr(anchor, id);
}
}
I_unlock_mutex(pool_mutex);
}
return id;
}
static int
Worker (
Link link
){
Thread th;
th = link->data;
(*th->entry)(th->userdata);
if (SDL_AtomicGet(&i_threads_running))
{
I_lock_mutex(&i_thread_pool_mutex);
{
if (SDL_AtomicGet(&i_threads_running))
{
SDL_DetachThread(th->thread);
Free_link(&i_thread_pool, link);
}
}
I_unlock_mutex(i_thread_pool_mutex);
}
return 0;
}
void
I_spawn_thread (
const char * name,
I_thread_fn entry,
void * userdata
){
Link link;
Thread th;
th = malloc(sizeof *th);
if (! th)
abort();/* this is pretty GNU of me */
th->entry = entry;
th->userdata = userdata;
I_lock_mutex(&i_thread_pool_mutex);
{
link = Insert_link(&i_thread_pool, New_link(th));
if (SDL_AtomicGet(&i_threads_running))
{
th->thread = SDL_CreateThread(
(SDL_ThreadFunction)Worker,
name,
link
);
if (! th->thread)
abort();
}
}
I_unlock_mutex(i_thread_pool_mutex);
}
int
I_thread_is_stopped (void)
{
return ( ! SDL_AtomicGet(&i_threads_running) );
}
void
I_start_threads (void)
{
i_thread_pool_mutex = SDL_CreateMutex();
i_mutex_pool_mutex = SDL_CreateMutex();
i_cond_pool_mutex = SDL_CreateMutex();
if (!(
i_thread_pool_mutex &&
i_mutex_pool_mutex &&
i_cond_pool_mutex
)){
abort();
}
}
void
I_stop_threads (void)
{
Link link;
Link next;
Thread th;
SDL_mutex * mutex;
SDL_cond * cond;
if (i_threads_running.value)
{
/* rely on the good will of thread-san */
SDL_AtomicSet(&i_threads_running, 0);
I_lock_mutex(&i_thread_pool_mutex);
{
for (
link = i_thread_pool;
link;
link = next
){
next = link->next;
th = link->data;
SDL_WaitThread(th->thread, NULL);
free(th);
free(link);
}
}
I_unlock_mutex(i_thread_pool_mutex);
for (
link = i_mutex_pool;
link;
link = next
){
next = link->next;
mutex = link->data;
SDL_DestroyMutex(mutex);
free(link);
}
for (
link = i_cond_pool;
link;
link = next
){
next = link->next;
cond = link->data;
SDL_DestroyCond(cond);
free(link);
}
SDL_DestroyMutex(i_thread_pool_mutex);
SDL_DestroyMutex(i_mutex_pool_mutex);
SDL_DestroyMutex(i_cond_pool_mutex);
}
}
void
I_lock_mutex (
I_mutex * anchor
){
SDL_mutex * mutex;
mutex = Identity(
&i_mutex_pool,
i_mutex_pool_mutex,
anchor,
(Create_fn)SDL_CreateMutex
);
if (SDL_LockMutex(mutex) == -1)
abort();
}
void
I_unlock_mutex (
I_mutex id
){
if (SDL_UnlockMutex(id) == -1)
abort();
}
void
I_hold_cond (
I_cond * cond_anchor,
I_mutex mutex_id
){
SDL_cond * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
cond_anchor,
(Create_fn)SDL_CreateCond
);
if (SDL_CondWait(cond, mutex_id) == -1)
abort();
}
void
I_wake_one_cond (
I_cond * anchor
){
SDL_cond * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
);
if (SDL_CondSignal(cond) == -1)
abort();
}
void
I_wake_all_cond (
I_cond * anchor
){
SDL_cond * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
);
if (SDL_CondBroadcast(cond) == -1)
abort();
}

View File

@ -110,6 +110,29 @@ static void var_cleanup(void)
internal_volume = 100;
}
#if defined (HAVE_LIBGME) && defined (HAVE_ZLIB)
static const char* get_zlib_error(int zErr)
{
switch (zErr)
{
case Z_ERRNO:
return "Z_ERRNO";
case Z_STREAM_ERROR:
return "Z_STREAM_ERROR";
case Z_DATA_ERROR:
return "Z_DATA_ERROR";
case Z_MEM_ERROR:
return "Z_MEM_ERROR";
case Z_BUF_ERROR:
return "Z_BUF_ERROR";
case Z_VERSION_ERROR:
return "Z_VERSION_ERROR";
default:
return "unknown error";
}
}
#endif
/// ------------------------
/// Audio System
/// ------------------------
@ -371,51 +394,11 @@ void *I_GetSfx(sfxinfo_t *sfx)
}
}
else
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
(void)inflateEnd(&stream);
}
else // Hold up, zlib's got a problem
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
#else
return NULL; // No zlib support
@ -945,73 +928,25 @@ boolean I_LoadSong(char *data, size_t len)
// Run GME on new data
if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100))
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_start_track(gme, 0);
current_track = 0;
gme_set_equalizer(gme, &eq);
Mix_HookMusic(mix_gme, gme);
Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
return true;
}
}
else
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
(void)inflateEnd(&stream);
}
else // Hold up, zlib's got a problem
{
const char *errorType;
switch (zErr)
{
case Z_ERRNO:
errorType = "Z_ERRNO"; break;
case Z_STREAM_ERROR:
errorType = "Z_STREAM_ERROR"; break;
case Z_DATA_ERROR:
errorType = "Z_DATA_ERROR"; break;
case Z_MEM_ERROR:
errorType = "Z_MEM_ERROR"; break;
case Z_BUF_ERROR:
errorType = "Z_BUF_ERROR"; break;
case Z_VERSION_ERROR:
errorType = "Z_VERSION_ERROR"; break;
default:
errorType = "unknown error";
}
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
}
CONS_Alert(CONS_ERROR, "Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
return false;
#else
CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
return true;
return false;
#endif
}
else if (!gme_open_data(data, len, &gme, 44100))
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_set_equalizer(gme, &eq);
return true;
}
#endif
rw = SDL_RWFromMem(data, len);
@ -1082,6 +1017,8 @@ boolean I_PlaySong(boolean looping)
#ifdef HAVE_LIBGME
if (gme)
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_set_equalizer(gme, &eq);
gme_start_track(gme, 0);
current_track = 0;
Mix_HookMusic(mix_gme, gme);

View File

@ -33,6 +33,7 @@
#endif
#include "../doomdef.h"
#include "../d_main.h"
#ifdef HWRENDER
#include "../hardware/r_opengl/r_opengl.h"
@ -154,11 +155,26 @@ boolean OglSdlSurface(INT32 w, INT32 h)
{
INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
static boolean first_init = false;
const char *gllogdir = NULL;
oglflags = 0;
if (!first_init)
{
if (!gllogstream)
{
gllogdir = D_Home();
#ifdef DEBUG_TO_FILE
#ifdef DEFAULTDIR
if (gllogdir)
gllogstream = fopen(va("%s/"DEFAULTDIR"/ogllog.txt",gllogdir), "wt");
else
#endif
gllogstream = fopen("./ogllog.txt", "wt");
#endif
}
gl_version = pglGetString(GL_VERSION);
gl_renderer = pglGetString(GL_RENDERER);
gl_extensions = pglGetString(GL_EXTENSIONS);

View File

@ -1173,7 +1173,10 @@ void I_StartupSound(void)
const char *sdrv_name = NULL;
#endif
#ifndef HAVE_MIXER
midi_disabled = digital_disabled = true;
#ifndef NO_MIDI
midi_disabled =
#endif
digital_disabled = true;
#endif
memset(channels, 0, sizeof (channels)); //Alam: Clean it
@ -1431,6 +1434,8 @@ static void I_ResumeGME(void)
boolean I_LoadSong(char *data, size_t len)
{
(void)data;
(void)len;
return false;
}
@ -1492,6 +1497,7 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
(void)target_volume;
(void)source_volume;
(void)ms;
(void)callback;
return false;
}
@ -1499,6 +1505,7 @@ boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
{
(void)target_volume;
(void)ms;
(void)callback;
return false;
}

View File

@ -1435,7 +1435,7 @@ static boolean LoadSong(void *data, size_t lumplength, size_t selectpos)
if (fwrite(data, lumplength, 1, midfile) == 0)
{
CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, strerror(ferror(midfile)));
CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, M_FileError(midfile));
Z_Free(data);
fclose(midfile);
return false;

View File

@ -11,6 +11,24 @@
/// \file w_wad.c
/// \brief Handles WAD file header, directory, lump I/O
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include "zlib.h"
#endif
#ifdef __GNUC__
#include <unistd.h>
#endif
@ -66,24 +84,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#define O_BINARY 0
#endif
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include "zlib.h"
#endif
typedef struct
{
@ -150,7 +150,10 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
{
FILE *handle;
strncpy(filenamebuf, *filename, MAX_WADPATH);
if (filenamebuf != *filename) {
// avoid overlap
strncpy(filenamebuf, *filename, MAX_WADPATH);
}
filenamebuf[MAX_WADPATH - 1] = '\0';
*filename = filenamebuf;
@ -366,7 +369,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
// read the header
if (fread(&header, 1, sizeof header, handle) < sizeof header)
{
CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), strerror(ferror(handle)));
CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), M_FileError(handle));
return NULL;
}
@ -389,7 +392,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
if (fseek(handle, header.infotableofs, SEEK_SET) == -1
|| fread(fileinfo, 1, i, handle) < i)
{
CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), strerror(ferror(handle)));
CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), M_FileError(handle));
free(fileinfov);
return NULL;
}
@ -410,7 +413,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
handle) < sizeof realsize)
{
I_Error("corrupt compressed file: %s; maybe %s", /// \todo Avoid the bailout?
filename, strerror(ferror(handle)));
filename, M_FileError(handle));
}
realsize = LONG(realsize);
if (realsize != 0)
@ -548,7 +551,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
fseek(handle, -4, SEEK_CUR);
if (fread(&zend, 1, sizeof zend, handle) < sizeof zend)
{
CONS_Alert(CONS_ERROR, "Corrupt central directory (%s)\n", strerror(ferror(handle)));
CONS_Alert(CONS_ERROR, "Corrupt central directory (%s)\n", M_FileError(handle));
return NULL;
}
numlumps = zend.entries;
@ -565,7 +568,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
if (fread(zentry, 1, sizeof(zentry_t), handle) < sizeof(zentry_t))
{
CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", M_FileError(handle));
Z_Free(lumpinfo);
free(zentry);
return NULL;
@ -585,7 +588,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
fullname = malloc(zentry->namelen + 1);
if (fgets(fullname, zentry->namelen + 1, handle) != fullname)
{
CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", M_FileError(handle));
Z_Free(lumpinfo);
free(zentry);
free(fullname);
@ -1319,8 +1322,8 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
{
size = 0;
zerr(zErr);
(void)inflateEnd(&strm);
}
(void)inflateEnd(&strm);
}
else
{