Commit Graph

947 Commits

Author SHA1 Message Date
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
3056ec5db8 common: remove unused parameter to COM_Init()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 16:35:42 +10:30
Kevin Shanahan
58e65c3b26 common: don't bother stripping trailing slash from basedir
Also, fix a typo in nearby comment.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 16:30:19 +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
54b718a0a1 cmd: mark cmdalias_t.value as ptr to const
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 11:15:57 +10:30
Kevin Shanahan
54e4d4d360 cmd: constify cmd.h interfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 11:13:31 +10:30
Kevin Shanahan
307e9efd0f cmd: remove unused Cmd_CopyString() function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 11:13:01 +10:30
Kevin Shanahan
f0669b281c cmd: remove duplicate declaration already in cmd.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-28 11:12:37 +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
2177999cc9 render: comment use of BoxOnPlaneSide function without macro
Add a comment why the BOX_ON_PLANE_SIDE macro won't help performance here since
I think this isn't the first time I've gone to change this and then realised
and changed it back.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-27 11:07:54 +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
60d7c9af44 mathlib: type check argument to IS_NAN macro
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-27 10:35:30 +10:30
Kevin Shanahan
f7b1e43764 render: comment about adding the player model to cl_visedicts in R_Mirror
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-26 20:51:59 +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
91aff4e2fe client: nq: rename scoreboard_t and cl.scores
Purely renames - rename scoreboard_t to player_info_t (as it is the less
sophisticated equivalent of the same thing in QW) and rename cl.scores to
cl.players.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 18:52:05 +10:30
Kevin Shanahan
2d23e051b8 model: ugly viewent hack doesn't need to be so ugly
Ok, so cl.viewent does not get copied to cl_visedicts, so we can do a
straight address comparison on the pointer instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 18:21:17 +10:30
Kevin Shanahan
da501c96d3 render: remove paranoia check for world entity in R_AddEfrags
Only ever called from CL_ParseStatic, which pulls from cl_static_entities,
so would never be either r_worldentity and/or cl_entities[0].

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 17:59:50 +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
1f07d50968 trivial: remove some old debugging code long forgotten
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 14:22:32 +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
82210903e9 model: fix temp entities when r_lerpmove == 1
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 11:22:36 +10:30
Kevin Shanahan
b28c4b86d4 trivial: remove unused code in nq view.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 11:11:31 +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
32aa3c8bb6 view: fix vrect calculation
Previous logic was wrong, as the full screen is only drawn with viewsize
120. This was causing the status bar to be overdrawn.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 10:51:30 +10:30
Kevin Shanahan
a0949509cc render: remove #if 0'd stack check from sw renderer
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 08:26:20 +10:30
Kevin Shanahan
cb85c9b102 model: fix skindata offset calculation for software renderer
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 08:24:55 +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
9f5a3d4b23 screen: move pcx_t definition to client.h
In line with QW, which re-uses it for skins.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-25 06:40:10 +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
bc09847c3b model: implement transform interpolation for gl alias models
Ported the code from the software renderer with minimal changes. Didn't
bother to fix GL shadows at this point.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 17:02:39 +10:30
Kevin Shanahan
c7c0eab180 model: allow any origin/angles for R_RotateForEntity
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 16:32:04 +10:30
Kevin Shanahan
f810f58f64 model: rename modelorg global and move to gl_rsurf.c
Rename modelorg to bmodelorg and move it to gl_rsurf.c where it is used
for the R_RecursiveWorldNode function. Make it static and add a comment
about it's intended use.

Now it's obvious that the modelorg global in gl_rmain was acutally
set but never used for GL alias model rendering.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 16:10:12 +10:30
Kevin Shanahan
adefdb4148 model: alias model animation interpolation for glquake
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 15:42:53 +10:30
Kevin Shanahan
166ea1750d model: rename gl version of R_AliasDrawModel
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 14:56:17 +10:30
Kevin Shanahan
b5fc4ad124 model: pass pose via e->currentpose in GL R_AliasSetupFrame
Rename the function too, to be consistent with the software renderer.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 14:53:54 +10:30
Kevin Shanahan
7edf2c2c3a model: implement transform lerping for alias models
Interpolate position and orientation of alias models as well, makes the
animation interpolation much more effective.  Took some hints from
fitzquake, but ended up implementing a bit differently.

Still a few glitches (fitzquake has some good workarounds) so keep off by
default for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 13:56:47 +10:30
Kevin Shanahan
8dbe730ce0 sprite: correctly work around strict aliasing warning in gl
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 12:21:47 +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
c5ebfcdcd9 entities: check only top of entity_t struct for matching players
Making this hack even uglier, we may need to ignore the lerp info of the
entity_t structure since we write to this in the cl_visedicts array.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-24 11:36:14 +10:30
Kevin Shanahan
74c3404242 trivial: fix function name in comment in cl_tent.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-23 15:38:59 +10:30
Kevin Shanahan
4be271d1c7 entities: make temp entity sfx static
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-23 15:38:35 +10:30
Kevin Shanahan
f454f4256c entities: pull cl_beams into cl_tent.c and make static
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-23 15:37:39 +10:30
Kevin Shanahan
5dd1b86ae7 trivial: minor comment/whitespace cleanup
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-23 12:44:18 +10:30
Kevin Shanahan
4ef3b2ca5f model: submit proper lerping on alias model frame groups
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-11-23 12:43:43 +10:30