Lost my mind for a while there - snprintf always terminates the
buffer. A couple of minor tidy ups in nearby code while I was looking
over all the calls.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Rather than needing external checks on the output buffer, or adding a
"max length" parameter and needing to check for overflow, etc., make
COM_StripExtension modify the existing string.
Callers updated as needed.
A personal note that I finally realised that snprintf always zero
terminates the output buffer! So that should tidy up existing code a
little more and makes it an even better replacement for strncpy in
almost every case.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Use a pointer to the hostcache entry, rather than indexing into the
hostcache array over and over again - improves readability. Attempt to
make the name conflict resolution a little nicer, but it's still damn
ugly.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Generally try to consistently handle buffers where MSG_ReadString is
concerned. Scary the number of places where buffer sizes are
incorrectly handled.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Extend the shared string buffers set up for va() use to the
MSG_ReadString and MSG_ReadStringLine functions. Means that subsequent
calls to MSG_ReadString don't immediately invalidate the results of
the previous call (4 rotating buffers).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Reduces a bit of the extra buffer copying and reliance on va(). Buffer
length checks for a few cases now consolidated into one place.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
We don't really care about key repeats at this level, they are handled
by the key subsystem anyway. Probably should drop this from the other
input drivers as well.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
I broke this when I wanted to be able to use the ~ and ` keys within
the console. Now check the bindings directly so no matter what key is
bound to it, you can toggle the console.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Noticed sometimes (usually when playing a demo, then loading a level)
that the active palette shift remains when starting a new level.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Fix a typo in the RGB orderings. Also switch to format GL_RGBA for
glReadPixels, as that's the only format that's guaranteed to be
available by the OpenGL ES spec (although we're not using that for
now, may as well be compatible).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Reduce the surface area of the interfaces again. Turns out
SCR_BringDownConsole was never used (though I suspect we still want to
add back something to reset palette shift on disconnect, etc.)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This one looks pretty ugly with all it's conditional bits but should
be able to clean that up more later.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Starting to see that I should have just merged everything into
screen.c. That's pretty much where I expect this will end up.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
In glquake, this is set but never read so doesn't really matter where
it get's set. Let's match the software renderer's ordering.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Looks like the R_SetVrect code was pulled inside this function at some
point and massaged for the GL version. Make it look more like the
original code (without changing the behaviour at all).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
The loading plaque code is never triggered in QW, so remove it from
the GL renderer in the same way it had been removed from the software
renderer.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
start pulling the common screen code into a shared file and leave only
the parts that need to differ between the renderers in the other
files.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
SDL can deliver a variable amount of scroll wheel movment - not 100%
sure this is the correct way to handle it, but seems to work on all my
test boxes. Only on my Mac does the wheel event deliver a variable
magnitude depending on how far you scroll.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Even though always false for NQ, make the API consistent to reduce
differences between NQ/QW. Constify the arguments as well.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>