Commit Graph

509 Commits

Author SHA1 Message Date
Brian Koropoff 93c9f96416 Added embedded commands with ~{} and the return command, created a token
structure to help tidy the command buffer struct up a bit, fixed a few
bugs and probably created 100 more.  A lot of things were changed to
allow embedded commands:
- Old buffers on the stack are left alone for Cbuf_ExecuteStack to
clean up.  This is so return values can be extracted from them.
- The imperative flag has been added.  An imperative buffer and all buffers
following it can not be paused with the wait command.
- The returning flag and retval dstring have been added.  If a buffer
returned something, the flag will be set.
- The return command was added so there was something to use in the
substitution.  Return nukes all loop buffers since they don't really count
as independent functions, sets the return value on the top buffer, and
clears it.
- Who knows what else.
2002-03-29 07:43:02 +00:00
Brian Koropoff 676bf39d9d Beautified GIB, improved looping and backtraces slightly. Old buffers are
now recycled, not freed.  Fixed some bugs in exp.c.  Ready to add embeded
functions (read: function calls with return values) and for loops.
Probably some other misc. fixes, I tend to go on debugging streaks.
2002-03-27 06:24:19 +00:00
Brian Koropoff 807e7de22e Fixed a bug with comments that don't have a newline after them. 2002-03-24 06:55:52 +00:00
Brian Koropoff 7c4cecd700 Fixed a stupid bug in Cmd_Exec_f that was causing map commands inside
executed files to crash the server.
2002-03-23 23:13:15 +00:00
Brian Koropoff 73f32465c5 Fixed a double free in exp.c, and made math error reports slightly more
useful.
2002-03-22 07:11:05 +00:00
Brian Koropoff e1b61d2116 Changed how looping works, fixed echo to work with taniwha's Cmd_Args
changes, added the != operator for math evaluation, added break command
to break out of loops early, added ifnot command, and who knows what else.
2002-03-22 00:22:03 +00:00
Bill Currie 961a716942 minor oops 2002-03-21 21:56:59 +00:00
Bill Currie 5a30278e77 whitespace 2002-03-21 21:56:22 +00:00
Bill Currie d00d6a539a add dstring_insertsubstr 2002-03-21 21:53:52 +00:00
Bill Currie 619a77b2f7 fix a couple of brainos that broke quotes entirely 2002-03-21 21:45:00 +00:00
Bill Currie c1deee9955 rework cmd_buffer_t->line and cmd_buffer_t->args building so quotes are
preseved
2002-03-21 21:17:31 +00:00
Bill Currie b7fc784718 add dstring_appendsubstr 2002-03-21 21:16:26 +00:00
Bill Currie 6f1b68aeb4 sys.h:
define SYS_CHECKMEM macro to ease memory allocation failure detection
cmd.c:
	loads of whitespace
2002-03-21 19:47:31 +00:00
Brian Koropoff 388ff7b597 Some bug fixes and memory leak fixes. Local variables break randomly,
probably due to my misuse of hash tables.  Anyone have any ideas?
2002-03-20 22:57:26 +00:00
Brian Koropoff d5fad096c0 Added local variables and replaced %-substitution with local variables.
Made variable substitution recursive, so ${${foo}} will be the value of
the variable whose name is contained in foo.  Added setl command to
manipulate local variables.  The only other place they can be used is in
variable substitution.
2002-03-20 04:24:31 +00:00
Brian Koropoff 1683633042 Changed to an execution stack system for aliases and config files, and
added error backtraces.
2002-03-18 23:39:03 +00:00
Brian Koropoff 46cc4ac9dd Fixed some bugs and generalized the command buffer interface. Allowed for
buffers to be linked into execution stacks and changed aliases and script
files to be run in a new stack frame.  Cbuf_Execute executes the stack from
the top down, so wait commands are handled properly.
2002-03-18 04:12:09 +00:00
Brian Koropoff f4180e7ad8 Added math evaluation, the ability for commands to span multiple lines
within braces, and put support for comments back in (oops).  To use math
evaluation, put a math expression inside $().  If you have spaces in your
expression, you'll need to enclose the entire thing in quotes so it doesn't
get split up into multiple tokens.
2002-03-17 06:57:03 +00:00
Brian Koropoff aa00b7742c Changed the token finder to be recursive, added if and while commands, and
allow tokens within braces to continue across newlines.
2002-03-17 03:31:03 +00:00
Brian Koropoff e9ca911e34 Added the ability to use curly braces to enclose tokens. Tokens in braces
won't be processed except for escape characters, so that escaped braces
can be used within.  If an uneven number of curly braces are within a
token, it will be misparsed, so escaped braces are important if you
don't want them to be considered in the parsing of the token.  Ideally,
braces within quotes within braces should not need to be escaped, but this
would require a redesign of the parser to be recursive.  Maybe I will do
this later.
2002-03-16 21:17:01 +00:00
Brian Koropoff 2a3e1869ac Bug fixes! Fixed escape character detection, use of str = dstr->str
without considering that realloc could result in dstr->str being
changed.  Also made variable substitution of non-existant variables be
replaced with a null string rather than being left alone, to prevent
errors in scripts from causing weirdness as strings get passed through
the parser several times.
2002-03-16 06:31:59 +00:00
Brian Koropoff 0a90ddc51f Fixed an error in extract line that caused escaped quotes to be parsed as
normal quotes and made it so executed files are always inserted into the
console buffer so that class config files in TF can use the new parser
features, even though the exec command is run in the legacy buffer
2002-03-15 01:45:15 +00:00
Bill Currie 6cefb63e2e get back to work on creating a good command line pak file util. currently
only dumps the file names/sizes and segs if it's used incorrectly, but it's
a start.
2002-03-12 23:45:36 +00:00
Bill Currie 5a2538faaf dstring.[ch]:
create dsprintf and dvsprintf to do formated prints to dynamic strings.
rest
	Use the new functions :)
2002-03-08 23:11:42 +00:00
Bill Currie 8f7f646d19 white space 2002-03-05 22:36:04 +00:00
Brian Koropoff e0e9084ad7 Merged in the new command parser. No major bugs or incompatibilities could
be found.
2002-03-05 21:51:12 +00:00
Brian Koropoff 066c2c8a02 The final checkin before merging. Hopefully no showstopping bugs remain. 2002-03-05 21:26:37 +00:00
Brian Koropoff 669ca72e4f Added a bonus feature: %i evaluation in aliases. Just put %i in an alias
and it will get replaced with the ith argument to the alias, 0 being the
name of the alias itself.  %% will get replaced by %, out of range
numbers will simply be removed, and non-numbers will be ignored.
2002-03-04 02:37:40 +00:00
Brian Koropoff 7241d69036 Fixes to echo, correct use of cmd_source and src_command, and change nq to
use cmd_legacybuffer for stufftext.
2002-03-04 01:11:05 +00:00
Brian Koropoff 8d124f9c2b Implemented variable substitution and did various cleanups to the parser.
Changed Cmd_TokenizeString to accept a flag that controls the application
of filters (tags, variables, escape characters) to the tokens and modified
a few places in the source that called it.  Added a secondary command
buffer that is parsed without filters for legacy command support.
Currently, it is only used for commands stuffed into the console from the
server.  It is hacky, and I hope to eventually generalize the console
interface to support any number of buffers and audit the rest of the code
to recognize it.  For now, the legacy buffer at least keeps escape
character parsing from destroying info strings.
2002-03-03 23:28:57 +00:00
Brian Koropoff f78ec56975 Added escape characters, the <i> tag to ignore tags enclosed within it, and
generally cleaned the parser up.  If a line begins with |, it will be
stripped off by the tokenizer and no tags or escape characters will be
processed.  Commands stuffed into the console from the server are prepended
with | to ensure backward compatibility.  This can also be used anywhere
backward compatibility is needed, such as where info strings are stuffed
into the console, or as an alternative to using escape characters in the
entire string.
2002-03-03 08:29:28 +00:00
Bill Currie 26d7463be7 the majority of raptor's sgi build patch. I'll look at the last two bits
(server.c and vid_sdl.c) later.
2002-03-03 06:03:51 +00:00
Brian Koropoff 4a7f3b3189 This commit fixes up cmd_args to rebuild a string from the processed
tokens and adds support for comments.
2002-03-03 06:00:44 +00:00
Bill Currie 119731e90e fix a buffer overflow snax found 2002-03-03 04:42:32 +00:00
Brian Koropoff 6936615fdf HTML-like tags are more or less done. Next up is variable substitution
and escape characters.
2002-03-03 04:26:37 +00:00
Brian Koropoff 557846b220 This is the first commit to the newcmd branch, which is a mostly-rewritten
console command parser.  It will eventually include html-like tags for
modifying text (gold numbers, brown characters, etc) and escaped characters.
The major differences so far are that dynamic strings are now used instead
of static buffers, and single quotes can be used to enclose tokens as
well as double quotes.
2002-03-03 03:36:27 +00:00
Bill Currie 009e6346fe now, so long as ulimit allows it, we can always get a core dump. Looks a
little odd:

Received signal 11, exiting...
IN_Shutdown
IN_LL_Shutdown
VID_Shutdown
Segmentation fault (core dumped)

but the core file does accurately show the error
2002-02-27 06:55:21 +00:00
Bill Currie 9d0d8c49e7 win32 compile fix 2002-02-23 17:43:41 +00:00
Jeff Teunissen ae2303c18d Hide the reason for a plugin load failure unless developer is set. 2002-02-22 11:17:20 +00:00
Bill Currie 8ee5acb208 redo Sys_Error so it's more usable throughout quake 2002-02-20 19:22:52 +00:00
Bill Currie b6c331736a give nq host_mem_size so -mem can be a cvar (similar to sv_mem_size and
cl_mem_size in qw).
2002-02-19 20:47:45 +00:00
Bill Currie 814e2ddfe9 hopefully a more correct implementation 2002-02-13 00:57:00 +00:00
Bill Currie b4000200e3 move the getopt files from qfcc/source to libs/util, link qw-master against
libQFutil and enable the option parsting in qw-master for win32.
2002-02-12 17:44:41 +00:00
Bill Currie 799cfa58af fix the recent win32 crash bug
Q_vsnprintfz should return -1 when size is 0. also make client.c's C_Print
use vsnprintf correctly
2002-02-12 04:29:44 +00:00
Bill Currie 72bd704d13 BSD compile fixes 2002-01-31 07:37:56 +00:00
Bill Currie 6f29bcb238 break the loop from CRC_Block into CRC_ProcessBlock so that crcs can be
caclulated over multiple blocks.
2002-01-28 18:00:48 +00:00
Bill Currie 6767d6bfa0 win32 compile fixes 2002-01-19 20:45:45 +00:00
Bill Currie f67f021713 don't need those anymore 2002-01-17 02:06:49 +00:00
Bill Currie 630aa80dc4 various cleanups including TODOs and FIXMEs and rewrite va to use a dynamic
buffer.
2002-01-12 04:34:53 +00:00
Bill Currie 36bb62c3c5 rewrite CrossProduct so memory is accessed more linearly. should provide
a tiny speedup for servers and clipped skyboxes
2002-01-04 06:13:50 +00:00
Bill Currie 3c6f64b26b _snprintf and _vsnprintf are not guaranteed to write the trailing '\0' 2002-01-03 23:24:47 +00:00
Bill Currie 522f64bce1 remove an extra ; 2002-01-03 23:24:20 +00:00
Bill Currie 013f503738 start getting const-correct on vec3_t params 2002-01-03 05:29:38 +00:00
Ragnvald Maartmann-Moe IV daa68ac7ce Minor pcx loader cleanup. 2001-12-21 21:12:01 +00:00
Bill Currie 858bb55bcc kill some dead code 2001-12-21 19:38:49 +00:00
Ragnvald Maartmann-Moe IV b5e93ffd6c Minor speedup (*foo++, dammit!), some whitespace. 2001-12-21 16:08:56 +00:00
Bill Currie 825b02ad87 minor speedup to skybox loading ;) 2001-12-21 06:07:30 +00:00
Bill Currie b4de52eb5c some readability (and speed?) improvments for LoadTGA 2001-12-21 05:29:33 +00:00
Ragnvald Maartmann-Moe IV 010ca032a5 Allow arbitrary power of 2 sizes for tga texture loads, reduce memory footprint needed to load rgb tgas. Speed load of non-RLE tgas.
Some slight code sanity improvements.
2001-12-21 01:41:19 +00:00
Bill Currie aaf9b953a4 make the no shutdown warning developer only (does the user realy need to
see it?)
2001-12-20 23:55:49 +00:00
Bill Currie 69e1a9aab5 bah, installed headers made my compile tests fail 2001-12-13 22:56:43 +00:00
Bill Currie 218554d60a move include/QF/string.h to include/qstring.h and include it automaticly if
needed in compat.h
2001-12-13 20:44:32 +00:00
Ragnvald Maartmann-Moe IV 2db08923e8 MSG_(Read|Write)(Coord|Angle|CoordAngle)V. Cleanups, and preparation for use of vector ops in msg.c. 2001-12-12 21:56:09 +00:00
Ragnvald Maartmann-Moe IV f66b7a93e5 Major particle interface cleanup, several bugfixes, and minor performance improvements. Oh, check out "/help easter_eggs" (gl-only, at the moment). 2001-12-11 22:37:30 +00:00
Bill Currie b8df7c0e9e alpha compile fixes (bah, bloody size_t:P) 2001-12-06 20:18:24 +00:00
Bill Currie 37028cbbc8 fix a bit of sillyness pointed out by Dwayne C. Litzenberger 2001-12-05 16:29:09 +00:00
Adam Olsen 7c6765df60 buf[sizeof(buf)] = 0; is bad. buf[sizeof(buf) - 1] = 0; is good. 2001-12-05 09:24:19 +00:00
Bill Currie e782153743 must make sure \0 doesn't get into the command buffer :P 2001-12-04 03:43:47 +00:00
Bill Currie 8be15a16e6 heh, turned out that didn't hurt overkill as much as I thought, but this
gives it a tiny boost (and will help more in the more alias heavy mods).
2001-12-04 03:13:02 +00:00
Bill Currie 3c06cd5620 another jump prediction optimisation 2001-12-03 23:40:22 +00:00
Bill Currie 21686adf10 remove redundant prototype 2001-12-03 23:40:07 +00:00
Bill Currie 68adae46b9 whitespace 2001-12-03 22:56:34 +00:00
Bill Currie c130d38c6c fix more bugs caused by the Hunk_TempAlloc changes and do some more jump
prediction fixes for msg_t and sizebuf_t
2001-12-03 22:11:21 +00:00
Bill Currie 610feb9fc6 properly terminate the string created by Info_MakeString (this was the source
of the absurd connect messages)
2001-12-03 21:24:48 +00:00
Bill Currie 650d682d2c fix some nasty security holes causes by oversized connection strings. slows
down overkill slightly :/
2001-12-03 21:06:57 +00:00
Bill Currie 9bf575d081 several little tweaks that more than make up for the reversion of low-copy 2001-12-03 08:46:56 +00:00
Bill Currie ce9e2e62e3 whitespace 2001-12-02 17:29:14 +00:00
Bill Currie 72e2e871f8 goodbye PARANOID :P 2001-11-29 06:58:15 +00:00
Bill Currie 4689350283 fix qport 2001-11-27 04:50:41 +00:00
Adam Olsen 82095df9cf - make Cache_Flush catch errors before Cache_Flush, and hopefully
print useful debugging info
2001-11-25 03:16:15 +00:00
Adam Olsen b7cbc15508 - remove the unused DYNAMIC_SIZE define 2001-11-24 16:32:39 +00:00
Chris Ison 5e05df417d fix \n order in alias expansion 2001-11-20 20:07:15 +00:00
Bill Currie 9d0320cc89 various portability improvements 2001-11-18 23:40:01 +00:00
Bill Currie cc66577f1c fixes for building on alpha (linux) 2001-11-16 01:09:17 +00:00
Bill Currie 288ec4251c various fractional speedups 2001-11-15 19:37:29 +00:00
Bill Currie 39401592d4 use malloc/free instead of Hunk_TempAlloc in Cmd_Exec_File so it can be called before Memory_Init 2001-11-14 20:16:57 +00:00
Bill Currie 42b5a5d150 reformat the output of "alias" so that capturing it is useful for config
scripts
2001-11-13 23:51:21 +00:00
Bill Currie d168a3daee this should remove the requirement for gmake on bsd systems 2001-11-12 16:23:41 +00:00
Bill Currie e71a788509 shink the cmd and alias hash table sback down (that got in by mistake) and
disable the cmd_hash_stats command (not needed for general use)
2001-11-12 03:47:30 +00:00
Bill Currie e4fd746f71 this adds some stats to hash tables and a command to get at them for commands
and aliases
2001-11-10 01:13:29 +00:00
Bill Currie 15b381909e move maplist from quakefs.c to console/maplist.c. Unfortunatly, until the
client console plugin is usable, this means the clients link maplist.o
directly.
2001-11-05 22:24:16 +00:00
Bill Currie 460b53e9ee rework the maplist code to use Con_DisplayList. this results in both
prettier code and prettier output.
2001-11-05 21:30:53 +00:00
Brian Koropoff 008b59b777 The beginnings of an f_* reply system have been added. f_version works
like normal, f_skins reports the average percent fullbright for all loaded
skins, and f_skins skinname reports the fullbright percent for a signle
skin.  cl_freply controls the time in seconds before another query can be
made.  Set it to 0 to disable them.  More queries will be added later.
The table for accessing special characters from the console has been
tweaked a bit.  Expect it to get tweaked more in the future.
2001-11-05 07:23:51 +00:00
Bill Currie 9f4a565523 rename some get_key functions so they're all uniqely named (matters only for
profiling purposes thanks to static:)
2001-11-05 03:21:42 +00:00
Bill Currie c443e2c024 info.c:
support unlimited info strings when maxsize is 0
sv_main.c:
	make localinfo unlimited
2001-11-05 02:08:20 +00:00
Bill Currie 9829cf3993 do not include \key\value pairs in the output of Info_MakeString for
backwards compatability with the old info key system.
2001-11-05 01:29:45 +00:00
Bill Currie 96a2ac9a70 put the info string tolower/highchar handling back in 2001-11-04 22:00:32 +00:00
Bill Currie 23a2760194 change formating for Info_Print 2001-11-04 20:48:12 +00:00
Adam Olsen 3417167e7e - compile fix for info.c. We can't call any functions until /after/
all variables are declared.
2001-11-04 15:42:26 +00:00
Ragnvald Maartmann-Moe IV 6d62497934 Typo fix. 2001-11-04 15:31:17 +00:00
Bill Currie b0e9bd3ddc fix a bogus leak in info strings 2001-11-04 08:18:54 +00:00
Bill Currie dcd9b0040e rewrite the info strings to use hash tables instead of a static string.
This required changes to the api (info_t instead of char *) but should be
a net gain in speed (not a lot, admittedly: it was pretty fast to begin
with, but this paves the way for some other changes I have in mind).
2001-11-04 07:50:39 +00:00
Bill Currie fa976d4461 cvarlist cfg will now give output suitable for a config file 2001-10-30 23:33:47 +00:00
Ragnvald Maartmann-Moe IV 7ea1051b9a Code cleanups. 2001-10-30 19:55:34 +00:00
Bill Currie 78a3e398d5 * taniwha gets medieval on extern 2001-10-28 04:23:37 +00:00
Brian Koropoff 05f35f9cd4 This adds the ability to access special characters in console commands by proceeding certain characters with $. See libs/util/cmd.c for the conversion table. Preceeding a character by # will shift it up or down by 128, which basically is useful for accessing the brown letters and numbers. All special characters were removed from Team_ParseSay, and variable substitution now takes the form of ${var} to prevent conflicts with special character substitution. Special character access is controlled by cmd_highchars, which defaults to off. 2001-10-27 04:34:53 +00:00
Bill Currie 6bbb9a75a3 remove an unneeded check 2001-10-26 03:12:31 +00:00
Adam Olsen 3bba5398ba - audit malloc usage. now everything checks the return value :) 2001-10-24 22:50:06 +00:00
Bill Currie 9c92634cbf remove an extern 2001-10-24 15:02:18 +00:00
Bill Currie fedea4a5e1 check for malloc failure 2001-10-23 17:35:46 +00:00
Bill Currie 6c0d760102 msg.h:
give mst_t a buffer to hold unterminated message strings
	kill MSG_ReadStaticString and MSG_ReadStringLine
msg.c:
	kill MSG_ReadStaticString and MSG_ReadStringLine
	MSG_ReadString: implement the buffer for unterminated message strings
	and update readcount on badread
cl_main.c:
	go back to MSG_ReadString and fix up the resulting const char * issues
cl_parse.c:
	rewrite the cl_mofake code all because of an uninitialized variable :)
sv_main.c:
	use MSG_ReadString instead of MSG_ReadStringLine because
	Cmd_TokenizeString really doesn't care about a terminating \n
2001-10-18 06:23:26 +00:00
Adam Olsen 18036b63d9 - change MSG_ReadString to return const char * and return a pointer
directly into the packet data.
- change a bunch of char *'s to const char *'s for the above.  Only
  thing that had trouble was the cl_nofake handler, which I changed to
  use a local buffer.
- add MSG_ReadStaticString which acts like the old MSG_ReadString,
  specifically that it uses a static buffer and tollerates
  unterminated strings.
- add a Q_strnlen function, and make strnlen use it if strnlen is
  undefined.
- Add a net_svc.h and net_svc.c which will preparse svc messages into
  structs, for easier handling.  Currently only soundlist and
  modellist are done.
2001-10-18 04:44:58 +00:00
Bill Currie 1b1955551a make all the multi-byte MSG_Read* functions update msg->readcount when the
end of the buffer is hit so subsequent MSG_Read* calls for smaller values
error as well. Also add a check for badread in MSG_ReadFloat
2001-10-18 04:14:18 +00:00
Bill Currie 2d068c0745 massive windows.h and WIN32 cleanup. 2001-10-16 21:40:45 +00:00
Bill Currie 4a0194b95c correct the default of cmd_warncmd 2001-10-15 22:41:42 +00:00
Bill Currie 742bb9de91 static plugins now actually work 2001-10-10 16:22:41 +00:00
Adam Olsen 0785610296 - fix a little mistake in SV_PrintToClient that'd cause it to
segfault if your first call was with "".  Probably could cause
  crashes too
- add a string.c file to libQFutil, with a Q_strcasestr function,
  which strcasestr is defined to if it's not already defined.  (we'd
  get that with glibc if we defined __USE_GNU, but we don't)
- make client_t and SV_ExtractFromUserinfo both use NAME_MAX for
  their name arrays, instead of 32 for one and 80 for the other
- rewrite almost all of SV_ExtractFromUserinfo's name handling.
  - \r, \n, and \t are all converted to spaces
  - leading/trailing spaces are stripped
  - consecutive spaces are reduced to a single space
  - empty names are considered bad
  - user-* nicks are considered bad (unless forced to them)
  - a name containing console or admin is considered bad
  - a name that already exists is considered bad
  - if they have a bad name it gets forced to user-%d, where %d is
    their userid
  - netname in the progs is now updated properly
  - name changes are always reported unless it's the initial setting,
    rather than only if they're full connected and not a spectator
  - finally, if the name change fails (info string exceeded), give
    them the boot.  (before this was only done for duplicate names)

That's about it :)
2001-10-04 19:11:39 +00:00
Bill Currie 1929797cc9 get nq-server so it runs. part of this involved renaming cl_warncmd to
cmd_warncmd
2001-10-03 21:25:43 +00:00
Bill Currie a1d2cf3532 duplicate file name cleanup and make dist works 2001-10-03 17:50:36 +00:00
Ragnvald Maartmann-Moe IV 9c6955f406 Fix missing include. 2001-10-02 23:53:07 +00:00
Bill Currie 40d0490b7c add Hash_GetList to get a list of elements in the hash table (unsorted) 2001-10-02 23:17:25 +00:00
Chris Ison 60107fd19c changes to get cygwin to compile server. still debugging result 2001-09-29 09:39:27 +00:00
Bill Currie 30f6d2f85c fix a case and paste error 2001-09-28 15:29:56 +00:00
Jeff Teunissen d63243380f Aaaaaaand, it's done!
Special note: I hope to never do this again. :)
2001-09-28 10:31:20 +00:00
Bill Currie b1f4a778f9 the rcsid commit from hell }:> 2001-09-28 06:26:31 +00:00
Bill Currie a439170dcf libasm cleanups 2001-09-25 22:12:55 +00:00
Bill Currie 06da30ac89 mingw build fixes again (including mostly working in sid: got some link issues) 2001-09-25 06:18:30 +00:00
Bill Currie 36de3c147e move Sys_Quit and Sys_Error totally into libQFutil. They will call a list
of pre-registered (Sys_RegisterShutdown) function before actually exiting
the program. This should take care of the pain when an ncurses server
crashes.
2001-09-24 21:00:23 +00:00
Bill Currie 49a85718f8 total nukage of Con_*Printf calls from libs (except for video). Sys_*Printf
(Sys_DPrintf is new) is now used exclusively for all lib printing. Con_Init
sets the sys printf recirection to Con_Print (which has been revamped
appropriatly) and the server sets it to SV_Print (which was SV_Printf and
the new SV_Printf calls /it/). This should fix the rcon print redirection
issues.
2001-09-21 04:22:46 +00:00
Bill Currie 74e9f89e8c forward port the client info string filtering from 0.3 and remove info.h from
a couple of c files that no longer need it.
2001-09-11 03:10:29 +00:00
Ragnvald Maartmann-Moe IV fb7918d4f8 Optimize DEG2RAD a little, plus some whitespace. 2001-09-10 04:20:27 +00:00
Ragnvald Maartmann-Moe IV 7af79b96ec Lots of whitespace, header cleanups, and a few tiny optimizations. 2001-09-09 21:41:35 +00:00
Adam Olsen 9ab9764b7a - Change QA_alloc to use variable-arguments, allowing for a much more
extensible interface.
2001-09-05 18:23:38 +00:00
Adam Olsen f1a016c8a5 - Refine the Cache_Get callback, to use a void * instead of a char *
- Switch alias models over to Cache_Get/Cache_Release
2001-08-31 12:22:45 +00:00
Adam Olsen 6cab8cf4e0 - change Cache_Get calls to Cache_TryGet (which I just added), so they
can tollerate failure.
- minor error message tweak (an emptry string is not NULL!)
2001-08-31 03:48:26 +00:00
Bill Currie e469b934ea get alsa0_9 working with latest cvs, we need to dlopen the plugin with
RTDL_GLOBAL. To use RTDL_GLOBAL, we need to make as much static as possible
 and PluginInfo needs a unique name (%s_%s_PluginInfo, type, name).
2001-08-31 00:05:58 +00:00
Adam Olsen e149094bd2 - rename Qalloc and friends to QA_alloc
- add a QA_strdup
- add Cache_{Add,Remove,Get,Release}, for the locking version of the
  cache
- Convert libs/audio/* over to locking cache functions
2001-08-30 11:37:50 +00:00
Bill Currie 0d55476711 make VectorSubtract and VectorCompare macros and clean up the readability
of R_DrawParticles
2001-08-29 20:19:54 +00:00
Bill Currie 3656d6fd59 compile fixes for win32 and take the pruning shears to *sys*.c in qw and nq
(they're not done yet, though)
2001-08-29 17:45:53 +00:00
Adam Olsen 5aceb0435e - add a cache_print command
- rename flush to cache_flush
- split off freeing of cache into a seperate function, as well as
  making it aware of read locks.
2001-08-29 15:29:17 +00:00
Adam Olsen 4deed9245a - Add CACHE_WRITE_{,UN}LOCK macros, and calls to them in Cache_*. No
effect until other things are done.
- Make Qalloc treat no callback as a failed callback
- Add a Qstrdup
- Fix a memory leak in cl_slists.c
2001-08-29 09:14:18 +00:00
Adam Olsen f423b8a8e0 Preliminary Qalloc implimentation. Not yet used. 2001-08-29 04:52:03 +00:00
Bill Currie aa3442f8b0 rearange the % calc to avoid float (and an ICE in gcc 3) 2001-08-29 01:20:30 +00:00
Ragnvald Maartmann-Moe IV dbae10f979 whitespace. grr. 2001-08-28 23:58:22 +00:00
Adam Olsen ff0cffde48 - my proof-of-concept mmapped cache code, currently disabled via ifdef
- also added a cache_profile command, which sorts allocations into
  power-of-2 sizes, then prints out how many are of that size, the
  average amount they use, and the percent of total memory is used.
  Also prints out totally allocated size, number of allocations, and
  average per allocation.
2001-08-28 23:26:58 +00:00
Bill Currie ff2b08b2fd make the Z_Malloc zone checking depend on developer 2001-08-28 06:15:58 +00:00
Bill Currie 13ecebd6a0 make Z_Malloc and friends more useful by allowing multiple zones 2001-08-28 05:21:30 +00:00
Bill Currie 2f9fd74a31 zone.c gets its name back 2001-08-28 04:24:40 +00:00
Adam Olsen cad42cbc78 Put the sound renderer in it's proper place: as a full-fledged plugin.
Bugs expected.  Please report them :)
2001-08-23 04:01:46 +00:00
Ragnvald Maartmann-Moe IV edcf092b05 Whitespace, dammit. Oh, and removal of several orphaned comments. Comments in front of functions suck. 2001-08-22 22:03:16 +00:00
Bill Currie 9c43a43bb3 must make sure *gzfile gets nulled on error 2001-08-21 02:44:45 +00:00
Adam Olsen d430cdcbff My updir patch from long ago. Prevents opening any files with an
updir in their filename.
2001-08-21 00:06:22 +00:00
Bill Currie 9ee3450265 extend the hash api to more easily support general cases 2001-08-16 02:51:53 +00:00
Zephaniah E. Hull 8f011f91ec Length is now a #define, not a bloody function! 2001-08-15 23:01:56 +00:00
Jeff Teunissen 2d84e89432 whitespace. 2001-08-15 22:38:11 +00:00
Bill Currie 9ecce9becd remove a magic number 2001-08-15 15:32:24 +00:00
Bill Currie 5dc827ccf8 comment brein damage 2001-08-15 07:50:21 +00:00
Ragnvald Maartmann-Moe IV 637bdea058 Fix indent comment dementia. 2001-08-12 17:45:55 +00:00
Bill Currie 647d38fa40 Make R_MarkLights use the vis info to speed things up. Oddly, even though
R_MarkLights is now about 3% instead of about 15%, I've lost 8 fps on my
null GL speed test. However, R_AddDynamicLights has jumped up a bit, so I'm
wording if maybe more surfaces are being lit.
2001-08-05 04:01:45 +00:00
Bill Currie 874a2c6716 don't include malloc.h 2001-08-05 03:13:08 +00:00
Bill Currie 4c23641759 print line and char number for the error 2001-08-02 02:49:14 +00:00
Bill Currie 8fa4bff0c4 _ is legal in an unquoted string and make PL_ObjectForKey return the correct
value
2001-08-01 16:07:39 +00:00
Bill Currie 2a96ffb19b fix a couple of warnings 2001-08-01 07:05:28 +00:00
Jeff Teunissen 76385372f3 plist updates; PL_GetPropertyList now calls Sys_Error() on plist errors. 2001-08-01 07:03:46 +00:00
Bill Currie 22339b712d create fs_userdir if it's not "." rather than not FS_USERPATH 2001-07-31 21:52:52 +00:00
Bill Currie fb26d8b18a make Info_Set* take flags indicating wether funchars should be stripped or not 2001-07-31 18:27:49 +00:00
Adam Olsen 0219bcb4c8 Make the help command work with commands too. (moved to cmd.c while I
was at it)
2001-07-30 01:01:39 +00:00
Bill Currie 75f3f27a22 fix a silly mistake that caused configs not to be written 2001-07-24 03:22:54 +00:00
Bill Currie d6f82b6370 make Qwrite's buffer pointer const. 2001-07-22 18:38:59 +00:00
Bill Currie 46176e1094 azerty kb patch from Filip Van Raemdonck <mechanix@digibel.org>. includes some
misc fixes, too
2001-07-19 21:46:34 +00:00
Bill Currie ffd459c931 allow for total subversion of the fs code by utilities (or crazy users).
About the only thing that remains in effect is gzip support (not even paks
are searched).
2001-07-17 22:10:20 +00:00
Bill Currie 1c9e1b176f fear the mighty const correct patch 2001-07-15 07:04:17 +00:00
Bill Currie f4976e8133 more const correctness 2001-07-14 23:50:18 +00:00
Bill Currie ecff96258f cmd.[ch]:
api change: Cmd_Args () now takes a parameter inidcating which arg to
	start at for grabbing the un-parsed command line
qw/source/sv_ccmds.c:
	implement kk's tell command and user name matching (though # is used for
	the wildcard and it's still case sensitive)
everything else:
	adjust for the new Cmd_Args protype
2001-07-10 18:25:54 +00:00
Bill Currie 9aeef3f3d6 rename qfont_table to sys_char_map and make it global (and constant) 2001-07-10 15:59:25 +00:00
Bill Currie 0242c0352d break the endian neutral file io out from qendian.c so qfcc can remain
independent of libz
2001-07-09 20:56:05 +00:00
Bill Currie 124dff1bd6 rework alias creation/deletion. Aliases are now sorted (like cvars and
commands), and the alias name length limit has been removed.
2001-07-06 17:45:32 +00:00
Bill Currie 6cda415f06 slight api change: Hash_Del now returns a pointer to the element deleted, or
null if the element was not found, rather than 0 and -1 respectively.
2001-07-06 17:43:47 +00:00
Bill Currie 6f022f5d9f well, that was interesting: turns out mingw provides mprotect and
getpagesize :/
2001-07-05 18:47:19 +00:00
Bill Currie c38ca8e2f1 qfplist.h:
remove include of glob.h. not needed and causes win32 build to fail
plugin.c:
	include compat.h and cast the return of GetProcAddress
gl_funcs.c:
	fix parse error and type mismatch
qfgl_ext.c:
	half re-write QFGL_ExtensionAddress to use QFGL_ProcAddress
vid_wgl.c:
	fix for the new gl linking
2001-07-05 17:28:19 +00:00
Bill Currie 2e5b3b4a83 damn 2001-07-05 06:31:05 +00:00
Bill Currie 0862c8facd I'ld love to know how that got though my testing :/ 2001-07-05 06:29:53 +00:00
Bill Currie e5e289e994 this brings back knghtbrd's Sys_Printf redirection, but in such a way that
Sys_Printf still has the format attribute. To redirect Sys_Printf, declare the
redrecting function as void (const char *, va_list) and call Sys_SetPrintf
with this function as its parameter.
2001-07-05 04:59:43 +00:00
Bill Currie b4ac2446a1 Put knghtbrd's sys cleanup changes back in, but with Sys_MakeCodeWriteable
in sys/util.c rather than limbo (the crux of the problem that caused the
previous reversal). I'll look into his Sys_Printf changes next.
2001-07-05 03:28:40 +00:00
Bill Currie e659c2a44f revert kntbrds recent sys changes as they break sw static builds 2001-07-05 00:12:43 +00:00
Joseph Carter eb71edb5d4 taniwha, please have a look at this to make sure I'm doing it the "right"
way..  Sys_Printf is now Sys_StdPrintf for now.  Sys_Printf is a function
pointer and will end up replacing Con_Printf as well.  Names will change
to something intelligent when I'm done.  Win32 is not yet touched, but I
haven't forgotten it.

The reason for this is the assumption that Con_Printf and Sys_Printf do
not overlap.  The new server console WILL change that, requiring that we
change how we handle both functions.  The plan:  Default to using stubs
and swap them for full-featured functions on Console init which do all
the things we expect.  Will also do a stderr version later.
2001-07-02 18:11:34 +00:00
Bill Currie c350bb2b1b a slight oopsie on the location of WriteFloat and friends :P plus nq is now
endian/size clean.
2001-06-29 06:50:29 +00:00
Bill Currie 443196e66b very nice command line tab completeion from Shawn Walker
<eviltypeguy@qeradiant.com>
2001-06-28 04:05:14 +00:00
Jeff Teunissen 76e28aeaaa Portability fixes. plugin.c will, in all likelihood, work on Windows now. 2001-06-27 08:34:48 +00:00
Zephaniah E. Hull 908d265212 Clean up and repair of the run time linking, does NOT work until deek
commits his gl_funcs.c.
2001-06-26 02:26:46 +00:00
Jeff Teunissen c0915106e3 Even more correctness fixes. 2001-06-19 02:29:41 +00:00
Jeff Teunissen 5111376b46 Correctness fixes, some whitespace. 2001-06-19 02:26:19 +00:00
Jeff Teunissen 118645fd51 Property list updates. Objects of type QFDictionary are now hash tables
(and thus have a new simpler PL_ObjectForKey() function to get a value for
a key). Also, you can now call PL_FreeItem() on a plitem_t to free a
property list item and all of its descendants (if it has any).

Binary plist values are still not supported.
2001-06-19 02:10:47 +00:00
Bill Currie 3a94567913 Make Hash_FlushTable loop safe and correct the copyright notices 2001-06-19 02:01:18 +00:00
Bill Currie 8c13809e9c don't process .S files when not using asm (either --disable-asmopt or non-x86
platforms). Done by moving the asm objects into libasm.la (yes, there's one in
each dir that needs it) so that the Makefiles don't explode.
2001-06-14 19:52:38 +00:00
Bill Currie f4969d5d67 add some docs for the hash table api and move the include of stdlib.h to
hash.c (no longer needed in hash.h).
2001-06-11 19:37:25 +00:00
Bill Currie 75fbb80b96 make the hash table types opaque 2001-06-11 19:17:40 +00:00
Bill Currie 2fa5437303 correct a comment 2001-06-07 17:11:34 +00:00
Bill Currie 22f465dabe use field_offset to hide the nastyness 2001-06-06 16:10:28 +00:00
Joseph Carter 4a0d453b48 The gfx.wad error is now idiotproof! 2001-06-05 08:39:27 +00:00
Bill Currie e339e82c01 hash.h is now const correct as is a lot of qfcc 2001-06-04 04:52:14 +00:00
Bill Currie 06064ec390 compat.h:
create a field_offset macro that takes a structure type and a field and
	returns the offset of the field within the structure
everything else:
	use field_offset to calculate the size of variable sized structs
2001-05-31 18:11:05 +00:00
Bill Currie 323015b11a include/QF header cleanup. including config.h (or any file from include) is
a nono because headers in include/QF get installed, but include don't and thus
would break quakeforge-dev.
2001-05-31 05:33:13 +00:00
Bill Currie 6bf58ab1af no header includes cvar.h now 2001-05-31 03:41:35 +00:00
Bill Currie 940598f240 merge pcx.c, tga.c and wad.c. util seemed the most logical place, but LoadPCX
had to be modified to get away from vid.h (better designe now IMO anyway)
2001-05-30 20:56:53 +00:00
Joseph Carter 05adfd0e53 quakefs.h -> vfs.h
quakeio.h -> vfile.h

More diff reduction between trunk and my VFS code.  Also took the time to
put some headers in order and fix a few #include's pointed out by moving
things around a bit.
2001-05-30 04:34:06 +00:00
Joseph Carter 186d577818 s/QFile/VFile/g - makes my diffs much smaller and more manageable for the
VFS work.
2001-05-30 03:21:19 +00:00
Bill Currie 47d95d245a protect the cvar callback and description fields from being modified once
they have been set to non-defaults.
2001-05-30 02:41:30 +00:00
Bill Currie fa6dd2a9f3 now works with autoconf 2.50 2001-05-23 03:01:03 +00:00
Zephaniah E. Hull b264cdd28b Make it actually work? 2001-05-22 12:44:53 +00:00
Zephaniah E. Hull 5245f56012 Validate userinfo strings on connect. (Part of a nasty DOS fix.) 2001-05-22 12:00:45 +00:00
Jeff Teunissen 5569f04a88 whitespace 2001-05-19 23:24:57 +00:00
Adam Olsen 9cc30959e4 Sound now uses runtime plugins. Much thanks to Deek for doing all the
thinking :)
set fs_pluginpath to point to the right dir, and set snd_plugin to pick a sound
plugin.

Current issues:
- alsa 0.5 won't build properly, dunno why
- segfault on exit.  I think I know the cause of this, and how to fix it
- alsa 0.9, gus, sgi, sun, and win32 havn't been tested
2001-05-19 00:05:35 +00:00
Bill Currie 306d6db39b if ... if -> if ... else if 2001-05-17 20:05:36 +00:00
Bill Currie e118a9136a forgot these :P 2001-05-08 20:57:07 +00:00
Bill Currie b5df1c816a move fnmatch.c and dirent.c to libQFutil 2001-05-08 20:53:25 +00:00
Bill Currie cc68e1a12e qf now links with NO optimisation (not even -O). R_CullBox has been moved from
glquake.h to mathlib.h (along with the declaration for frustum) and the
extern inline keyworws protected by an ifndef so that mathlib.c can cause
R_CullBox to be compiled publicly. The definition of frustrum has been moved
from its verious locations into mathlib.c.
2001-05-07 04:08:34 +00:00
Bill Currie 58afc88122 link libQFutil.so against libdl 2001-04-25 20:53:09 +00:00
Jeff Teunissen c364e1c3cf The first version of the QF Plugin API. Version 1.0 supports input and
sound (digital audio, that is, not CD) plugins right now, more to come
later.
2001-04-24 22:19:42 +00:00
Adam Olsen 853fbb4242 Change commented out Con_Printf statements in Cache_Move into
Con_DPrintf statements, so they can be used in debugging without
recompiling.  And no, there's no performance issue.
2001-04-17 08:39:44 +00:00
Bill Currie f37b007da2 nuke the memset in Hunk_HighAllocName 2001-04-12 23:39:23 +00:00
Bill Currie 12c14bd71f split up console like sys was 2001-04-11 05:10:04 +00:00
Bill Currie 9cd83e178f various fixes for out-of-srcdir building
configure.in:
	foo/Makefile MUST come before foo/bar/Makefile or foo/bar will NOT be
	created.
libs/*...*/Mkaefile.am: add INCLUDES so $(top_scrdir)/include gets searched
{qw,nq}/source/Makefile.am: fix fbset compiling (and cleaning for nq)
2001-04-11 03:09:24 +00:00
Joseph Carter 75aa40276f A few more. Also removed a couple inaccurate comments. 2001-04-11 00:10:19 +00:00
Joseph Carter 2bc55b7828 Cvar cleanups.. NULL is now used in place of 0 for callbacks, this should
make Cvar_Get's a lot easier to read.
2001-04-10 23:39:30 +00:00
Bill Currie 082c5ccae4 get qw-server to link in mingw 2001-04-10 21:43:57 +00:00
Bill Currie e9fb7576da oops, missed with the #ifdef 2001-04-10 20:15:52 +00:00
Bill Currie 334b528a40 forgot some bits 2001-04-10 20:11:50 +00:00
Bill Currie dfbfd9463c mingw cross compile fixes. qw-server (only, so far) compiles but does not
yet link due to Sys_Error :/
2001-04-10 20:07:11 +00:00
Adam Olsen ed0b391dfb Tweaked some comment indentation that made me itch ;) 2001-04-10 02:36:50 +00:00
Zephaniah E. Hull a16b2c0070 Borrowed LH's VectorVectors.
Changed smoke trails a good bit.
2001-04-06 18:37:23 +00:00
Bill Currie 67368ffc5d make the start calculation a little more accurate 2001-04-01 03:30:17 +00:00
Bill Currie ccbae9bd5c do Sys_Error the same way Con_Printf was done 2001-04-01 02:08:38 +00:00
Zephaniah E. Hull 8ef747124c Fixed the weak Con_Print issue.
(Still need to thwap taniwha for doing an incomplete merge.)
2001-03-31 14:41:13 +00:00
Bill Currie 7cb6245efa link libQFutil.so against libz so the clients (and tools) don't need to worry
about it
2001-03-31 03:51:25 +00:00
Bill Currie e939ccc40a cvars now sport a callback function that gets called whenever the cvar changes
or on initial get.
2001-03-31 01:02:52 +00:00
Bill Currie 4162243287 eliminate Cmd_ForwardToServer from cmd.c. Cmd_ForwardToServer still needs to
be removed from cmd.h, but that can wait a bit.
2001-03-31 00:35:08 +00:00
Bill Currie ad9142ff3c move Con_Printf, Con_DPrintf and Con_Print (weak) into libs/util/console.c.
Except for the cmd and cvar callbacks, libQFutil.so is now standalone.
2001-03-31 00:08:21 +00:00
Bill Currie 1e2e2f44c3 move the developer cvar into cvar.c 2001-03-30 23:35:48 +00:00
Bill Currie 99535102d7 bare bones sys stuff moved into libQFutil. unix stuff seems to work just fine,
but win32 is probably borked atm
2001-03-30 23:24:57 +00:00
Bill Currie 4f2e22bfb8 merge and move quakefs.c into libQFutil where it belongs. at long last 2001-03-30 00:44:35 +00:00
Bill Currie 80ee9eb8d1 merge and move quakeio.c into libQFutil 2001-03-29 21:16:16 +00:00
Bill Currie 95d116eac0 make makt.S pic friendly. The ELF abi is bent slightly as ebx was already used
and I didn't feel like subbing it for something else, so esi is the GOT access
register.
2001-03-29 09:10:35 +00:00
Jeff Teunissen 277c17cfd8 Shared library support. The util and gamecode libraries are now shared,
and this clears the way for an external API for utilities and
such. And yes, this means libtool is now used.
2001-03-29 09:07:44 +00:00
Bill Currie cb5c262ffc qtypes.h:
remove includes of qdefs.h and compat.h
pr_comp.h:
	merge pr_comp.h from quake and qfcc, removing the copy in qfcc
cmdlib.[ch]:
	nuke the endian code.
qendian.c:
	initialise the LittleLong etc pointers at compile time rather than run
	time
com.c (both nq and qw):
	nuke the LittleLong etc init code
everything else:
	fix up after the qtypes.h cleanup
2001-03-28 17:17:56 +00:00
Bill Currie 82b533e1ef forgot that .S files don't have dependency info :/ 2001-03-27 21:46:49 +00:00
Bill Currie f78b973978 move the api headers into include/QF and clean up (most of) the resulting mess.
target specific files that I don't build won't compile yet. just put QF/
infront of the offending headers.

Also move ver_check into libqfutils
2001-03-27 20:33:07 +00:00
Bill Currie 4489319298 first step towards garbage collected dynamic strings in qc. All strings
external to the progs file are now malloced and then freed at progs reload.
All that needs to be implementd for gc to work is the scanner and deallocator.
2001-03-06 04:22:33 +00:00
Bill Currie c4616346a1 dx_hack_hash stolen from Daniel Phillips <phillips@innominate.de> in the lkml.
This might or might not give hash tables a better spread. We'll see :)
2001-03-05 16:19:10 +00:00
Bill Currie f40b361fb3 hash.[ch]:
slight api change: the getkey and free functions now take a user data
	parameter (which is an aditional parameter to Hash_New.
cmd.c, cvar.c, quakefs.c:
	clean up the resulting errors.
pr_edict.c:
	use hash tables for lookups of function, global and field definitions.
	should speed things up a bit, ESPECIALLY when type checking is enabled.
2001-03-05 05:11:26 +00:00
Bill Currie 09b58f7e5f merge math code into utils 2001-03-05 02:06:05 +00:00
Bill Currie 4b1f10d10d fix the problem with getting kicked from tf/megatf servers for changing teams.
Got the `changed' test backwards.
2001-02-24 04:25:27 +00:00
Bill Currie 2bfeed6820 looks like utils is more or less complete for now, except for some fixes in
nq for abyss etc (ie, the magical -<mod> args).
The interface to the message subsystem got a revamp and all the mods to the .c
files reflect this. currently a little ugly, but I plan on abstracting msg
further to clean it up and make it more oo.
2001-02-23 23:16:13 +00:00
Bill Currie 981d067000 merge qw's net_com.c and checksum.c (net_com.c was identitcle to nq's
checksum.c) and then move the resutlting checksum.c into libs/utils
ditching nq's. Due to net_com.c, qw's libqfnet.a will need to be deleted or
you will get duplicate symbol link errors. Also merge crc.[ch] and move
qfplits.[ch] to their final homes. Also, remove a slightly overzealous use
of "static" in qfplist.[ch].
2001-02-23 18:31:48 +00:00
Bill Currie 42e52a7093 %s/libutil.a/libqfutil.a/g due to name space clash found when linking SDL.
New naming convention, all libs will be libqf<subsys>.a (should we instead
use libQF<subsys>.a?). The .so libs, when we get to them, will have to be
sorted out then.
2001-02-22 16:53:15 +00:00
Bill Currie 7516666084 libutil.a is now used by both qw and nq 2001-02-22 08:12:13 +00:00
Bill Currie 9aa50a847c clean up the mess caused by attempting to merge cmd.[ch]. When taken further,
this might give us nice controlability of when cvars can be changed.
2001-02-22 04:46:59 +00:00
Ragnvald Maartmann-Moe IV c6da49206e More typos, spelling corrections, and case fixes fed to the nearest handy fiend. 2001-02-22 00:15:03 +00:00
Bill Currie 95f6db7775 start merging stuff into libs/util and fix the concequences in nq. nq doesn't
build yet though (keys.c, *screen.c and *view.c) due to console fun.
2001-02-21 19:35:06 +00:00