Commit graph

76 commits

Author SHA1 Message Date
Jonathan Young
b3983e582a astyle 2013-09-21 19:37:12 +10:00
Daniel Gibson
1f5579a697 Fix compilation with SDL2 Release
.. they removed ev.key.keysym.unicode - but checking for
SDL_SCANCODE_GRAVE is better anyway to handle console key
2013-08-13 23:08:48 +02:00
Robert Beckebans
cbd696cc67 Merge remote-tracking branch 'DanielGibson/improve-threading' 2013-03-26 09:58:14 +01:00
Robert Beckebans
dcae311b7f Renamed in_kbd to in_keyboard 2013-03-26 09:56:48 +01:00
Daniel Gibson
ae02bb54a1 Make it compile with SDL2 again
For some reason SDL.h (or headers included by it) need some
string functions (like strncmp) in inline-functions (that we
don't even use).
Str.h has #defines preventing their usage.. so #undef those in
the (few) sourcefiles that need SDL headers
2013-03-24 23:44:13 +01:00
Robert Beckebans
75f7fa3aa8 Removed obsolete old renderer SMP code 2013-03-23 21:33:40 +01:00
Daniel Gibson
07524dadb0 Adapt #includes for moved files, make it build again
socket_net.cpp needed some small fixes to build again,
because of imcompatibilities between Winsock and the
real POSIX sockets API.
2013-03-18 00:38:58 +01:00
Daniel Gibson
cec460d38c Move stuff from sys/posix/ and sys/win32/ to sys/common/
All these files were almost identical, so there is no good reason to
have them twice..

and change CMakeLists.txt accordingly

(Not that this commit won't compile because some #includes are still
broken - will be fixed in the next one)
2013-03-18 00:38:58 +01:00
Daniel Gibson
95a1066004 prepare unification of more sys/win32/ and sys/posix/ stuff
because the code is almost the same anyway, so
* add win32 support to sys/posix/posix_signin.cpp
* add posix support to sys/win32/win_savegame.cpp
2013-03-18 00:38:40 +01:00
Daniel Gibson
c635566bcc Move sys/posix/posix_net.cpp to sys/common/socket_net.cpp, remove win_net.cpp
and adjust the CMakeLists.txt accordingly
2013-03-17 23:35:12 +01:00
Daniel Gibson
a2be306fed Add Winsock support to posix_net.cpp (to remove code duplication)
win_net.cpp and posix_net.cpp were almost identical, i.e. caused a lot
of duplicated code.
To get rid of that, unify both files - by adding Winsock support to
posix_net.cpp and, in the next step, moving posix_net.cpp to sys/common/
and removing win_net.cpp
2013-03-17 23:35:12 +01:00
Daniel Gibson
d5898abfa4 Don't use net_port as port to connect to
the connect commands supports adding the port with ":"
like "connect 10.1.2.3:27016" - if no port is set, it defaults to 27015

net_port is still used as the port to listen on and to send from.
2013-03-17 23:35:12 +01:00
Daniel Gibson
b38aff8995 Fix sending clients from lobby to game when lobby and game are on same server
In the current case (only "direct" lobby backend, i.e. connect to a
server directly), lobby and game are always on the same server anyway..

It used to send the IP of the first network interface.. that kinda works
on Windows and FreeBSD in LANs (i.e. not over the internet or even
behind a NAT), but not at all on Linux, because the first device seems
to be the loopback device there (at least on my machine)..
Now it sends net_ip (so it should even work behind NAT) or, if net_ip is
set to "localhost" (the default), 0.0.0.0 is sent, which the client
interprets as "just use the IP of the lobby you're already connected to"
2013-03-17 23:35:12 +01:00
Daniel Gibson
6e6703b93f Print net checksums as unsigned int
because it actually *is* unsigned and the negative values look strange
2013-03-17 23:35:12 +01:00
Daniel Gibson
e8c8a04c07 rewrote posix_net.cpp based on win_net.cpp
And suddenly hosting a server on linux works at least locally
(with client and server on the same machine).
Even though there are still strange bugs (massive lags in one
direction, doesn't work in LAN), at least it works at all now.
2013-03-17 23:33:39 +01:00
Daniel Gibson
5001b49841 try to fix console deadkey problem 2013-03-16 14:32:47 +01:00
Daniel Gibson
9aa63e4074 Some timer-related improvements for POSIX
* idSysSignal::Wait should now handle timeouts > 1s better (or at all)
* Use clock_gettime for Sys_Milliseconds()
* Use CLOCK_MONOTONIC_RAW (and CLOCK_MONOTONIC as fallback if
  that's not available) for Sys_Milliseconds() and Sys_Microseconds()
  CLOCK_MONOTONIC can behave strange when NTP is used
* Small fixes in Sys_Microseconds(): use 64bit int to store time
  (like return type...), divide by 1000 (not 1000000) for nsec=>musec
2013-03-16 14:32:47 +01:00
Daniel Gibson
a203345897 Configurable username for Multi-Player (ui_name), com_pause no cheat
D3BFG gets the username from Steam, in the GPL release it just
uses the hostname.
Now it's possible to set a custom name with the ui_name CVAR
(like in classic doom3). If ui_name is empty ("") the hostname
is used.

The window losing focus in MP resulted in the console being spammed
with "changing com_pause not allowed in Multi Player" (or similar)
messages. Added CVAR_NOCHEAT flag to com_pause to get rid of that.
2013-03-16 14:32:47 +01:00
Reto Schneider
f7b532df63 SDL_GetWindowDisplay got renamed to SDL_GetWindowDisplayIndex
SDL2 commit: http://hg.libsdl.org/SDL/rev/7174fb08017a
2013-02-05 07:07:49 +01:00
RobertBeckebans
592da5df54 Merge pull request #35 from DanielGibson/fix-relaunch
Implement Sys_ReLaunch() for Linux, refactor it
2013-01-20 02:12:01 -08:00
Daniel Gibson
b044526ddb Implement Sys_ReLaunch() for Linux, refactor it
It now works on Linux so executing it doesn't freeze the game
like described in
https://github.com/RobertBeckebans/RBDOOM-3-BFG/issues/33

Furthermore, this function doesn't have any parameters anymore
(on any platform) because the only thing supplied was the original
program arguments +"+set com_skipIntroVideos 1" anyway - this is now
done in Sys_ReLaunch() (also on Windows).
Having the program arguments as one string is bad on Linux/POSIX
because there it's expected that the program arguments are one
C-string per argument.
2013-01-20 04:32:11 +01:00
Daniel Gibson
1d56411f56 Fix console-input in SDL1.2 for lots of unmapped keys
A lot of keys (especially keys not available on US keyboards) just weren't
supported for console input with SDL1.2 (SDL2 uses a different mechanism for
that).

This is fixed now by reordering a few lines in sdl_events.cpp

Please note that still only ASCII characters are supported and those keys
still can not be used in bindings - only for text input!
2013-01-20 04:16:19 +01:00
Robert Beckebans
0881085589 Merge remote-tracking branch 'DanielGibson/improve-window-handling' 2013-01-05 11:35:52 +01:00
Robert Beckebans
0cf039bfdb Changed project to use the DirectX10 SDK on Windows 8 2013-01-04 22:51:30 +01:00
Daniel Gibson
cf8d287a4e Fix Sys_ListFiles() on POSIX once again
Turned out that as "extension" (which is really more like a pattern
that matches the whole file) was even used with patterns like "*.*"
so we do proper matching using fnmatch() now - which is even easier
than the old way.
Now deleting savegames on POSIX works.
2013-01-04 14:40:35 +01:00
Daniel Gibson
a405b37f13 Pause when window loses focus, introduce com_pause
If the window loses focus com_pause is set to 1, when it regains focus
it's set to 0.
The behaviour on Win32 stayed the same (the implementation is less
hacky though) and Linux now matchces that.
2013-01-04 14:40:35 +01:00
Daniel Gibson
732d8987d3 support ctrl-g for (un)grabbing mouse
Many Linux Games support that
2013-01-04 14:40:35 +01:00
Daniel Gibson
a1c1f1b6b2 Support resizing windows for SDL1.2
By implementing GLimp_SetScreenParms() for SDL1.2
and enhancing the event handling
2013-01-04 14:40:35 +01:00
Daniel Gibson
d6c32cd49b Support resizing windows + improve fullscreen for SDL2
By implementing GLimp_SetScreenParms() and enhancing the
event handling
2013-01-04 14:40:35 +01:00
Daniel Gibson
a102d9d469 also do Sys_Sleep for less then 20ms
Sys_Sleep(10) is used quite often throughout the code.
2012-12-30 16:26:24 +01:00
Daniel Gibson
edb4856abd Set timestamp for savegames on POSIX
So they can be sorted correctly etc
2012-12-29 05:29:56 +01:00
Daniel Gibson
1e3bc3429b Fix Sys_ListFiles() on POSIX as needed for savegames
In Sys_ListFiles() the extension was abused to match whole
filenames (of savegames), not just their extensions - that
didn't work with the POSIX backend, now it does.

Sys_ListFiles() now also supports "*" as a wildcard that matches
all files - needed for deleting savegames.
However, things like "bl*" or "*ub" don't work.

While at it, I replaced readdir() with the thread-safe readdir_r()
2012-12-29 05:29:29 +01:00
Daniel Gibson
ba126dde3a Fixed various warnings from clang 2012-12-23 06:40:47 +01:00
Robert Beckebans
dd9b8a8710 Added support for precompiled headers for MSVC which reduced the compiled time from 4 minutes to 67 seconds. 2012-12-22 16:18:19 +01:00
Daniel Gibson
742ef7da83 Fix scrolling in Menus for SDL2
scrolling didn't stop, e.g. in the resolution selection menu
2012-12-22 03:26:01 +01:00
Daniel Gibson
f0dfe7e499 restore SDL1-support in sdl_events.cpp
* add define for SDL_SCANCODE_GRAVE - seems like only SDL2
  has names for the values
* add some missing keys to SDL_KeyToDoom3Key
* add scancode to unmapped-key warning
* backspace needs to be handled the same for SDL1 as in SDL2
  (i.e. a new event must be created for it) to work in console
2012-12-22 03:25:33 +01:00
Daniel Gibson
0be69a3162 Fix console on Linux
* Add support for Console-Key independently of KB Layout (with scancode)
    * add support for TAB key
    * Add hack so console is empty after opening it (SDL-only)
2012-12-21 04:58:50 +01:00
Robert Beckebans
731428164f Fixed error: class idLocalUserWin has no member named StorageSizeAvailable 2012-12-20 02:38:01 +01:00
Robert Beckebans
6b918aef86 Disabled broken savegame and profile storage checks for the PC 2012-12-19 23:56:20 +01:00
Robert Beckebans
f57d92a1ab Renamed RBDoom3 to RBDoom3BFG 2012-12-19 15:23:57 +01:00
Daniel Gibson
b1dabf3efd Improve R_GetModeListForDisplay()
* Fixed small bug when only one display mode was found by SDL2
* removed some redundant and dead code
* improved warnings
2012-12-18 22:50:59 +01:00
Daniel Gibson
f3c4948b2f R_GetModeListForDisplay() for SDL2 2012-12-18 01:11:21 +01:00
Daniel Gibson
dd987814f7 Fix cursor in menus
it didn't work correctly because the mouse isn't grabbed
(in contrast to dhewm3).
It's fixed now by returning absolute coordinates when a menu
is open, furthermore the cursor is now always hidden.
2012-12-18 01:10:38 +01:00
Robert Beckebans
99166faf71 Fixed compile problems on Win64 2012-12-17 12:24:31 +01:00
Daniel Gibson
e42a886b29 remove deprecated glShadeModel stuff
it's only for fixed function opengl, thus it's not needed and deprecated in OpenGL 3.2
AMD's driver complains about this.
2012-12-17 01:02:53 +01:00
Robert Beckebans
63f9d4000f First playable version on Linux. 2012-12-16 17:31:21 +01:00
Robert Beckebans
823ea36ffe Added support for OpenGL 3.2 context debugging using SDL 2.0 2012-12-16 12:22:07 +01:00
Robert Beckebans
d7888cf99d Added support for SDL 2.0 2012-12-14 19:03:30 +01:00
Robert Beckebans
8b8cfe7d25 Small changes to pthreads. 2012-12-14 13:10:52 +01:00
Robert Beckebans
776b1a2938 Merge remote-tracking branch 'DanielGibson/linux' 2012-12-14 12:06:40 +01:00