Commit Graph

51 Commits

Author SHA1 Message Date
Andrei Drexler 9582f6c7b6 Change STRUCT_FROM_LINK to avoid potential undefined behavior 2022-03-01 11:20:10 +03:00
Andrei Drexler 83af8d060f Add basic localized strings support for 2021 re-release
See https://github.com/Novum/vkQuake/pull/345
2021-08-29 17:11:28 +03:00
Ozkan Sezer 3cf6946ebd revise the function attributes usage: do not use the gcc __attribute__
directly, but define proper macros for each attribute we do or may use.
also support MSC along the way for example with the noreturn attribute.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1440 af15c1b1-3010-417e-b628-4374ebc0bcbd
2017-07-28 12:50:10 +00:00
Eric Wasylishen c827ccaa66 Host_Loadgame_f: fix for arrow characters appearing in multiline messages
on Windows, a regression introduced in the Host_Loadgame_f rewrite r1398

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1405 af15c1b1-3010-417e-b628-4374ebc0bcbd
2017-05-09 00:01:41 +00:00
Eric Wasylishen 8011b3f9fd Host_Loadgame_f: rewritten version loads the whole .sav into memory
+ avoids "Loadgame buffer overflow" when loading saves from QS-Spike/DarkPlaces containing large comments
+ removes ugly } hack
+ should be a bit faster as we avoid calling fgetc for every byte

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1398 af15c1b1-3010-417e-b628-4374ebc0bcbd
2017-04-16 02:53:06 +00:00
Eric Wasylishen 43b509ba4f Add "apropos" command from QS-Spike
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1393 af15c1b1-3010-417e-b628-4374ebc0bcbd
2017-04-02 18:18:57 +00:00
Eric Wasylishen 5b21d5935f RMQ protocol (999) support, adapted from RMQEngine
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1313 af15c1b1-3010-417e-b628-4374ebc0bcbd
2016-06-24 06:15:41 +00:00
Ozkan Sezer b9032b7815 copyright years, general tidy-up, remove unused d_ifacea.h.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1059 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 08:55:46 +00:00
Ozkan Sezer 717b452da0 moved Host_Game_f to common.c, made it to use COM_AddGameDirectory(). moved in-memory pak structures, searchpatch structure and searchpath global declarations to common.h. adjusted affected extra patches.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1003 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-08 21:10:33 +00:00
Ozkan Sezer 65cd7e75e0 ditch fmin/fmax and use plain q_min/q_max
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@922 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-06-22 05:50:39 +00:00
Ozkan Sezer 66d6fc077a revert r907 (fmin()/fmax() is available with vs2012 and newer. patch from Eric Wasylishen.)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@921 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-06-21 20:29:11 +00:00
Ozkan Sezer 58b3577721 fmin()/fmax() is available with vs2012 and newer. patch from Eric Wasylishen.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@907 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-04-28 05:50:58 +00:00
Ozkan Sezer 5ad7885e70 comment out COM_DefaultExtension
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@905 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-04-27 08:33:05 +00:00
Ozkan Sezer d941ee83db revert r903 and the old conback hack commits. change the engine
to load id1/quakespasm.pak for content customizations.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@904 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-04-27 08:28:16 +00:00
Steven 66764cfd6f Overide some old fashioned default bindings (from Eric - https://sourceforge.net/p/quakespasm/patches/17/).
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@903 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-04-26 10:28:13 +00:00
Ozkan Sezer 53e10c7098 Avoid using COM_DefaultExtension() whenever possible: it may lead
to unpredictable results. Use a new procedure COM_AddExtension()
which appends the given extension to the path if the one it has,
if any, doesn't match. In Host_Game_f(), reject "." as the path.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@902 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-04-26 07:50:54 +00:00
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 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 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 5e6212ad02 added strlcat.c and strlcpy.c: will use them later.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@558 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-12-27 11:03:39 +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 2bcdb4b39f just properly use (u)intptr_t where necessary and don't do the cheap hack
of using size_t instead of it.  include stdint.h in q_stdinc.h for it.
for Visual Studio earlier than version 2010, use the header provided by
the msinttypes project.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@439 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-04-01 14:55: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 945262b863 min/max macros: renamed them to q_min and q_max, moved them common.h.
removed the inline versions which only handled integers.  moved CLAMP
macro to common.h.  Adjusted all places for the renamed macros.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@386 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-01-10 10:35:40 +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 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 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 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 d8779f7d0d MS Visual Studio support:
* Quake/console.c, net_udp.c: replace snprintf by q_snprintf.
* Quake/common.h: Define q_snprintf as _snprintf for windows and as
snprintf for all others. Likewise for q_vsnprintf. Disable several
MSVC warnings. Define fmin and fmax as min and max macros for MSVC.
* Windows/quakespasm.vcproj, quakespasm.sln: Add Visual Studio 2005
project files.
* Windows/SDL_x64.zip: Add SDL x64 import libraries for MSVC.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@281 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-20 02:25:22 +00:00
Ozkan Sezer 3a6e17e627 added q_stdinc.h, adapted from uhexen2, to tidy up several includes and
macros in one place.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@277 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-08-14 20:55:39 +00:00
Ozkan Sezer 23bc72554f common.h: tweak the qboolean and NULL definitions for __cplusplus. from uhexen2.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@176 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-05-31 12:10:25 +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 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 16b9fd13ea bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
Ozkan Sezer 44ad29724b common.c, common.h: added check for '-fitz' command line switch which, if true,
makes quakespasm to run in fitzquake mode and disable custom quakespasm hacks.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@47 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-18 11:45:18 +00:00
Ozkan Sezer f9928b24ac 64 bit compatibility effort, 2/nn: type correctness work in common.h,
gl_draw.c, gl_model.c, gl_sky.c, gl_texmgr.c, gl_texmgr.h, r_alias.c,
r_brush.c, r_part.c, r_world.c, snd_mem.c.  next step will be server
side (progs) work which is actually the heart of the problems.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@34 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 21:26:11 +00:00
Ozkan Sezer 9e861e3102 64 bit compatibility effort, 1/nn: type correctness work in common.c,
common.h, gl_vidsdl.c, mathlib.h, zone.c, zone.h. added Z_Realloc as a
new function (will be used later.) next step will be type correctness
work in opengl stuff.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@33 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 21:22:20 +00:00
Ozkan Sezer 8f3d2c5c7b common.c, common.h: constified the replacement string library functions.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@27 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 13:02:22 +00:00
Ozkan Sezer 68fc38c3a6 chase.c, cl_input.c, cl_parse.c, client.h, common.c, common.h, console.h,
cvar.h, draw.h, gl_draw.c, gl_fog.c, gl_mesh.c, gl_model.c, gl_model.h,
gl_rmain.c, gl_rmisc.c, gl_screen.c, gl_sky.c, gl_texmgr.c, glquake.h,
host.c, keys.c, keys.h, main.c, menu.c, menu.h, pr_cmds.c, quakedef.h,
r_alias.c, r_brush.c, r_part.c, r_sprite.c, r_world.c, sbar.c, sbar.h,
screen.h, snd_dma.c, snd_mem.c, snd_mix.c, sv_main.c, sys_sdl.c, vid.h,
view.h, world.c, world.h:  Loads of warning fixes about missing function
prototypes, missing parens around &, missing braces leading to ambiguous
else statements and unused and uninitialized variables. There are still a
couple of unitialised variables here and there, but not much. The warnings
about strict aliasing violations need taking care of.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@21 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 12:01:07 +00:00