Commit Graph

303 Commits

Author SHA1 Message Date
Kevin Shanahan
9574035063 common: fix possible access outside sizebuf in SZ_Print
Bug fixed in QW, copy fix over the NQ and tidy up both functions.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 17:05:18 +10:30
Kevin Shanahan
05b99087b9 common: move common.h to shared include directory
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 16:52:51 +10:30
Kevin Shanahan
f65962caba common: prepare common.h for merging
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 16:52:05 +10:30
Kevin Shanahan
e3fdf97b12 common: make SZ_GetSpace static
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 15:48:08 +10:30
Kevin Shanahan
3f535f8856 common: constify COM_Parse and everything that follows...
...which is a lot! This ended up touching a lot of code, especially
when it spread to Cmd_Argv, etc. Mostly just propogating the correct
const qualifiers on pointers, but in some cases it was appropriate to
copy the buffer to e.g. lowercase filename in SV_BeginDownload_f or
re-write parts of functions where the buffer modifications was not
strictly needed (e.g. the *Say* functions).

I guess of note is that I now accept a const pointer into Z_Free,
which shouldn't be a problem since it doesn't modify the data pointed
to at all, just marks it as free.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 09:46:42 +10:30
Kevin Shanahan
055aec1f1c common: constify common.[ch] function prototypes
Make as many arguments to functions in common.h as possible const so
the compiler knows we shouldn't be modifying some buffers/strings
passed down here.

Also fixed (but not tested) the COM_BlockSequenceCheckByte function in
QW/common/common.c which has been #if 0'd for a while. Probably won't
keep it around, but fixed for completeness.

I skipped COM_Parse in this patch, will be constified in the following
patch.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 07:27:59 +10:30
Kevin Shanahan
fe81ad30b9 sbar: copy qw check for negative sb_weapons array index to nq
Use the qmax macro to clamp the negative values in both cases.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-27 12:01:26 +10:30
Kevin Shanahan
e7839fa7db mathlib: make vector math macros more robust
Wrap the vector macros that don't return a value in do {} while (0)
and fix a couple of missing semicolons detected in the process.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-27 11:03:16 +10:30
Kevin Shanahan
9e1d471f02 entities: clean up long lines and comments in CL_ParsePacketEntities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-26 20:50:41 +10:30
Kevin Shanahan
18a2aec115 entities: tidy up multi-line ternary experssions in CL_ParsePacketEntities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-26 20:49:29 +10:30
Kevin Shanahan
a475651b54 entities: push down constness of entities where possible
Pass over the source and make as many references to entities as possible
const. This makes it much more obvious where we are actually making
modifications to the entity_t structure.

Mostly trivial, the only place where I did something other than add the
keyword "const" was in R_DrawBrushModel where we were working around the
reversed pitch bug.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 15:49:46 +10:30
Kevin Shanahan
01631f879d entities: only save origins of visedicts for QW object trails
QW was saving the whole visedicts list to scan for origins of objects
during the previous frame so that particle trails can be placed correctly
behind rockets, grenades, etc.

Save the origins and keynums in a simpler struct and remove the double
buffering of the cl_visedicts array.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 14:08:20 +10:30
Kevin Shanahan
62d2945013 trivial: whitespace change in cl_pred.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 12:45:33 +10:30
Kevin Shanahan
472ca8b59b view: fix weapon position with qw style sbar
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 11:10:49 +10:30
Kevin Shanahan
090e2f4c6b screen: make screenshot message consistent
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 06:41:22 +10:30
Kevin Shanahan
6f414bc844 screen: remove duplicated max viewsize check
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 06:25:02 +10:30
Kevin Shanahan
1d336ef01c screen: remove duplicated viewsize check
oldscr_viewsize was a duplicated check for changes in the scr_viewsize
cvar. Remove it and make the check consistent across all screen.c files.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 06:09:08 +10:30
Kevin Shanahan
c2abd3df01 client: remove unused bitcounts profiling data
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 11:40:37 +10:30
Kevin Shanahan
6a2940940b entities: fix for handling of lightning/beam temp entities
Unintended re-use of loop variable 'i'.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-23 09:00:43 +10:30
Kevin Shanahan
acfc75321e model: remove gl_model.h and use model.h everywhere
Gets rid of a bunch of conditionals throughout the .c files as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-19 13:22:30 +10:30
Kevin Shanahan
344cc52e52 model: hand off skin data loading to helper
Have the helper struct do the renderer specific alias model skin
processing. Will probably want to relocate the code to a more appropraite
place later, but just get the factoring done for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-19 05:50:04 +10:30
Kevin Shanahan
1a128ddfbf model: create a model loading helper
Create a model loader structure which can be used to pass callbacks down
from the renderer code. This will allow us to have the render do some
processing on the loaded data at appropriate points and let us make the
actual loading code generic.

In the first instance, pass down the aliashdr_t padding value required by
the renderer.

Note that to remove a circular dependency introduced in the headers, I had
to stop including render.h in model.h/gl_model.h and that change
propogated some more changes to includes across the tree...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-18 18:32:30 +10:30
Kevin Shanahan
ea72041593 trivial: remove whitespace between type and varable for casts
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-16 12:59:49 +10:30
Kevin Shanahan
2cf6c1576f common: make COM_LoadFile static
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-16 09:09:26 +10:30
Kevin Shanahan
77f4bb3da3 build: allow qwsv to use x86 optimised assembly routines
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-14 17:57:19 +10:30
Kevin Shanahan
d3c4dff990 trivial: remove unaligned defs since not used anymore
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-14 16:09:17 +10:30
Kevin Shanahan
c62496f9e8 trivial: remove 'UNUSED' macro
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-14 15:40:06 +10:30
Kevin Shanahan
76fadf6fe4 create helper macros for cache aligning pointers/arrays
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-14 14:45:31 +10:30
Kevin Shanahan
09d0542f3b model: remove the qwsv specific model.c file
Update comment in the Makefile - one aspect fixed... now to tackle the
duplication between model.c and gl_model.c...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 13:18:27 +10:30
Kevin Shanahan
7ff23f9704 model: hack around remaining client/server differences
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 13:14:21 +10:30
Kevin Shanahan
205bcef939 model: add leaf overflow check to QWSV
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 12:53:52 +10:30
Kevin Shanahan
e74e08e909 world: move world.c to common directory
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 09:27:45 +10:30
Kevin Shanahan
55d20d27b5 world: hack around remaining world.c differences
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 09:27:12 +10:30
Kevin Shanahan
ffd6dd4590 world: copy paranoid check into QWSV code
Update the comment while I still remember what that was (probably) about.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 09:17:26 +10:30
Kevin Shanahan
d33296695c world: re-order header includes for merging
Also include the correct model file for SW vs. GL.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 09:14:05 +10:30
Kevin Shanahan
79a44f2fd3 world: fake SV_Error so we can share NQ/QWSV code
Also update one error string on the QWSV side - makes all error messages
identical.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-13 08:53:04 +10:30
Kevin Shanahan
e63df56984 progs: move pr_edict.c to the common directory
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 16:31:21 +10:30
Kevin Shanahan
4afe9347b6 progs: hack around the remaining differences in pr_edict.c
PR_LoadProgs got a bit messy, but there's still plenty of common code to
make this worthwhile.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 16:30:01 +10:30
Kevin Shanahan
c139514d85 progs: carry over NQ fix for keynames with trailing spaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 14:51:05 +10:30
Kevin Shanahan
c41d98ca6e progs: fix arg check in ED_PrintEdict_f
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 14:48:15 +10:30
Kevin Shanahan
c0d8595212 progs: cleanup QWSV edict print debug code
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 14:36:42 +10:30
Kevin Shanahan
8667c0e907 progs: reorder includes in pr_edict.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 14:29:23 +10:30
Kevin Shanahan
6158521300 progs: normalise error strings in pr_edict.c files
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 14:10:12 +10:30
Kevin Shanahan
02795c7686 progs: update an old comment about type_size
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 14:02:17 +10:30
Kevin Shanahan
6fc65c506e progs: NUM_FOR_EDICT's argument can be const
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 13:58:32 +10:30
Kevin Shanahan
49ffa951e0 world: remove some #if 0'd debugging code
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 12:00:11 +10:30
Kevin Shanahan
b29d95b927 world: check for overflow of sv_areanodes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 11:51:45 +10:30
Kevin Shanahan
8585d004ad world: move world.h to shared include directory
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 11:46:38 +10:30
Kevin Shanahan
e27da6be75 world: merge remaining differences between world.h files
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 11:44:29 +10:30
Kevin Shanahan
5b54008603 world: move SV_AddLinksToPmove to world.c
Removes visibility of the areadnode_t structure from world.h and makes
sv_areanodes private again.  pmove_mins and pmove_maxs no longer need to
be globals in sv_user.c either.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-12 11:25:30 +10:30