Commit graph

1424 commits

Author SHA1 Message Date
Daniel Gibson
1ce9bdba51 Implemented a persistent, per game/mod console history
it's saved in $HOME/.yq2/$mod/history.txt

While I was at it, I made the max number of lines in the history
configurable at compiletime by introducing a NUM_KEY_LINES #define
2015-05-20 14:59:32 +02:00
Daniel Gibson
41ea8879e7 Fix bug with high velocities in vents in 32bit builds, fix #71
See https://github.com/yquake2/yquake2/issues/71
and https://github.com/yquake2/xatrix/issues/4

In ClientThink(), the float value ent->velocity[i]*8 is saved into
a short and if the value is too big for a short, in 32bit gcc builds
the short is set to SHRT_MIN, resulting in the player being pressed
down instead of up.
Now we put the result in a 32bit int first (which should be big enough)
and assign the int to the short. This still overflows, but with -fwrapv
at least in a defined way (most probably the same way the original
binaries did).

And while I was at it, when the game lib is loaded, it prints the date
it was built, this is especially interesting for our Win32 binaries.
2015-05-17 18:52:18 +02:00
Daniel Gibson
4e547feb2c *Really* support K_CAPSLOCK, K_COMMAND, K_POWER, K_PAUSE
we had constants for them in keyboard.h, but no mappings to name strings in
keynames[] in cl_keyboard.c, so they couldn't be bound.
2015-05-10 02:32:27 +02:00
Daniel Gibson
1a9c8704c7 README: It's called m_filter, not in_filter
should fix #69
2015-05-09 00:37:19 +02:00
Daniel Gibson
0b9ac6cb99 Fix "mark keys up when focus is lost" code, fixes #68
It didn't build on SDL1.2 (I though we tested that?!) and didn't work
with SDL2 either.

Now it builds and actually works with both SDL1.2 and 2.0
2015-04-14 00:51:38 +02:00
Daniel Gibson
9265dc8cbe Update README
* remove link to our debian packages, we don't do that anymore
  -> mention debian/ubuntu packages instead
* remove references to libjpeg, we don't use that anymore
* Link to retex pack was broken, replace with our mirror, mention that
  the ones in models.zip suck
* Fix some typos
2015-04-12 17:56:18 +02:00
Daniel Gibson
e6646fb1e4 Bumped version to 5.30 2015-04-11 21:16:47 +02:00
Daniel Gibson
3cd9c76052 Fix fucking misleading comment in FS_AddGameDirectory()
that's not for *numbered* pak's, but all paks starting with "pak"!
2015-04-11 21:04:37 +02:00
Daniel Gibson
544a464eea Implement gamedata loading from binary path
even if $PWD is not the same path as the executable is in, the game
will look for game data in directories next to the executable.
2015-04-11 20:11:42 +02:00
Yamagi Burmeister
d2f7d27ad0 In case of focus loss, mark all keys up
Daniel is more or less sure that a stuck Alt key can occure if the user
switches through several windows by Alt-Tab. That sounds resonable,
because the keyup event for Alt may happen when the focus is not on
Quake II. In that case SDL2 misses it and for Quake II the key stays
down. Solve this by capturing the focus loss event and mark all keys
as up.
2015-03-31 21:23:04 +02:00
Yamagi Burmeister
aff37eda16 Make sure that no key is being marked down
It's apparently not enough to clear key repeats, we'll need to clear
the down states too. Without this Alt stays pressed after toggeling
fullscreen trhough Alt-Enter.
2015-03-30 21:22:55 +02:00
Yamagi Burmeister
02156e03ec Fix fullscreen switch on Alt-Enter
Switching to fullscreen through a SDL2 call is nice, but the renderer
needs to be reinitialized. Without it some things will break, for
example the gamma setting.
2015-03-30 20:57:32 +02:00
Yamagi
06834d1fb5 Merge pull request #65 from Jarvik7/OSX
OSX
2015-03-29 19:14:56 +02:00
jarvik7
2255c15bd9 Fixed app template zip
Removed resource fork
2015-03-29 13:24:16 +09:00
jarvik7
89a7d9d163 Revert OS X removal from README and update 2015-03-29 13:15:43 +09:00
jarvik7
bac4a6a930 Remove more old OS X build cruft
Deleted frameworks from inside the .app template.
Install them with home-brew before compiling:
libogg
libvorbis
libjpeg
openal-soft
sdl2

Note, current compilation is dynamic linking, so the end user will also
need these dependencies installed. Will change to static linking or
copying the libs into the .app through makefile in a future commit.

Unfortunately we can’t generate the whole .app in the makefile as we
are relying on a third party app for the game selector GUI. This could
be replaced in yquake2 code, but I don’t know ObjectiveC :O Maybe it’s
a good opportunity to learn.
2015-03-29 12:34:12 +09:00
jarvik7
150fb8b132 Remove old OS X cruft
This isn’t actually being used.
2015-03-29 12:22:40 +09:00
jarvik7
5eeef2edcc Autodetect architecture in makefile
Can now build a 32bit version.
Note that all your dependencies will also need to support 32-bit.
Install SDL2, libel, libvorbis, openal-soft in Homebrew using
‘--universal’ flag
2015-03-29 12:19:16 +09:00
Daniel Gibson
a96218eb0a Simplify the mouse grabbing/relative mouse mode magic
basically, tell SDL each frame if you want stuff grabbed or not
+ make sure to ungrab when destroying window (e.g. on vid_restart)
2015-03-27 18:56:16 +01:00
Yamagi Burmeister
3f1ced97de Update CHANGELOG again 2015-03-23 12:54:30 +01:00
Yamagi
fe62cd9639 Merge pull request #62 from Jarvik7/master
Re-add OS X support, fix underwater audio filter.
2015-03-23 12:30:14 +01:00
jarvik7
e85b6999a7 Re-add OS X support
No changes to source were needed, just to makefile.
The build process is now also different.
Frameworks are no longer needed, but you will need to get some packages
from Homebrew to compile.

Install homebrew, then get the following packages before compiling.

openal-soft
libogg
libvorbis
sdl2
2015-03-21 16:39:55 +09:00
Yamagi Burmeister
c1f5f62382 Remove the SDL.h even in !DEDICTED_SERVER builds
It was used for SDL on APPLE only. I just missread the code. :(
2015-03-20 17:45:57 +01:00
Yamagi Burmeister
531ee80ab4 We need to apply the lightmap.
This fixes #61. The issue was found and patched by ppsspp-gamer.
2015-03-20 17:41:52 +01:00
Yamagi Burmeister
533fbb7016 Update doku after OS X removal 2015-03-20 17:33:46 +01:00
Yamagi Burmeister
177b424ba1 Remove Mac OS X support
No, this is not a rage quit but the result of a long discussion. There
are several reasons for us to drop OS X support:

- OS X support was always more or less hacky. For example is was never
  really integrated into the build system and some features like the
  OpenAL sound backend never worked well.
- The OS X support never grew into the new world based upon SDL2.
- It was broken since at least Lion which was released 4 years ago.
- None of the developers has a Mac or plans to buy one. Supporting
  a software for a platform not used by the developers is more or
  less impossible.
- And despite several appeals no one from the OS X community ever
  stept up and send patches.

Removed are:
- Makefile support
- The OpenAL quirks
- The Cocoa bindings
- The framworks

Not removed is:
- Savegame support
- Memory management support
- Platform detection
- OpenGL and SDL includes

So, if someone steps up and does a modern, fully integrated port based
upon SDL2 we're happy to merge it back. The requirements are:
- It must be a clean port, without any hacks
- Full build system integration must be provided
- The port must be maintained even after it was merged. At every release
  binaries must be build, API / ABI changes with new OS X versions must
  be tracked.
2015-03-20 17:33:46 +01:00
Daniel Gibson
47cde06e27 Use stb_image for retexturing support, also support png, no more libjpeg
Retexturing support is now always on (you can still switch it off with
the gl_retexturing  CVAR), as we don't have the additional libjpeg
dependency anymore.

stb_image is used for tga, jpg and the newly supported png, so the
old tga and jpeg loading code has been removed.

I furthermore cleaned up the somehow messy and possibly slightly broken
retexturing selection code in R_FindImage()
2015-03-20 17:33:37 +01:00
Yamagi Burmeister
046ae5c7eb Bump version number to 5.24 2015-03-13 17:59:14 +01:00
Yamagi Burmeister
0cee89bd08 Update the CHANGELOG 2015-03-13 17:38:48 +01:00
Daniel Gibson
6983d5dc3c R_Screenshot(): Write "yq2" image ID
because we can.
This should hopefully work around problems in old versions of gdk-pixbuf
that mistook TGAs without image ID as microsoft .ICO
2015-02-28 21:26:13 +01:00
Christoph Oelckers
d60dfa63bc - only #define GL constant if not already present (most likely only a problem on Windows.) 2015-02-28 20:31:07 +01:00
Christoph Oelckers
0d9a96bcc8 We have 2015 now so restricting textures to 256x256 seems a bit silly on modern hardware.
Check and use GL_ARB_texture_non_power_of_two and use it if present to allow using all textures unscaled. This makes a huge visual improvement since most skins are not power-of-two textures.

Conflicts:
	src/client/refresh/header/local.h
2015-02-28 20:31:07 +01:00
Yamagi Burmeister
104fd04e55 Boot the whole bloody anykeydown mess back in place.
Okay, I tried to solve this issue the gentle way. But apparently it's
not enough to track if a key is down. We must consider if the key is
just down or if it's already repeating... Therefor raise the white flag
and just put the original logic back in place. This may fix issue #57.
2015-01-31 11:23:32 +01:00
Yamagi Burmeister
3eca8d4e32 Use the same Sys_Microseconds() output for all CMDs
When we're building command we must make sure, that all command for
one keystroke will have the timestamp in microseconds. If that's not
the case the command may end up in differend server frames, breaking
things subtile. This may be part of bug #57, but I'm not sure.
2015-01-31 11:18:41 +01:00
Yamagi Burmeister
75280b4be8 Increase anykeydown
If we don't do this the special button state BUTTON_ANY is never
generated and the player can't leave the intermission. This fixes
bug #57.
2015-01-30 17:54:27 +01:00
Yamagi Burmeister
9bda84299c Mark all keys as "up" when the refresher is restarted
This is a less intrusive variant of the old Key_ClearState() function.
When the refresher is restarted or the menu is left, this function is
called to mark all keys as "up". That works around some corner cases
where a key is still marked "down" and thus the first stroke is detected
as a repetition.
2015-01-28 20:55:28 +01:00
Yamagi Burmeister
08f78ec3b5 Set SDL_EnableUNICODE() right after the window is created
This works around a bug in SDL 1.2 were the SDL_EnableUNICODE() state is
reset to false after the window is reacreated. Setting it in the render
backend ensures that no keystrokes are lost. This fixes #56.
2015-01-28 20:42:42 +01:00
Yamagi Burmeister
403d26d520 Process only keys between ASCII 32 and 126 as char events
This fixes bug #55 which ensued from special keys processed as char
and key events if SDL 1.2 was used.
2015-01-21 17:38:21 +01:00
Yamagi Burmeister
59ac327aba Solve some layer violations
- Handling of key combinations like Alt + Return or Shift + Escape
  clearly belong into the frontend. Now that the client won't clear
  the keystates any more it's save to handle them there.

- The 'force_centerview' command belongs into the client move stuff.
  I guess it was part of the backend sinces it messes with mouse
  handling. Since the renderer is now part of the client that's not
  necessary anymore.

- One can argue that +mlook and -mlook belong into client move stuff,
  too. But since we need there calculations in the backend anyway,
  leave things like they are.
2015-01-18 09:31:37 +01:00
Yamagi Burmeister
30fa1c5407 Use character events for some input subsystems
Until now Quake 2 used keysyms aka key events for everything, including
the console and the chat window. Since key events don't reflect if the
shift key is pressed, Quake 2 needed to convert the lower case chars to
upper case char through a hardcoded table. That lead to the problem that
the keyboard layout was utilised for lower case characters only.

Solve this long standing problem by refactoring both the input backend
and the frontends Key_Event() funktion to use character events for most
input subsystem. Character events are generated by SDL and send the
real character.

An example:
- On german keyboards shift and . is : but Quake 2 generated <.
- Now a character event with : is generated and used.

There are at least 3 disadvantes by this approach:
- The backend needs to tell the frontend if a normal character (ASCII
  32 to 126) or a special character is send. Only normal characters can
  be treated as character events.
- There may be some differences between the binding of a key seen
  through the console and seen by the game. If you have a german
  keyboard and bind :, the game may not react to :. This can be worked
  around by editing the config file.
- Users may need to rebind some keys.

Please note that Quake 2 can handle ASCII characters only!
2015-01-18 09:30:53 +01:00
Yamagi Burmeister
db10e0db87 Untangle the input system from the refresher
In the old times the refresher was a stand alone DLL. For performance
reasons and to avoid laggy input parts of the input system were
implemented in this DLL. Now that the renfresher is part of the main
binary and initialized at client startup we can remove most of the
abstractions between input system, refresher and client. Also the
input system can be treated as a normal subsystem.

Changes:
- Untangle the VID_* stuff and the IN_* stuff. The functions
  called by function pointers in in_state are now called directly
  and 'struct in_state' was removed.

- Remove input.h and rename the appropriate backend functions.
  There's no longer a need for an abstraction layer between the
  input backend and the input frontend.

- Move input initialization and shutdown into CL_Init(), like it's
  already done for all other subsystems.

- Remove Key_ClearStates(). I'm pretty sure that's a left over from
  the old Win 9x backends and unnecessary.

- General cleanup.
2015-01-16 18:23:39 +01:00
Yamagi Burmeister
08c0b8e56a Mention gl_modulate 2015-01-03 11:21:32 +01:00
Daniel Gibson
5e33152f6a One entity shooting another should work even if friendly fire is off
In rogue's RHANGAR1 the turret didn't blow up the ceiling when friendly fire
was off, because in ClientTeam() both entities were set to "" (no team),
but OnSameTeam() just did a strcmp() instead of checking this special
case (no team).
We check this now and thus it works. Hooray.
I also refactored ClientTeam() to take the buffer instead of using a
static one and to be static (it's only called by OnSameTeam() anyway).

The savegame table entry for this function was invalid, but it doesn't
need to be saved anyway, so I just deleted it from the table.
2014-11-30 17:58:18 +01:00
Yamagi Burmeister
47634e64e8 Rename the 'ogg volume' functions to 'ogg enable'
These functions never set the OGG volume, the just enables or disabled
OGG playback. Rename them to match their purpose.
2014-10-25 09:40:13 +02:00
Yamagi Burmeister
4d5cb5686d Rename the "cdvolume" functions to "cdenable"
Historicaly this functions were used to adjust the cd music volume. In
YQ2 they were converted to enable or disable the cd music. Change their
name to match their current purpose.
2014-10-25 09:31:44 +02:00
Yamagi Burmeister
b546fda341 Add OS X maintainance to the list of open tasks 2014-10-25 09:19:06 +02:00
Yamagi Burmeister
7742cd4893 Fix indention 2014-08-24 10:26:50 +02:00
Yamagi Burmeister
bffed68b2c Simplify preprocessor magic and fix dedicated server build 2014-08-24 10:24:05 +02:00
Yamagi
637aae9021 Merge pull request #50 from bibendovsky/lpf
Fix underwater sfx in demos
2014-08-23 16:42:07 +02:00
bibendovsky
120bb86458 Simplify PM_CalculateWaterLevelForDemo 2014-08-18 19:21:45 +03:00