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.
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.
- 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.
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!
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.
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.
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.
This reverts commit 70eef55ab5.
It was premature to merge this commit into HEAD. Maybe we'll try again
one day, but only if a complete and fully working patch with build
system integartion is provided.
COM_FileExtension() was parsing strings from beginning to end, bailing
out as soon as '.' was found and treating everything thereafter as the
file extension. That behavior caused problem with relatives pathes like
models/monsters/tank/../ctank/skin.pcx. The new implementation uses
strrchr() to determine the last '.'.
This fixes issue #48. The bug was introduced in e07294b which replaced
hand rolled code with COM_FileExtention().
This commit has some drawbacks:
- It's rather hacky. The Quake II menu is crap and was never intended
to be scaled. My approach was to add scaling to most of the generic
functions and handle all the special cases in the non generic parts
of the menu. A better solution would require to rewrite at least
parts of the menu. And like it's said in qmenu.c: I won't do that.
- Some menu elements are aligned to the right, others to the left. In
many places magic numbers are used to align elements by hand. This
makes it very hard to impossible to implement a scaling logic which
works in all situations. With this approach most menus look good up
to at least a scaling factor of 3. Especially the "Player Setup"
menu is very problematic at small disalignements are unavoidable.
Please note, that only the menu system itself is scaled. Some elements
like the the "Quit Screen" or the loading plaque are still missing. They
will be done in a later commit.
This change is needed to break a otherwise fatal cycle:
- The renderer calls VID_MenuInit()
- VID_MenuInit() calls SCR_GetMenuScale()
- SCR_GetMenuScale() relies on gl_menuscale which is still
uninitialized at this time.
This integrates the backends for the pandora, gcw and gph written by
Scott "Pickle" Smith. Only the code itself is supplied, but no build
system integration.