Add an argument completion callback to the command struct. Defaults to NULL.
If set, when tab completion is requested on the argument of a valid command,
the callback will be invoked, passing in the partial argument. The callback
then returns a (possibly partially) completed string.
The initial targets for this will be commands like map, playdemo, etc.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Introduce a new string tree function, ST_MaxMatch. This will be our main
helper function for tab completion.
Given a partial string, this function will search a string tree for strings
who's prefix matches the partial string. It will then return a string which is
the maximum common prefix of the matching strings (i.e. can be longer than the
given partial string.
For now, if the match is unique, the returned string has a space appended. I'm
not sure if I want to keep it like that as it feels like a bit of a hack. It
will do for now.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Factor out the actions for when the enter key is pressed. This cleans up a few
references to key_lines[edit_line] by passing the buffer in question
instead. More cleanups like this will help with implementing command editing.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Mostly just removing redundant comments and trying to keep the NQ/QW diffs to
a minimum. Also removed a couple of mostly useless Con_DPrintfs and properly
exported Con_ShowTree in console.h.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Sprinkling a few const modifiers about the place. Removes some inconsitencies
between similar QW/NQ function prototypes (probably introduced by me at some
point...)
Signed-off-by: Tyrann <tyrann@disenchant.net>
This is a temporary band-aid to fix a problem where the NVidia OpenGL driver
extension string is too big for the current buffer. Will think about doing
something more dynamic later.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Clean up command completion, making it properly look for the start of the
current command context. This allows command completion to work when we have
multiple commands on one line, separated by semicolons.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Add a new command "maplist" which will list all the available maps in
the current search path. An optional argument specifies a prefix to
filter the maps listed.
Con_Init is moved to the end of the file to avoid unnecessary forward
declarations.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Introduce a new function Con_ShowTree. This behaves like Con_ShowList,
only it takes an string tree instead of an array as it's input. The
implementation actually makes use of ShowList, with a little
re-factoring.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Introduce a new helper function: COM_ScanDir.
The function populates a string tree with the filesnames found in the
given folder. An optional prefix and file extension can be specified
to filter the results. File extensions can be optionally stripped.
Signed-off-by: Tyrann <tyrann@disenchant.net>
This defines structures for an RB tree of strings. The intended use of
this is for quick insertion sort of filenames for tab completion and
any other uses. We use the temp hunk for (reasonably) efficient
allocations - at least a little better than loading up the zone with
hundreds of small allocations.
Signed-off-by: Tyrann <tyrann@disenchant.net>
This patch implements a new memory allocation feature, which allows us
to use the "Temp" hunk as an expandable blob of storage space. The
first user of this will be some "string tree" functions, which build
up an RB tree of strings which will be used for sorting file lists.
We could just use Z_Malloc, but the zone isn't well suited to this
type of allocation (potentially hundreds of small struct + string
allocations) and is probably too small.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Implement COM_CheckExtension which does a case insensitive test of a
given filename for a particular file extension.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Okay, I see what's going on now. glXGetProcAddress was only part of
the very recently ratified GLX version 1.4, although Mesa has had it
for a while. glXGetProcAddressARB has been around for much longer and
is in fact part of the official Linux OpenGL ABI.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Mostly whitespace edits to removed some unnecessary differences between the
NQ/QW gl_rmain.c files. Fixes a typo (frustom -> frustum) and I ended up using
6144 for the depth of field for both NQ/QW in the MYgluPerspective function.
Signed-off-by: Tyrann <tyrann@disenchant.net>
This patch sets things up to make use of the XFree86 gamma manipulation
functions.
One issue is that the OpenGL blending substitute we set up is not really the
same as gamma correction because it only brightens pixels according to their
current values. This means black areas are not brightened using this method
(which I think is a good thing), but gamma correction adds "white" to every
area of the screen.
At the moment I've set up the "manual" OpenGL version as a fallback in case
the system gamma functions are not working or not available. I've also set
things up such that the system gamma is not used unless we are in fullscreen
mode since it affects the whole display.
The cvar _gl_allowgammafallback controls whether the fallback is used or not,
but I don't currently have a way to force it to use the "fallback" even if the
other gamma settings work. Most likely I'll separate out the two functions
into gamma and "intensity" similar to Quake 2 and later games.
Signed-off-by: Tyrann <tyrann@disenchant.net>
If we're doing hardware gamma, we probably don't want to be making adjustments
everytime an effect goes off (do we?) so it's only really for the "brightness"
slider (gamma cvar).
V_UpdatePalette seems to be wanting to mix together the colour shift effects
from damage, quad, etc. with gamma correction. For now, we'll remove the
colour shifting aspect from the gamma setting code (done with calls to
VID_ShiftPalette) and rely on the gl_polyblend mechanism for that.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Implement hardware independent gamma correction for GLQuake. This comes at a
fill-rate cost since we cover the whole scene with an alpha blended poly.
Signed-off-by: Tyrann <tyrann@disenchant.net>
We may want to make the buttons configurable in the future, but this will be
correct for the vast majority of the time.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Some people using the Nvidia binary driver on their systems are having
trouble with linking against libGL since glXGetProcAddress is not
defined. These systems seem to often have the Mesa GL headers
installed, so I can't detect this problem at compile time. Apparently
glXGetProcAddressARB is part of the Linux OpenGL ABI, so it should be
safe to always use that.
I've implemented this as a workaround in the Makefile in the hope that
the situation will resolve itself in the various libGL implementations
eventually and I'll be able to just use the headers reliably. If I
really have to make it a portable binary, I'll just have to do some
dlopen magic in the future.
Signed-off-by: Tyrann <tyrann@disenchant.net>
APIENTRY is usually defined by windows.h - this seems to be the easiest way to
deal with it as long as it's only ever a #define elsewhere and not a typedef
or something wierd like that.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Keep all the standard colours in one place to make changes easier.
Change the dlight colour to a pointer.
Try to set the colour properly everywhere.
Signed-off-by: Tyrann <tyrann@disenchant.net>
This patch adds a colour field to NQ dlights, removing one more difference
between the NQ and QW source bases.
Signed-off-by: Tyrann <tyrann@disenchant.net>