Quakeworld server command line parameters were not getting executed because by
calling the Cmd_StuffCmds() function directly, the cmd_argc variable was not
getting set correctly - causing Cmd_StuffCmds to just print the help text!
Thanks to Frank Haeseler <cryptus@cryptus.de> for reporting the breakage.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Fix a bug in the software renderer where we write past the end of the
rendering context if the end of episode text extends off the bottom of the
screen. The bug had actually been fixed in QW but not NQ, so this patch fixes
both consistently. Thanks to Sander van Dijk <a.h.vandijk@gmail.com> for both
reporting the problem and finding the cause.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Host_Error and Host_Endgame never return, so mark them as such and cleanup a
few unnecessary statements previously used to quiet compiler warnings.
Signed-off-by: Tyrann <tyrann@disenchant.net>
viddef_t vid resides in vid_* files and since it's a global it is *not*
supposed to live in multiple files. fixed that stupidity.
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
MAX_MOD_KNOWN had already been raised from 256 -> 512 in glquake, but not in
the software renderer or in qwsv. Some maps/mods hit the 256 limit these days
(Contract Revoked was reported to have problems - thanks Sander).
Reported-by: Sander van Dijk <a.h.vandijk@gmail.com>
Signed-off-by: Tyrann <tyrann@disenchant.net>
Since we're resetting len to 0, may as well shorten the string in the text
buffer too. Patch from O.Sezer <sezero@users.sourceforge.net>.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Do some more careful checking on model names string length.
Based on a patch from O.Sezer <sezero@users.sourceforge.net>.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Fix a bunch of incorrect uses and type mismatches in our printf-like functions,
revealed by the previous gcc attribute patches.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Annotate our varargs "printf" style functions with the gcc "format" attribute.
This shows up a whole bunch of incorrect usage in our code, so we'll start to
clean that up in subsequent patches. We've also constified the format string
arguments here.
Based on a patch from O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
Seems silly to have the Con_{D,}Printf functions duplicated in different
headers, so just use the definition from console.h. QW server actually
implements the functions in sv_send.c, so this is a little messy, but I still
see it as a small improvement.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Annotate a few functions (BOPS_Error, Sys_Error, Sys_Quit and SV_Error) with
the gcc attribute "noreturn" and clean up a few lines of dead code which were
only there previously to quiet the corresponding compiler warnings.
Based on a patch from O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
Prepare pr_exec.c for merging - all differences are either trivial whitespace
or just differences in the error functions called.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Use the new Z_Realloc function to grow the progs string table dynamically as
needed. Some large maps need significantly more than the 2048 entries I had
allocated statically before.
Based on the uHexenII implementation.
Thanks to O.Sezer <sezero@users.sourceforge.net>.
Signed-off-by: Tyrann <tyrann@disenchant.net>
min/max clashes with another macro in the mingw headers, so just rename ours
to qmin/qmax. Move the definitions to mathlib.h so they can be shared between
QW and NQ.
Signed-off-by: Tyrann <tyrann@disenchant.net>
AFAICT this little snippet of code is for compatability with the first
"Intellimouse" drivers, back when mouse wheels were just new. There still
seems to be something wrong with mouse wheel handling in NQ during gameplay
(works in the menu for setting the bindings and on the console for scrolling
the text - just not in the game...)
Anyway, with this patch both vid_win.c files are identical, ready for
merging...
Signed-off-by: Tyrann <tyrann@disenchant.net>
Copy over the mouse grab/release code from QW's vid_win.c, which releases the
mouse cursor when the console is down or when the menu is active. This
interacts badly with the way VID_HandlePause() is done, so disable that for
now (I do plan to fix it again later though).
Signed-off-by: Tyrann <tyrann@disenchant.net>
Working towards merging vid_win.c, hence the {NQ,QW}_HACK ifdefs for the
includes. NQ assigns a different minimum memory depending on whether we're
playing one of the "official" mission packs. Most likely I should just remove
this special case in the long run, but for now just do the same in QW.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Moved the sound init call from VID_Init() to Host_Init() in all versions.
while there, removed the unnecessary linux ifdef from the quakeworld init
sequence and made it to use a uniform one.
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
Well, it turns out that progs->numstrings is actually the number of bytes
dedicated to storage of the progs strings, not the number of strings.
Consequently, our attempt to calculate the strings size was completely bogus.
To avoid futher confusion, we'll rename the numstrings member in the progs
header.
Thanks to O.Sezer <sezero@users.sourceforge.net> for pointing this out :)
Signed-off-by: Tyrann <tyrann@disenchant.net>
removed the clipbox, clipmins and clipmaxs members of the model structure:
the header says it to be 'solid volume for clipping (sent from server)',
but the server doesn't do that and cl_ents does a bogus check for clipbox
in CL_SetSolidEntities which is removed now.
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
the default blendfunc is GL_SRC_ALPHA/GL_ONE_MINUS_SRC_ALPHA, no need to
specify unless we use something else.
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
Remove a bunch of unneeded stuff from the QW menu code. Would be nice if the
main menu wasn't just a hard coded image, but oh well.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Some assumptions about the sky texture in a BSP being unique prevented bsps
with more than one sky texture working properly. Indeed, this could also cause
bad memory corruption when a face with the non-primary sky texture, having
extents greater than the maximum was dynamically lit. The blocklights array is
only sized appropriately for areas <= 256 texels.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Rename pcxname variable to tganame, since the function is actually writing a
Targa file, not PCX. Also, another printf converted to use __func__.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Just in case some wierd model or other file is thrown at us where the surface
extents or similar are outside of (-9999, 9999), use the FLT_MAX macro to
ensure we catch everything. I'm yet to see this actually happen in a compiled
BSP, but I do remember being bitten in the qbsp compiler code a while back.
Signed-off-by: Tyrann <tyrann@disenchant.net>
This code never gets executed, and besides - I like being able to start a
server and client together on my laptop :)
Signed-off-by: Tyrann <tyrann@disenchant.net>
Attempt to tidy up types used for network addresses - using the standard
"struct in_addr" instead of ints or longs. Also, for our socket ioctl calls to
set non-blocking options, we can use ints - this is apparently the correct
type for this call, according to the IOCTL_LIST(2) man page on my system.
Based on a patch from O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
Copy over the PR_GetString/PR_SetString infrastructure from QW into NQ and
convert all pr_strings users to work via the provided functions. As a happy
side effect I get to remove a very long standing FIXME for dynamically
allocating pr_string_temp, which I added as a workaround so long ago I can't
even remember.
Big thanks to O.Sezer <sezero@users.sourceforge.net> for providing me with the
initial patch which pushed me to get this stuff done!
Signed-off-by: Tyrann <tyrann@disenchant.net>
When loading progs we calculate the memory used by the strings. Then, in
PR_SetString, we check for strings outside this range (not just on the
negative side). This causes edict strings to end up in the pr_strtbl too, so
need to make it a bit larger (this will be made to grow dynamically later on).
Signed-off-by: Tyrann <tyrann@disenchant.net>
removed non-functional mapstring from client_static structure. kept
a copy of the current map name in naked form. made the map console
command much more informative. made it to return in case no mapname
is given.
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
fixed COM_FileBase so that it never goes hunting through all memory for '/'
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
When calculating the checksum of the various lumps in the BSP model, the
checksum is being calculated twice for the same data. Just cache the result
from the first pass and use that.
This patch also brings the qwsv code into line with the others and removes an
unused global variable "model_checksum".
Signed-off-by: Tyrann <tyrann@disenchant.net>
The only one that really makes a difference here for systems I'm ever likely
to use is the sizeof(void *) removal, but it's probably a good idea to start
moving towards use of fixed size integer types for all the on-disk structures
throughout the source.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Fix two instances where I needlessly limited the output length of vsnprintf to
"sizeof(buffer) - 1". Also, fix a typo where I used the incorrect argument for
the buffer size. Reported by Ozkan.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Expose the game's gamma ramps so that the video driver can restore the gamma
when it gets focus in/out events from the windowing system. Add calls to
save/restore gamma to the gl_vidnt driver.
Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
It would be nice to be able to use Con_DPrintf a little earlier in the
initialisation process (i.e. before config files are exec'd). Add a
"-developer" command line argument to set this just after the cvar is
registered.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Convert all instances of un-checked vsprintf calls into vsnprintf. Most
functions switched to MAX_PRINTMSG length buffers instead of 1024. This means
we now silently truncate messages, rather than crashing (preferrably, I
think). This patch is based on some changes proposed by Ozkan.
Signed-off-by: Tyrann <tyrann@disenchant.net>
QW/server/sys_win.c wasn't including sys.h, so didn't get the MAX_PRINTMSG
define. Including the file revealed a couple of inconsistencies in function
prototypes, so fixed those up as well.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Make the buffer sizes used in various print functions consistently use the
MAX_PRINTMSG define. This patch covers Sys_Printf, Sys_Error, Sys_DebugLog,
Con_Printf, Con_DPrintf and Con_SafePrintf. Note that the NQ/sys_win.c version
of Sys_Error does things a bit differently to the rest.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Move MAXPRINTMSG to sys.h so it can be shared between the various
users. Rename to MAX_PRINTMSG for consistency with other MAX_ defines.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Free up a little extra zone memory by not allocating empty strings for
unbound keys. Thanks to Ozkan for the idea.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Allow the default basedir to be set at compile time. This is to help packagers
who want to have the binaries automatically use Quake game data installed on
the system under /usr/local/games/quake or similar.
Signed-off-by: Tyrann <tyrann@disenchant.net>
If the HOME environment variable is set, include $HOME/.tyrquake/<gamedir> in
searchpath. This directory will also be used as the location for file writes
(config.cfg, glquake cachedir) as well if available and writeable.
Thanks to Alejandro Pulver for providing the original patch, which I used as a
basis for this implementation.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Provide multiple buffers for the va function, so one function that uses va can
be called from another. I don't think there's any problem with the current
callers, but I'll need this shortly.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Rename the Windows CDAudio_MessageHandler to CDDrv_MessageHandler, as it's
part of the driver, not the generic CD layer. Move the declaration to the
winquake header.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Remove unnecessary include of sys/vt.h from gl_vidlinuxglx.c and sys/shm.h
from {NQ,QW/client}/sys_linux.c. Also, it looks like the __linux__ test in
QW/server/sys_unix.c should be __unix__ to get FreeBSD support working. In
that case, why not just remove the conditional altogether.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Add the mcache command to the QW client as well, since the Mod_Print function
is already there. Makes more sense to place this command in a client file,
since the models are logically cached client side, so cl_main.c will do for
now.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Only alias models should be setting anything in the mod->cache.data field, and
only through Mod_Extradata(). Stop the sprite loading code from setting this
field. This fixes a bug that could occur if an alias model was to replace an
unloaded sprite in the model cache.
Also, set mod->flags back to zero in a couple of places for QW, same as NQ.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Simplify the NQ model cache a little bit, taking on the behaviour of the QW
version. I can't see any real advantage to the extra flags in NQ.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Change over a few variable sized structures to use the array[0] notation
instead of [1] or [4], etc. The ones fixed are glpoly_t, aliashdr_t and
sfxcache_t.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Various minor changes to remove spurious differences between QW/NQ menu.c
files. Just whitespace changes and a few const and static keywords added.
Signed-off-by: Tyrann <tyrann@disenchant.net>
The "Use Mouse" option was not present in the menu in Linux. Add it back
again. While we're at it, replace all the MS_WINDOWED checks with the generic
VID_IsFullScreen(), to eliminate some platform dependencies from this file.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Remove unnecessary differences between the two r_bsp.c files. A few missed
statics in NQ, numerous whitespace/comment formatting differences and one hack
for the cl_entities[0] vs. r_worldentity disparity.
Signed-off-by: Tyrann <tyrann@disenchant.net>
The multitexture sky drawing routines are working fine, so remove the cvar
that turns it on/off and always use it if multitexture is available.
Signed-off-by: Tyrann <tyrann@disenchant.net>
There's some x86 asm conditional code in D_PolysetCalcGradients, but
the function is only defined when not using asm. Cleanup the unused
portion.
Signed-off-by: Tyrann <tyrann@disenchant.net>
There's a few more things in d_polyse.c which can be made static. Some
of it is a bit more complicated due to dependencies on x86 asm being
on or off. Leave a comment for some of those to be done later.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Rather than just assuming that the texture handles that we generate are okay
to use, use the proper glGenTextures function. Note that we're still leaking
textures all over the place (every map load, etc.) - proper texture management
is still needed.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Always draw using the texture sorted routines. Remove (obsolete) the
gl_texsort cvar. Removes a bunch of code only used on the non-texsort
rendering path.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Disable depth mask before drawing particles to prevent artifacts when
drawing over other semi-transparent textures (e.g. water with alpha).
Signed-off-by: Tyrann <tyrann@disenchant.net>
Fix some logic errors causing the "use mouse" option in the menu to be
unusable. This also fixes potential crash where the NULL vid_menudrawfn could
accidently get called (by not skipping over the disabled menu entry properly).
Signed-off-by: Tyrann <tyrann@disenchant.net>
It seems the old trick of undef'ing __i386__ was no longer working under
gcc-4.1, so replace the id386 define (controlled by header files) with
USE_X86_ASM (controlled by Makefile).
The checks for id386 in the assembly files are now gone (if you don't want
them, they shouldn't be compiled) and a few extra whitespace cleanups crept
in.
Signed-off-by: Tyrann <tyrann@disenchant.net>
This is a fairly big change to the makefile system. It does two main things:
- It removes the need to edit the Makefile to build the different
executables. At the moment, it's still necessary to edit the Makefile to
change to/from a debug build or to exclude x86 assembly.
- It removes the need to make clean every time you want to build another
executable. However, the header dependencies are still absent, so you need
to be careful when editing headers, as the object files won't get refreshed
automatically (yet).
All object files now get placed in a 'build' directory, with each
application's object files kept in it's own subdirectory. We also no longer do
a recursive make invocation in each of the application directories.
Signed-off-by: Tyrann <tyrann@disenchant.net>
To make the item bitfields a little more readable, define them using
shifts. Tidy up the spacing (tab vs. space) of these particular defines.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Mostly whitespace cleanups in the world.c's, and a little one in pmovetst.c
since it's largely copied from world.c. This is mainly to keep the differences
between NQ/QW versions as small as possible.
The only (minor) code changes are a little cleanup of SV_TestEntityPosition
(should be semantically the same) and changing the "backup past 0" message to
be developer only.
Signed-off-by: Tyrann <tyrann@disenchant.net>
The BSP file format's original design limits us to having 32767 clipnodes by
having the offsets stored as 16-bit signed values. Negative values are to
signify leaf nodes and refer to the CONTENTS_xxx flags defined in bspfile.h.
Since only a handful of values are required for the CONTENTS_xxx flags, we can
make use of all the space on the negative side be being a bit more careful
about how we handle these offsets.
Essentially, we can treat the offset as unsigned and instead of checking for a
value < 0 to signify contents, we check that the value large enough to be
contents. This is binary compatible with existing maps.
I added a helper function clipnode_child() to extract a 32-bit signed integer
value from the dclipnode_t structure. If the child index is large enough to be
a contents flag, we return the negative value. Otherwise, we return the index
between 0 and 65520 (0xfff0).
Hopefully my attempt at updating the asm code looks okay - this part of the
patch is the result of a 1-day crash course in x86 asm.
Signed-off-by: Tyrann <tyrann@disenchant.net>
There's a few more HACKs in this than I would normally like, but there's
enough common code to warrant merging. I'll try to shake out some of the HACKs
later.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Remove all inserts for the old completion tree and remove the rest of the api
and functions from shell.[ch].
Signed-off-by: Tyrann <tyrann@disenchant.net>
Analogous to the arg completion functions, these find the command completions
by looking through the cmd, cmdalias and cvar trees. This will replace usage
of find_completions in the next patch.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Replace the usages of the old style *_exists commands:
cmd_exists() -> Cmd_Exists()
alias_exists() -> Cmd_Alias_Exists() (new function)
cvar_exists() -> Cvar_Find()
This allows us to remove the rb_find_exact functions.
Signed-off-by: Tyrann <tyrann@disenchant.net>
The option of having the node supplied by the caller wasn't ever being used,
so removed. However, there are cases where it's not necessary to duplicate the
string, so add an option for that. All callers updated.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Replace the linked list for the cmd_function struct with an STree. All uses of
this list were to find a specific function, so they've all been replaced by
Cmd_FindCommand. This means I was able to rip out the ->next member straight
away.
Also, constified stree_node->string in the process.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Add an STree node to the cmdalias struct. Implement an alias find function and
use it to replace to instances of list walking.
Signed-off-by: Tyrann <tyrann@disenchant.net>
strerror won't work here, so just return the integer value. At least
we can look that up. Also, I have experienced a couple of instances of
connection reset problems, so I added a check for that.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Rename "change weapon" to "next weapon" (because that's what it really
does), and add a bindname for "prev weapon". Thanks to Stephen A.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Even though it's not used in software Quake, it's probably still a good idea
to save it. Thanks to Stephen A.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Remove some generally not that useful Sys_Printf's from NQ/QW common.c.
Thanks to Stephen A for the initial patch.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Set the overflowed flag on the sizebuf _after_ it is cleared. Otherwise, the
setting is just lost. This fix was alreay in QW. Also following QW's lead on
the printf thing...
Signed-off-by: Tyrann <tyrann@disenchant.net>
After adding the static declarations I must have missed at some point, the
files are almost identical. Further inspection reveals a typo only fixed in
one file - we got away with it for now because sizeof(float *) ==
sizeof(float) on 32 bit arches.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Only very small differences between these files. NQ doesn't even need
quakedef.h, so remove that. Then, guard the unique includes with XX_HACK.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Something I've always wanted to be able to do; allow the user to type
'map x<TAB>' and complete the map name starting with x, if unique. If not
unique, give the common prefix. Press TAB twice for a list of maps starting
with x.
Signed-off-by: Tyrann <tyrann@disenchant.net>
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>
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>
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>
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>
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>