Commit Graph

63 Commits

Author SHA1 Message Date
Ozkan Sezer a95bb25134 add new stdio replacement FS_fgetc() and use it in snd_mikmod.c.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@869 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-09-27 19:51:26 +00:00
Ozkan Sezer 5e4849c61f replace all ctype.h functions/macros and strcasecmp/strncasecmp()
by locale-insensitive versions, new header q_ctype.h.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@868 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-09-25 17:01:40 +00:00
Ozkan Sezer ffa3bf4413 Merge several FS_* and snd_codec* layer updates from uhexen2 tree:
tidy-ups in FS* stdio replacement functions. add new FS_filelength.
snd codec layer updates: changed codec_open() to operate only on a
stream pointer and moved all file open/close stuff to snd_codec.c.
codec_open now only returns true or false upon success or failure
instead of a stream pointer. added new snd_codec.c toplevel helper
S_CodecForwardStream(), which allows one codec to hand over its
stream from its codec_open() to another codec. Support for tracker
(mod) music, including support for Unreal umx containers. (might
be useful if we ever make a Nehahra version of the engine some day.
edit the makefiles to enable when compiling.)


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@867 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-09-25 11:01:12 +00:00
Ozkan Sezer 3011dbfe35 fix quoted strings when EOF is reached before the closing '\"' and
support for C-style /*..*/ comments in COM_Parse(). some whitespace
tidy-up.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@795 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-01-16 19:02:23 +00:00
Ozkan Sezer d8f3f2a1d3 common.c: until COM_CheckRegistered() is called keep the value of the
registered cvar as 1, set it right in COM_CheckRegistered().  fixes the
problem of registered game installed from later versions of cdroms not
being properly recognized by versions 0.85.6 and 0.85.7.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@658 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-04-20 19:47:22 +00:00
Ozkan Sezer 2e78f9c684 Added file count and header crc macros for id1/pak0.pak v1.00 and v1.01
so that the corresponding shareware versions actually work properly and
not error out.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@654 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-03-28 17:50:47 +00:00
Ozkan Sezer b1afe294f2 at least use the api sensibly and don't screw the whitespace
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@637 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-02-12 11:33:07 +00:00
Steven ae7c52985b common.c
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@636 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-02-12 02:59:21 +00:00
Ozkan Sezer 923e9280cd common.c (COM_FindFile): reverted ultra-hacky revs. 627-629. made it to
report files which aren't found only if developer.value >= 2, i.e. used
Con_DPrintf2 of fitz for the first time since its creation.. would have
been better if I'd implement and use Sys_DPrintf() there.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@634 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-02-11 15:55:09 +00:00
Sander van Dijk 8f4e287407 make missing texture no-spam hack safer
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@629 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-02-08 18:22:55 +00:00
Steven 33c1ea94c4 Refine missing texture no-spam hack.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@628 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-02-08 00:53:29 +00:00
Steven 9f11380a74 Don't spam developers about missing external textures.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@627 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-02-07 20:38:34 +00:00
Ozkan Sezer 19953bd399 silenced -Wsign-compare warnings.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@575 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-29 19:06:08 +00:00
Ozkan Sezer c96c275334 some common.c cleanup: Made COM_InitFilesystem() public through common.h,
moved its calling from COM_Init() to Host_Init() just after COM_Init().
Moved registration of registered and cmdline cvars and COM_Path_f command
and the calling of COM_CheckRegistered() to COM_InitFilesystem(). Removed
unused memsearch(). Fixed the stupidity in leading space elimination from
com_cmdline.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@573 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-29 15:10:18 +00:00
Ozkan Sezer 338da9a4c8 dropped CVAR_SERVERINFO flag from the cmdline cvar: sending cmdline upon
CCREQ_RULE_INFO is evil...
while I was there, did some whitespace clean-up in common.c.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@568 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-28 23:40:27 +00:00
Ozkan Sezer 1928f2e1b8 * first shot at cvar flag system and cvar layer clean-ups :
- removed the archive and server members of cvar_t structure
  which are now represented by the CVAR_ARCHIVE, CVAR_NOTIFY
  and CVAR_SERVERINFO flags.
- added new Cvar_SetROM and Cvar_SetValueROM functions to 
  set vars marked as CVAR_ROM (read-only vars) programaticaly
- added Cvar_SetCallback() as a new function to assign (or
  remove) a callback function to a cvar.
- changed Cvar_RegisterVariable() to only accept a var pointer
  as in original quake
- moved notification handling from Cvar_Set() to callbacks.
- changed Cvar_Set() so that it doesn't reallocate the var's
  string buffer if nothing is changed, nor does it run the
  var's callback.
- changed the 'registered' and 'cmdline' cvars to be read-only
  so that the users can't change it using the console.  (and
  with 'registered' flagged as CVAR_ROM, the 'static_registered'
  thing is no longer required)
- added comment that sending cmdline upon CCREQ_RULE_INFO is
  evil...
- more to follow later.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@566 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-28 22:01:33 +00:00
Ozkan Sezer d0093d0b80 common.c (q_vsnprintf): Don't attempt to nul terminate the buffer
if zero size was passed. From Sander van Dijk.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@563 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 19:32:17 +00:00
Ozkan Sezer ef0062741c added COM_ExtractExtension() helper.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@561 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 14:00:33 +00:00
Ozkan Sezer fb2f45126e changed many strcpy and strncpy into q_strlcpy
and strcat and strncat into q_strlcat

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@560 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 13:15:31 +00:00
Ozkan Sezer 983af887bf changed many sprintf() calls into q_snprintf().
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@557 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 10:50:42 +00:00
Ozkan Sezer 07b572b642 better buffer size safety with COM_StripExtension, COM_FileBase and COM_DefaultExtension
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@554 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 08:04:02 +00:00
Ozkan Sezer 573f49d920 added FS_fgets(). From Sander van Dijk.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@541 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-24 12:03:29 +00:00
Ozkan Sezer 162f18573e removed the LoadBufFile method
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@475 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-08-03 19:22:29 +00:00
Ozkan Sezer 701ae6882c a little syncing with uhexen2.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@460 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-06-12 12:25:22 +00:00
Ozkan Sezer 45498a99a4 replaced COM_FileExtension by a slightly better version from uhexen2,
renamed it to COM_FileGetExtension, added a prototype to common.h.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@454 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-05-20 20:38:11 +00:00
Ozkan Sezer a85d8dcd6a made global host_parms a pointer, set in main(). adjusted places where
host_parms is used. made COM_Init() and Host_Init() to take no arguments.
made Sys_Init() to set host_parms->userdir: at present, it is set to
host_parms->basedir, to be changed properly when user directories are
implemented.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@443 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-04-19 16:41:45 +00:00
Ozkan Sezer 3f006ac62f * common.c (COM_FileExists): changed return type to qboolean.
(COM_filelength): new procedure.
(COM_FindFile): adjustments to avoid multiple file open/close operations just a
little.
* common.h (COM_FileExists): adjusted prototype.
* bgmusic.c (BGM_PlayCDtrack): adjusted for COM_FileExists() return type change.
* sys_sdl_win.c, sys_sdl_unix.c (Sys_filelength): changed return type to long.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@408 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-02-10 17:25:43 +00:00
Ozkan Sezer f707439e86 * common.c (FS_fread): fixed coding style.
* bgmusic.c:  minor updates from uhexen2.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@406 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-02-08 11:00:29 +00:00
Ozkan Sezer 11270d5b2c changed makefiles to use 1/0 instead of yes/no for the codec options.
made quakespasm custom conback embedding optional, still defaulting to 1.
the code requires USE_QS_CONBACK preprocessor definition.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@392 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-12 09:32:22 +00:00
Ozkan Sezer ceb1dd2186 made COM_FindFile to accept both file and handle as NULL. Added
COM_FileExists as a new helper procedure which calls COM_FindFile
with both file and handle parameters as NULL.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@373 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-05 18:01:15 +00:00
Ozkan Sezer c583b5b541 common.c (searchpath_t): Added new member `path_id', an unsigned
int identifier assigned to the game directory. Remember that main
<install_dir>/game1 and the unix <userdir>/game1 have the same id.
The id starts as 1 for the first data1 directory. For every new
directory, the value is the left-shifted version of the previous
one.  Made COM_FindFile() to accept a path_id pointer argument
and storing the id in it if it isn't NULL. Made COM_OpenFile(),
COM_FOpenFile() and all COM_Load* functions to accept a path_id
pointer argument similarly. Adjusted callers accordingly.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@370 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-02 21:45:16 +00:00
Ozkan Sezer e28dfd7d70 Removed support for -proghack and -path. I think no one misses them.
Made COM_FindFile() static to common.c. Removed COM_CopyFile(), no
callers at the moment.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@369 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-02 21:42:54 +00:00
Ozkan Sezer 1dac8dd81d removed the useless msg_suppress_1 thing.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@365 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-01 12:27:02 +00:00
Ozkan Sezer 9aad4f2759 common.c, common.h: Added LOADFILE_* defines for use with COM_LoadFile,
for easier reading. Added COM_LoadZoneFile(), COM_LoadMallocFile() and
COM_LoadBufFile() from uhexen2. Added comments after their prototypes
in common.h.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@361 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-12-31 10:29:38 +00:00
Ozkan Sezer 6d2ae18a82 killed all references to Draw_BeginDisc
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@357 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-12-30 23:28:08 +00:00
Ozkan Sezer 165598051c backports from uHexen2 tree:
* common.c, common.h: Added new structure fshandle_t. Added new procedures
  FS_fread, FS_fseek, FS_ftell, FS_rewind, FS_feof, FS_ferror and FS_fclose.
  The new FS_*() stdio replacements are necessary if one is to perform non-
  sequential reads on files reopened on pak files because bookkeeping about
  file start/end positions is needed. Allocating and filling in the fshandle_t
  structure is the users' responsibility when the file is initially opened.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@353 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-12-30 16:50:15 +00:00
Ozkan Sezer 56a7b2e6fd added file_from_pak as a new flobal, made COM_FindFile() to set it properly.
from quakeworld sources.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@352 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-12-30 16:35:16 +00:00
Ozkan Sezer e08d6cf1e3 replaced all usess of vsprintf by q_vsnprintf
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@320 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-31 16:57:12 +00:00
Ozkan Sezer 20c394edea added q_snprintf and q_vsnprintf from uhexen2. always use our wrapper
versions to ensure consistent behavior accross platforms.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@319 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-31 14:09:00 +00:00
Ozkan Sezer b1585b3039 more fixes for deprecated conversion from string constant to char*:
handle the -safe command line switch using a new global safemode,
check for safemode in the related driver init functions and remove
the safeargvs & co from common.c and COM_InitArgv().


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@307 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-29 12:55:41 +00:00
Ozkan Sezer 906df3f650 const correctness changes.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@300 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-29 02:22:55 +00:00
Ozkan Sezer efde005b7f * common.c: Renamed the empty Test_f function of johnfitz to FitzTezt_f.
Renamed its associated console command to fitztest.
* net_dgrm.c: Renamed back Net_Test_f to Test_f. Added back the test,
test2 and ban console commands.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@209 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 09:58:12 +00:00
Ozkan Sezer c24d592580 host_cmd.c, console.c, gl_draw.c, image.c, gl_model.c, r_sprite.c, cl_parse.c,
gl_warp.c, host.c, gl_mesh.c, gl_sky.c, gl_texmgr.c, cvar.c, sv_main.c, cvar.h,
gl_screen.c, r_brush.c, gl_vidsdl.c, zone.c, cl_main.c, cmd.c, snd_dma.c,
snd_mem.c, common.c, sv_phys.c: Added explicit casts to eliminate -Wc++-compat
warnings.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@170 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-05-31 07:42:36 +00:00
Ozkan Sezer 65a7f903e5 main_sdl.c (main): Remove leading linefeed from the init message.
common.c (COM_InitArgv): Move the leading linefeed to the end of message.

Index: main_sdl.c
===================================================================
--- main_sdl.c	(revision 157)
+++ main_sdl.c	(working copy)
@@ -58,7 +58,7 @@
 	if (!parms.membase)
 		Sys_Error ("Not enough memory free; check disk space\n");
 
-	Con_Printf("\nFitzQuake %1.2f (c) John Fitzgibbons\n", FITZQUAKE_VERSION);
+	Con_Printf("FitzQuake %1.2f (c) John Fitzgibbons\n", FITZQUAKE_VERSION);
 	Con_Printf("SDL port (c) Sleepwalkr, Baker\n");
 	Con_Printf("QuakeSpasm %1.2f.%d (c) Ozkan Sezer, Stevenaaus\n", FITZQUAKE_VERSION, QUAKESPASM_VER_PATCH);
 
Index: common.c
===================================================================
--- common.c	(revision 157)
+++ common.c	(working copy)
@@ -1150,7 +1150,7 @@
 	if (n > 0 && com_cmdline[n-1] == ' ')
 		com_cmdline[n-1] = 0; //johnfitz -- kill the trailing space
 
-	Con_Printf("\nCommand line: %s",com_cmdline);
+	Con_Printf("Command line: %s\n", com_cmdline);
 
 	safe = false;
 


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@158 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-04-27 07:15:19 +00:00
Ozkan Sezer 53746a85c9 Constified Con_DebugLog, Con_Print, Con_Printf, Con_Warning, Con_DPrintf,
Con_DPrintf2, Con_SafePrintf, Con_CenterPrintf, Con_LogCenterPrint,
Con_NotifyBox, PL_ErrorDialog, PR_RunError, Host_EndGame, Host_Error,
SV_ClientPrintf, SV_BroadcastPrintf, Host_ClientCommands, Sys_DebugLog,
Sys_Error, Sys_Printf, BOPS_Error and va. Added noreturn attribute to
Sys_Error, Sys_Quit, BOPS_Error, PR_RunError, Host_EndGame and Host_Error.
Added format printf attribute to Con_DebugLog, Con_Printf, Con_Warning,
Con_DPrintf, Con_DPrintf2, Con_SafePrintf, Con_CenterPrintf, PL_ErrorDialog,
PR_RunError, Host_EndGame, Host_Error, SV_ClientPrintf, SV_BroadcastPrintf,
Host_ClientCommands, Sys_DebugLog, Sys_Error, Sys_Printf and va. Adjusted
Host_Status_f and NET_Ban_f for the new attributes. Fixed broken format
strings in Con_Dump_f, Mod_LoadTexinfo, PR_AllocStringSlots and FloorDivMod.
Defined __attribute__ macros in quakedef.h so that we don't break non-gcc
compilers.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@154 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-04-26 16:30:40 +00:00
Ozkan Sezer 610567cb8a common.c (COM_Parse): commented out the check for ':' in regular word parsing
so that a command line like "+connect ip:port2 works.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@102 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-03-06 13:35:05 +00:00
Ozkan Sezer 14a1493f73 quakedef.h (quakeparms_t): removed the cachedir member which doesn't serve
any purpose for quite some time. added userdir as a new member, user's
directory on UNIX platforms. if user directories are enabled, basedir
and userdir will point to different memory locations, otherwise to the same.
this member will be enabled/used later.
common.c: removed all references to cachedir and com_cachedir which don't
serve any purpose for quite some time.
main (main): removed assingment to cachedir member.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@96 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-03-01 12:50:12 +00:00
Ozkan Sezer 3724ddbb02 common.c (com_basedir): added new global char array.
(COM_InitFilesystem): used global com_basedir instead of the automatic
basedir variable.
common.h (com_basedir): added extern.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@95 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-03-01 11:55:13 +00:00
Ozkan Sezer 0f91628b0d common.c (va): made va() to cycle between four static buffers so that we
can call it one after another. will be needed later.
(get_va_buffer): new helper for va().


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@92 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-03-01 10:28:12 +00:00
Ozkan Sezer f0c318cafe common.c (Q_strncasecmp): fix it so that it properly returns negative and
positive values.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@87 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-27 08:00:57 +00:00