From 013f5037386811141b9c71cc7f71ac6f6948ce3a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 3 Jan 2002 05:29:38 +0000 Subject: [PATCH] start getting const-correct on vec3_t params --- include/QF/GL/qf_explosions.h | 2 +- include/QF/locs.h | 12 +++---- include/QF/mathlib.h | 33 ++++++++++--------- include/QF/model.h | 8 +++-- include/QF/msg.h | 7 ++-- include/QF/plugin/snd_render.h | 6 ++-- include/QF/render.h | 2 +- include/QF/sound.h | 18 +++++++---- include/r_dynamic.h | 30 ++++++++--------- include/r_local.h | 9 +++--- include/r_shared.h | 2 +- include/view.h | 2 +- include/world.h | 15 +++++---- libs/audio/renderer/snd_dma.c | 8 +++-- libs/audio/snd.c | 7 ++-- libs/models/brush/model_brush.c | 7 ++-- libs/util/mathlib.c | 22 ++++++------- libs/util/msg.c | 6 ++-- libs/video/renderer/gl/gl_dyn_part.c | 46 +++++++++++++++------------ libs/video/renderer/r_light.c | 14 ++++---- libs/video/renderer/sw/sw_rmisc.c | 2 +- libs/video/renderer/sw/sw_rpart.c | 27 ++++++++-------- libs/video/renderer/sw32/sw32_rmisc.c | 2 +- libs/video/renderer/sw32/sw32_rpart.c | 27 ++++++++-------- nq/include/server.h | 9 +++--- nq/source/locs.c | 15 ++++----- nq/source/pr_cmds.c | 2 +- nq/source/sv_ded.c | 3 +- nq/source/sv_main.c | 2 +- nq/source/sv_move.c | 2 +- nq/source/sv_user.c | 2 +- nq/source/world.c | 40 +++++++++++------------ qw/include/pmove.h | 11 ++++--- qw/include/server.h | 5 +-- qw/source/cl_view.c | 2 +- qw/source/locs.c | 16 ++++------ qw/source/pmovetst.c | 14 ++++---- qw/source/sv_move.c | 2 +- qw/source/sv_send.c | 2 +- qw/source/world.c | 37 +++++++++++---------- 40 files changed, 250 insertions(+), 228 deletions(-) diff --git a/include/QF/GL/qf_explosions.h b/include/QF/GL/qf_explosions.h index c04b50663..a3582b1c7 100644 --- a/include/QF/GL/qf_explosions.h +++ b/include/QF/GL/qf_explosions.h @@ -29,6 +29,6 @@ #ifndef __qf_explosion_h #define __qf_explosion_h -extern void R_NewExplosion (vec3_t org); +extern void R_NewExplosion (const vec3_t org); #endif // __qf_explosion_h diff --git a/include/QF/locs.h b/include/QF/locs.h index 2c86face7..03b0fac9c 100644 --- a/include/QF/locs.h +++ b/include/QF/locs.h @@ -37,13 +37,13 @@ typedef struct char *name; } location_t; -location_t *locs_find(vec3_t target); -void locs_add (vec3_t location, const char *name); -void locs_del (vec3_t loc); -void locs_edit (vec3_t loc, const char *desc); +location_t *locs_find(const vec3_t target); +void locs_add (const vec3_t location, const char *name); +void locs_del (const vec3_t loc); +void locs_edit (const vec3_t loc, const char *desc); void locs_load(const char *filename); -void locs_mark (vec3_t loc, const char *desc); -int locs_nearest (vec3_t loc); +void locs_mark (const vec3_t loc, const char *desc); +int locs_nearest (const vec3_t loc); void locs_reset (); void locs_save (const char *filename, qboolean gz); void map_to_loc (const char *mapname, char *filename); diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index 692a7a3bf..300b68186 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -37,7 +37,7 @@ #endif extern int nanmask; -extern vec3_t vec3_origin; +extern const vec3_t vec3_origin; #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) @@ -81,19 +81,19 @@ extern vec3_t vec3_origin; // fall over #define ROLL 2 -void _VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); +void _VectorMA (const vec3_t veca, float scale, const vec3_t vecb, + vec3_t vecc); +vec_t _DotProduct (const vec3_t v1, const vec3_t v2); +void _VectorSubtract (const vec3_t veca, const vec3_t vecb, vec3_t out); +void _VectorAdd (const vec3_t veca, const vec3_t vecb, vec3_t out); +void _VectorCopy (const vec3_t in, vec3_t out); -vec_t _DotProduct (vec3_t v1, vec3_t v2); -void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); -void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); -void _VectorCopy (vec3_t in, vec3_t out); - -int _VectorCompare (vec3_t v1, vec3_t v2); +int _VectorCompare (const vec3_t v1, const vec3_t v2); //vec_t Length (vec3_t v); void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross); float VectorNormalize (vec3_t v); // returns vector length void VectorInverse (vec3_t v); -void _VectorScale (vec3_t in, vec_t scale, vec3_t out); +void _VectorScale (const vec3_t in, vec_t scale, vec3_t out); int Q_log2(int val); void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); @@ -105,12 +105,15 @@ fixed16_t Invert24To16(fixed16_t val); fixed16_t Mul16_30(fixed16_t multiplier, fixed16_t multiplicand); int GreatestCommonDivisor (int i1, int i2); -void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); -void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up); -int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); -float anglemod(float a); +void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, + vec3_t up); +void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up); +int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs, + struct mplane_s *plane); +float anglemod (float a); -void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ); +void RotatePointAroundVector (vec3_t dst, const vec3_t dir, const vec3_t point, + float degrees ); #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ (((p)->type < 3)? \ @@ -138,7 +141,7 @@ extern mplane_t frustum[4]; extern inline #endif qboolean -R_CullBox (vec3_t mins, vec3_t maxs) +R_CullBox (const vec3_t mins, const vec3_t maxs) { int i; diff --git a/include/QF/model.h b/include/QF/model.h index a6b057dd4..04fc0261c 100644 --- a/include/QF/model.h +++ b/include/QF/model.h @@ -453,7 +453,7 @@ model_t *Mod_ForName (const char *name, qboolean crash); void *Mod_Extradata (model_t *mod); // handles caching void Mod_TouchModel (const char *name); -mleaf_t *Mod_PointInLeaf (float *p, model_t *model); +mleaf_t *Mod_PointInLeaf (const vec3_t p, model_t *model); byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model); model_t *Mod_FindName (const char *name); void Mod_ProcessTexture(miptex_t *mt, texture_t *tx); @@ -462,8 +462,10 @@ int Mod_CalcFullbright (byte *in, byte *out, int pixels); int Mod_Fullbright (byte * skin, int width, int height, char *name); -void *Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame, int extra); -void *Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame, int extra); +void *Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame, + int extra); +void *Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame, + int extra); void *Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group, maliasskindesc_t *skindesc); void Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, diff --git a/include/QF/msg.h b/include/QF/msg.h index 5713a04d5..cdc10bb72 100644 --- a/include/QF/msg.h +++ b/include/QF/msg.h @@ -37,10 +37,11 @@ void MSG_WriteLong (sizebuf_t *sb, unsigned int c); void MSG_WriteFloat (sizebuf_t *sb, float f); void MSG_WriteString (sizebuf_t *sb, const char *s); void MSG_WriteCoord (sizebuf_t *sb, float coord); -void MSG_WriteCoordV (sizebuf_t *sb, vec3_t coord); -void MSG_WriteCoordAngleV (sizebuf_t *sb, vec3_t coord, vec3_t angles); +void MSG_WriteCoordV (sizebuf_t *sb, const vec3_t coord); +void MSG_WriteCoordAngleV (sizebuf_t *sb, const vec3_t coord, + const vec3_t angles); void MSG_WriteAngle (sizebuf_t *sb, float angle); -void MSG_WriteAngleV (sizebuf_t *sb, vec3_t angles); +void MSG_WriteAngleV (sizebuf_t *sb, const vec3_t angles); void MSG_WriteAngle16 (sizebuf_t *sb, float angle16); typedef struct msg_s { diff --git a/include/QF/plugin/snd_render.h b/include/QF/plugin/snd_render.h index fa03667c2..96c8f952c 100644 --- a/include/QF/plugin/snd_render.h +++ b/include/QF/plugin/snd_render.h @@ -43,12 +43,12 @@ typedef void (QFPLUGIN *P_S_AmbientOff) (void); typedef void (QFPLUGIN *P_S_AmbientOn) (void); typedef void (QFPLUGIN *P_S_TouchSound) (const char *sample); typedef void (QFPLUGIN *P_S_ClearBuffer) (void); -typedef void (QFPLUGIN *P_S_StartSound) (int entnum, int entchannel, struct sfx_s *sfx, vec3_t origin, float fvol, float attenuation); -typedef void (QFPLUGIN *P_S_StaticSound) (struct sfx_s *sfx, vec3_t origin, float vol, float attenuation); +typedef void (QFPLUGIN *P_S_StartSound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float fvol, float attenuation); +typedef void (QFPLUGIN *P_S_StaticSound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation); typedef void (QFPLUGIN *P_S_StopSound) (int entnum, int entchannel); typedef struct sfx_s * (QFPLUGIN *P_S_PrecacheSound) (const char *sample); typedef void (QFPLUGIN *P_S_ClearPrecache) (void); -typedef void (QFPLUGIN *P_S_Update) (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); +typedef void (QFPLUGIN *P_S_Update) (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right, const vec3_t v_up); typedef void (QFPLUGIN *P_S_StopAllSounds) (qboolean clear); typedef void (QFPLUGIN *P_S_BeginPrecaching) (void); typedef void (QFPLUGIN *P_S_EndPrecaching) (void); diff --git a/include/QF/render.h b/include/QF/render.h index 601e9d9aa..56badc265 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -162,7 +162,7 @@ void R_NewMap (model_t *worldmodel, struct model_s **models, int num_models); // LordHavoc: relative bmodel lighting -void R_PushDlights (vec3_t entorigin); +void R_PushDlights (const vec3_t entorigin); void R_DrawWaterSurfaces (void); /* diff --git a/include/QF/sound.h b/include/QF/sound.h index fd2ccb0b1..136f026df 100644 --- a/include/QF/sound.h +++ b/include/QF/sound.h @@ -114,12 +114,15 @@ void S_Init (struct model_s **worldmodel, int *viewentity, void S_Init_Cvars (void); void S_Startup (void); void S_Shutdown (void); -void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); -void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); +void S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, + float fvol, float attenuation); +void S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, + float attenuation); void S_StopSound (int entnum, int entchannel); void S_StopAllSounds(qboolean clear); void S_ClearBuffer (void); -void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); +void S_Update (const vec3_t origin, const vec3_t v_forward, + const vec3_t v_right, const vec3_t v_up); void S_ExtraUpdate (void); void S_BlockSound (void); void S_UnblockSound (void); @@ -137,12 +140,15 @@ void SND_AmbientOff (void); void SND_AmbientOn (void); void SND_TouchSound (const char *sample); void SND_ClearBuffer (void); -void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); -void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); +void SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, + float attenuation); +void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, + const vec3_t origin, float fvol, float attenuation); void SND_StopSound (int entnum, int entchannel); sfx_t *SND_PrecacheSound (const char *sample); void SND_ClearPrecache (void); -void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); +void SND_Update (const vec3_t origin, const vec3_t v_forward, + const vec3_t v_right, const vec3_t v_up); void SND_StopAllSounds (qboolean clear); void SND_BeginPrecaching (void); void SND_EndPrecaching (void); diff --git a/include/r_dynamic.h b/include/r_dynamic.h index 5705674da..34fdac0f3 100644 --- a/include/r_dynamic.h +++ b/include/r_dynamic.h @@ -52,27 +52,27 @@ extern void (*R_WizTrail) (struct entity_s *ent); extern void (*R_FlameTrail) (struct entity_s *ent); extern void (*R_VoorTrail) (struct entity_s *ent); -extern void (*R_RunParticleEffect) (vec3_t org, vec3_t dir, int color, - int count); -extern void (*R_BloodPuffEffect) (vec3_t org, int count); -extern void (*R_GunshotEffect) (vec3_t org, int count); -extern void (*R_LightningBloodEffect) (vec3_t org); -extern void (*R_SpikeEffect) (vec3_t org); -extern void (*R_KnightSpikeEffect) (vec3_t org); -extern void (*R_SuperSpikeEffect) (vec3_t org); -extern void (*R_WizSpikeEffect) (vec3_t org); +extern void (*R_RunParticleEffect) (const vec3_t org, const vec3_t dir, + int color, int count); +extern void (*R_BloodPuffEffect) (const vec3_t org, int count); +extern void (*R_GunshotEffect) (const vec3_t org, int count); +extern void (*R_LightningBloodEffect) (const vec3_t org); +extern void (*R_SpikeEffect) (const vec3_t org); +extern void (*R_KnightSpikeEffect) (const vec3_t org); +extern void (*R_SuperSpikeEffect) (const vec3_t org); +extern void (*R_WizSpikeEffect) (const vec3_t org); -extern void (*R_BlobExplosion) (vec3_t org); -extern void (*R_ParticleExplosion) (vec3_t org); -extern void (*R_ParticleExplosion2) (vec3_t org, int colorStart, +extern void (*R_BlobExplosion) (const vec3_t org); +extern void (*R_ParticleExplosion) (const vec3_t org); +extern void (*R_ParticleExplosion2) (const vec3_t org, int colorStart, int colorLength); -extern void (*R_LavaSplash) (vec3_t org); -extern void (*R_TeleportSplash) (vec3_t org); +extern void (*R_LavaSplash) (const vec3_t org); +extern void (*R_TeleportSplash) (const vec3_t org); void R_DarkFieldParticles (struct entity_s *ent); void R_EntityParticles (struct entity_s *ent); -void R_PushDlights (vec3_t entorigin); +void R_PushDlights (const vec3_t entorigin); struct cvar_s; void R_MaxDlightsCheck (struct cvar_s *var); void R_Particles_Init_Cvars (void); diff --git a/include/r_local.h b/include/r_local.h index 0891381cb..4418d2e67 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -324,15 +324,16 @@ void R_PrintAliasStats (void); void R_PrintTimes (void); void R_PrintDSpeeds (void); void R_AnimateLight (void); -int R_LightPoint (vec3_t p); +int R_LightPoint (const vec3_t p); void R_SetupFrame (void); void R_cshift_f (void); void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1); void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip); void R_SplitEntityOnNode2 (mnode_t *node); -void R_RecursiveMarkLights (vec3_t lightorigin, struct dlight_s *light, int bit, - mnode_t *node); -void R_MarkLights (vec3_t lightorigin, struct dlight_s *light, int bit, model_t *model); +void R_RecursiveMarkLights (const vec3_t lightorigin, struct dlight_s *light, + int bit, mnode_t *node); +void R_MarkLights (const vec3_t lightorigin, struct dlight_s *light, int bit, + model_t *model); void R_LoadSkys (const char *); diff --git a/include/r_shared.h b/include/r_shared.h index 9baa91f45..acfb50d5b 100644 --- a/include/r_shared.h +++ b/include/r_shared.h @@ -133,7 +133,7 @@ extern float xscaleshrink, yscaleshrink; extern int d_lightstylevalue[256]; // 8.8 frac of base light value -extern void TransformVector (vec3_t in, vec3_t out); +extern void TransformVector (const vec3_t in, vec3_t out); extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv); diff --git a/include/view.h b/include/view.h index 5c35a55cf..eb5b42a3d 100644 --- a/include/view.h +++ b/include/view.h @@ -40,7 +40,7 @@ void V_Init (void); void V_Init_Cvars (void); void V_RenderView (void); -float V_CalcRoll (vec3_t angles, vec3_t velocity); +float V_CalcRoll (const vec3_t angles, const vec3_t velocity); void V_UpdatePalette (void); void V_StartPitchDrift (void); void V_StopPitchDrift (void); diff --git a/include/world.h b/include/world.h index d852a250c..16ea3b417 100644 --- a/include/world.h +++ b/include/world.h @@ -85,15 +85,16 @@ void SV_LinkEdict (struct edict_s *ent, qboolean touch_triggers); // sets ent->v.absmin and ent->v.absmax // if touchtriggers, calls prog functions for the intersected triggers -int SV_PointContents (vec3_t p); -int SV_TruePointContents (vec3_t p); +int SV_PointContents (const vec3_t p); +int SV_TruePointContents (const vec3_t p); // returns the CONTENTS_* value from the world at the given point. // does not check any entities at all // the non-true version remaps the water current contents to content_water struct edict_s *SV_TestEntityPosition (struct edict_s *ent); -trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, struct edict_s *passedict); +trace_t SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs, + const vec3_t end, int type, struct edict_s *passedict); // mins and maxs are reletive // if the entire move stays in a solid volume, trace.allsolid will be set @@ -106,9 +107,11 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, s // passedict is explicitly excluded from clipping checks (normally NULL) -struct edict_s *SV_TestPlayerPosition (struct edict_s *ent, vec3_t origin); +struct edict_s *SV_TestPlayerPosition (struct edict_s *ent, + const vec3_t origin); -int SV_HullPointContents (hull_t *hull, int num, vec3_t p); -hull_t *SV_HullForEntity (struct edict_s *ent, vec3_t mins, vec3_t maxs, vec3_t offset); +int SV_HullPointContents (hull_t *hull, int num, const vec3_t p); +hull_t *SV_HullForEntity (struct edict_s *ent, const vec3_t mins, + const vec3_t maxs, vec3_t offset); #endif // __world_h diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index 3e49bb908..17b493a0a 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -441,7 +441,7 @@ SND_Spatialize (channel_t *ch) // Start a sound effect ======================================================= void -SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, +SND_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, float fvol, float attenuation) { int ch_idx, skip, vol; @@ -582,7 +582,8 @@ SND_ClearBuffer (void) } void -SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) +SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, + float attenuation) { channel_t *ss; sfxcache_t *sc; @@ -677,7 +678,8 @@ SND_UpdateAmbientSounds (void) Called once each time through the main loop */ void -SND_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) +SND_Update (const vec3_t origin, const vec3_t forward, const vec3_t right, + const vec3_t up) { int total, i, j; channel_t *ch, *combine; diff --git a/libs/audio/snd.c b/libs/audio/snd.c index ccbee6dcf..d5c49ca26 100644 --- a/libs/audio/snd.c +++ b/libs/audio/snd.c @@ -173,14 +173,14 @@ S_ClearBuffer (void) } void -S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) +S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, float attenuation) { if (snd_render_module) snd_render_module->functions->snd_render->pS_StaticSound (sfx, origin, vol, attenuation); } void -S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, +S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, float fvol, float attenuation) { if (snd_render_module) @@ -214,7 +214,8 @@ S_ClearPrecache (void) } void -S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up) +S_Update (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right, + const vec3_t v_up) { if (snd_render_module) snd_render_module->functions->snd_render->pS_Update (origin, v_forward, diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index f65cd51e0..3f48fb709 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -62,7 +62,7 @@ cvar_t *gl_sky_divide; mleaf_t * -Mod_PointInLeaf (vec3_t p, model_t *model) +Mod_PointInLeaf (const vec3_t p, model_t *model) { mnode_t *node; float d; @@ -820,14 +820,13 @@ Mod_LoadPlanes (lump_t *l) } float -RadiusFromBounds (vec3_t mins, vec3_t maxs) +RadiusFromBounds (const vec3_t mins, const vec3_t maxs) { int i; vec3_t corner; for (i = 0; i < 3; i++) { - corner[i] = - fabs (mins[i]) > fabs (maxs[i]) ? fabs (mins[i]) : fabs (maxs[i]); + corner[i] = max (fabs (mins[i]), fabs (maxs[i])); } return Length (corner); diff --git a/libs/util/mathlib.c b/libs/util/mathlib.c index 87cf5e2f5..f5cfe04c6 100644 --- a/libs/util/mathlib.c +++ b/libs/util/mathlib.c @@ -47,7 +47,7 @@ static const char rcsid[] = int nanmask = 255 << 23; mplane_t frustum[4]; -vec3_t vec3_origin = { 0, 0, 0 }; +const vec3_t vec3_origin = { 0, 0, 0 }; #define DEG2RAD(a) (a * (M_PI / 180.0)) @@ -210,7 +210,7 @@ BOPS_Error (void) Returns 1, 2, or 1 + 2 */ int -BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) +BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs, mplane_t *p) { float dist1, dist2; int sides; @@ -323,7 +323,7 @@ BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) #endif void -AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) +AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) { float angle, sr, sp, sy, cr, cp, cy; @@ -349,7 +349,7 @@ AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) } int -_VectorCompare (vec3_t v1, vec3_t v2) +_VectorCompare (const vec3_t v1, const vec3_t v2) { int i; @@ -361,7 +361,7 @@ _VectorCompare (vec3_t v1, vec3_t v2) } void -_VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc) +_VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc) { vecc[0] = veca[0] + scale * vecb[0]; vecc[1] = veca[1] + scale * vecb[1]; @@ -369,13 +369,13 @@ _VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc) } vec_t -_DotProduct (vec3_t v1, vec3_t v2) +_DotProduct (const vec3_t v1, const vec3_t v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } void -_VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out) +_VectorSubtract (const vec3_t veca, const vec3_t vecb, vec3_t out) { out[0] = veca[0] - vecb[0]; out[1] = veca[1] - vecb[1]; @@ -383,7 +383,7 @@ _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out) } void -_VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out) +_VectorAdd (const vec3_t veca, const vec3_t vecb, vec3_t out) { out[0] = veca[0] + vecb[0]; out[1] = veca[1] + vecb[1]; @@ -391,7 +391,7 @@ _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out) } void -_VectorCopy (vec3_t in, vec3_t out) +_VectorCopy (const vec3_t in, vec3_t out) { out[0] = in[0]; out[1] = in[1]; @@ -407,7 +407,7 @@ CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross) } vec_t -_Length (vec3_t v) +_Length (const vec3_t v) { float length; @@ -444,7 +444,7 @@ VectorInverse (vec3_t v) } void -_VectorScale (vec3_t in, vec_t scale, vec3_t out) +_VectorScale (const vec3_t in, vec_t scale, vec3_t out) { out[0] = in[0] * scale; out[1] = in[1] * scale; diff --git a/libs/util/msg.c b/libs/util/msg.c index 5958a1252..9ccaee4c7 100644 --- a/libs/util/msg.c +++ b/libs/util/msg.c @@ -121,7 +121,7 @@ MSG_WriteCoord (sizebuf_t *sb, float coord) } void -MSG_WriteCoordV (sizebuf_t *sb, vec3_t coord) +MSG_WriteCoordV (sizebuf_t *sb, const vec3_t coord) { int i; @@ -130,7 +130,7 @@ MSG_WriteCoordV (sizebuf_t *sb, vec3_t coord) } void -MSG_WriteCoordAngleV (sizebuf_t *sb, vec3_t coord, vec3_t angles) +MSG_WriteCoordAngleV (sizebuf_t *sb, const vec3_t coord, const vec3_t angles) { int i; @@ -147,7 +147,7 @@ MSG_WriteAngle (sizebuf_t *sb, float angle) } void -MSG_WriteAngleV (sizebuf_t *sb, vec3_t angles) +MSG_WriteAngleV (sizebuf_t *sb, const vec3_t angles) { int i; diff --git a/libs/video/renderer/gl/gl_dyn_part.c b/libs/video/renderer/gl/gl_dyn_part.c index 32af95764..4e0610d6e 100644 --- a/libs/video/renderer/gl/gl_dyn_part.c +++ b/libs/video/renderer/gl/gl_dyn_part.c @@ -69,8 +69,8 @@ varray_t2f_c4ub_v3f_t *particleVertexArray; inline static void -particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel, - float die, byte color, byte alpha) +particle_new (ptype_t type, int texnum, const vec3_t org, float scale, + const vec3_t vel, float die, byte color, byte alpha) { particle_t *part; @@ -94,7 +94,7 @@ particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel, } inline static void -particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz, +particle_new_random (ptype_t type, int texnum, const vec3_t org, int org_fuzz, float scale, int vel_fuzz, float die, byte color, byte alpha) { @@ -200,7 +200,7 @@ R_ReadPointFile_f (void) } void -R_ParticleExplosion_QF (vec3_t org) +R_ParticleExplosion_QF (const vec3_t org) { /* R_NewExplosion (org); @@ -213,7 +213,7 @@ R_ParticleExplosion_QF (vec3_t org) } void -R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength) +R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) { int i; int colorMod = 0, j = 512; @@ -232,7 +232,7 @@ R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength) } void -R_BlobExplosion_QF (vec3_t org) +R_BlobExplosion_QF (const vec3_t org) { int i; int j = 1024; @@ -255,7 +255,7 @@ R_BlobExplosion_QF (vec3_t org) } static inline void -R_RunSparkEffect_QF (vec3_t org, int count, int ofuzz) +R_RunSparkEffect_QF (const vec3_t org, int count, int ofuzz) { if (numparticles >= r_maxparticles) return; @@ -272,7 +272,7 @@ R_RunSparkEffect_QF (vec3_t org, int count, int ofuzz) } static inline void -R_BloodPuff_QF (vec3_t org, int count) +R_BloodPuff_QF (const vec3_t org, int count) { if (numparticles >= r_maxparticles) return; @@ -282,13 +282,13 @@ R_BloodPuff_QF (vec3_t org, int count) } void -R_BloodPuffEffect_QF (vec3_t org, int count) +R_BloodPuffEffect_QF (const vec3_t org, int count) { R_BloodPuff_QF (org, count); } void -R_GunshotEffect_QF (vec3_t org, int count) +R_GunshotEffect_QF (const vec3_t org, int count) { int scale = 16; @@ -298,7 +298,7 @@ R_GunshotEffect_QF (vec3_t org, int count) } void -R_LightningBloodEffect_QF (vec3_t org) +R_LightningBloodEffect_QF (const vec3_t org) { int count = 7; @@ -317,9 +317,13 @@ R_LightningBloodEffect_QF (vec3_t org) } void -R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count) +R_RunParticleEffect_QF (const vec3_t _org, const vec3_t dir, int color, + int count) { int i, j; + vec3_t org; + + VectorCopy (_org, org); if (numparticles >= r_maxparticles) return; @@ -337,19 +341,19 @@ R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count) } void -R_SpikeEffect_QF (vec3_t org) +R_SpikeEffect_QF (const vec3_t org) { R_RunSparkEffect_QF (org, 5, 8); } void -R_SuperSpikeEffect_QF (vec3_t org) +R_SuperSpikeEffect_QF (const vec3_t org) { R_RunSparkEffect_QF (org, 10, 8); } void -R_KnightSpikeEffect_QF (vec3_t org) +R_KnightSpikeEffect_QF (const vec3_t org) { int count = 10; @@ -366,7 +370,7 @@ R_KnightSpikeEffect_QF (vec3_t org) } void -R_WizSpikeEffect_QF (vec3_t org) +R_WizSpikeEffect_QF (const vec3_t org) { int count = 15; @@ -383,7 +387,7 @@ R_WizSpikeEffect_QF (vec3_t org) } void -R_LavaSplash_QF (vec3_t org) +R_LavaSplash_QF (const vec3_t org) { float vel; int rnd, i, j; @@ -419,7 +423,7 @@ R_LavaSplash_QF (vec3_t org) } void -R_TeleportSplash_QF (vec3_t org) +R_TeleportSplash_QF (const vec3_t org) { float vel; int rnd, i, j, k; @@ -725,7 +729,7 @@ R_VoorTrail_QF (entity_t *ent) } void -R_ParticleExplosion_EE (vec3_t org) +R_ParticleExplosion_EE (const vec3_t org) { /* R_NewExplosion (org); @@ -738,7 +742,7 @@ R_ParticleExplosion_EE (vec3_t org) } void -R_TeleportSplash_EE (vec3_t org) +R_TeleportSplash_EE (const vec3_t org) { float vel; int rnd, i, j, k; @@ -846,7 +850,7 @@ R_GrenadeTrail_EE (entity_t *ent) } void -R_ParticleExplosion_ID (vec3_t org) +R_ParticleExplosion_ID (const vec3_t org) { int i; int j = 1024; diff --git a/libs/video/renderer/r_light.c b/libs/video/renderer/r_light.c index 1047c55c0..6f3060724 100644 --- a/libs/video/renderer/r_light.c +++ b/libs/video/renderer/r_light.c @@ -93,7 +93,7 @@ R_AnimateLight (void) // LordHavoc: heavily modified, to eliminate unnecessary texture uploads, // and support bmodel lighting better void -R_RecursiveMarkLights (vec3_t lightorigin, dlight_t *light, int bit, +R_RecursiveMarkLights (const vec3_t lightorigin, dlight_t *light, int bit, mnode_t *node) { int i; @@ -183,7 +183,8 @@ loc0: } static inline void -mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light, int bit) +mark_surfaces (msurface_t *surf, const vec3_t lightorigin, dlight_t *light, + int bit) { float dist; float dist2, d; @@ -238,7 +239,8 @@ mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light, int bit) } void -R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, model_t *model) +R_MarkLights (const vec3_t lightorigin, dlight_t *light, int bit, + model_t *model) { mleaf_t *pvsleaf = Mod_PointInLeaf (lightorigin, model); @@ -292,7 +294,7 @@ R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, model_t *model) } void -R_PushDlights (vec3_t entorigin) +R_PushDlights (const vec3_t entorigin) { int i; dlight_t *l; @@ -317,7 +319,7 @@ mplane_t *lightplane; vec3_t lightspot; int -RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) +RecursiveLightPoint (mnode_t *node, const vec3_t start, const vec3_t end) { int i, r, s, t, ds, dt, maps, side; unsigned int scale; @@ -409,7 +411,7 @@ loop: } int -R_LightPoint (vec3_t p) +R_LightPoint (const vec3_t p) { vec3_t end; int r; diff --git a/libs/video/renderer/sw/sw_rmisc.c b/libs/video/renderer/sw/sw_rmisc.c index 867c765d1..45a6354da 100644 --- a/libs/video/renderer/sw/sw_rmisc.c +++ b/libs/video/renderer/sw/sw_rmisc.c @@ -206,7 +206,7 @@ R_TransformFrustum (void) #ifndef USE_INTEL_ASM void -TransformVector (vec3_t in, vec3_t out) +TransformVector (const vec3_t in, vec3_t out) { out[0] = DotProduct (in, vright); out[1] = DotProduct (in, vup); diff --git a/libs/video/renderer/sw/sw_rpart.c b/libs/video/renderer/sw/sw_rpart.c index 61200105b..26fa5a8ad 100644 --- a/libs/video/renderer/sw/sw_rpart.c +++ b/libs/video/renderer/sw/sw_rpart.c @@ -118,7 +118,7 @@ R_ReadPointFile_f (void) } void -R_ParticleExplosion_QF (vec3_t org) +R_ParticleExplosion_QF (const vec3_t org) { int i, j; particle_t *p; @@ -154,7 +154,7 @@ R_ParticleExplosion_QF (vec3_t org) } void -R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength) +R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) { int i, j; particle_t *p; @@ -183,7 +183,7 @@ R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength) } void -R_BlobExplosion_QF (vec3_t org) +R_BlobExplosion_QF (const vec3_t org) { int i, j; particle_t *p; @@ -220,7 +220,8 @@ R_BlobExplosion_QF (vec3_t org) } void -R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count) +R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, + int count) { int i, j; particle_t *p; @@ -247,49 +248,49 @@ R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count) } void -R_SpikeEffect_QF (vec3_t org) +R_SpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 0, 10); } void -R_SuperSpikeEffect_QF (vec3_t org) +R_SuperSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect (org, vec3_origin, 0, 20); } void -R_KnightSpikeEffect_QF (vec3_t org) +R_KnightSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 226, 20); } void -R_WizSpikeEffect_QF (vec3_t org) +R_WizSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 20, 30); } void -R_BloodPuffEffect_QF (vec3_t org, int count) +R_BloodPuffEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 73, count); } void -R_GunshotEffect_QF (vec3_t org, int count) +R_GunshotEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 0, count); } void -R_LightningBloodEffect_QF (vec3_t org) +R_LightningBloodEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 225, 50); } void -R_LavaSplash_QF (vec3_t org) +R_LavaSplash_QF (const vec3_t org) { int i, j, k; particle_t *p; @@ -328,7 +329,7 @@ R_LavaSplash_QF (vec3_t org) } void -R_TeleportSplash_QF (vec3_t org) +R_TeleportSplash_QF (const vec3_t org) { int i, j, k; particle_t *p; diff --git a/libs/video/renderer/sw32/sw32_rmisc.c b/libs/video/renderer/sw32/sw32_rmisc.c index 7108fbcc8..b06a81468 100644 --- a/libs/video/renderer/sw32/sw32_rmisc.c +++ b/libs/video/renderer/sw32/sw32_rmisc.c @@ -201,7 +201,7 @@ R_TransformFrustum (void) } void -TransformVector (vec3_t in, vec3_t out) +TransformVector (const vec3_t in, vec3_t out) { out[0] = DotProduct (in, vright); out[1] = DotProduct (in, vup); diff --git a/libs/video/renderer/sw32/sw32_rpart.c b/libs/video/renderer/sw32/sw32_rpart.c index b719a132a..44e0345a3 100644 --- a/libs/video/renderer/sw32/sw32_rpart.c +++ b/libs/video/renderer/sw32/sw32_rpart.c @@ -118,7 +118,7 @@ R_ReadPointFile_f (void) } void -R_ParticleExplosion_QF (vec3_t org) +R_ParticleExplosion_QF (const vec3_t org) { int i, j; particle_t *p; @@ -154,7 +154,7 @@ R_ParticleExplosion_QF (vec3_t org) } void -R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength) +R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) { int i, j; particle_t *p; @@ -183,7 +183,7 @@ R_ParticleExplosion2_QF (vec3_t org, int colorStart, int colorLength) } void -R_BlobExplosion_QF (vec3_t org) +R_BlobExplosion_QF (const vec3_t org) { int i, j; particle_t *p; @@ -220,7 +220,7 @@ R_BlobExplosion_QF (vec3_t org) } void -R_LavaSplash_QF (vec3_t org) +R_LavaSplash_QF (const vec3_t org) { int i, j, k; particle_t *p; @@ -259,7 +259,7 @@ R_LavaSplash_QF (vec3_t org) } void -R_TeleportSplash_QF (vec3_t org) +R_TeleportSplash_QF (const vec3_t org) { float vel; int i, j, k; @@ -298,7 +298,8 @@ R_TeleportSplash_QF (vec3_t org) } void -R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count) +R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, + int count) { int i, j; particle_t *p; @@ -325,43 +326,43 @@ R_RunParticleEffect_QF (vec3_t org, vec3_t dir, int color, int count) } void -R_SpikeEffect_QF (vec3_t org) +R_SpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 0, 10); } void -R_SuperSpikeEffect_QF (vec3_t org) +R_SuperSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect (org, vec3_origin, 0, 20); } void -R_KnightSpikeEffect_QF (vec3_t org) +R_KnightSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 226, 20); } void -R_WizSpikeEffect_QF (vec3_t org) +R_WizSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 20, 30); } void -R_BloodPuffEffect_QF (vec3_t org, int count) +R_BloodPuffEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 73, count); } void -R_GunshotEffect_QF (vec3_t org, int count) +R_GunshotEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 0, count); } void -R_LightningBloodEffect_QF (vec3_t org) +R_LightningBloodEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 225, 50); } diff --git a/nq/include/server.h b/nq/include/server.h index e260a7ded..475a94dd6 100644 --- a/nq/include/server.h +++ b/nq/include/server.h @@ -231,9 +231,10 @@ extern edict_t *sv_player; void SV_Init (void); void SV_PR_Cmds_Init (void); -void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count); -void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, - float attenuation); +void SV_StartParticle (const vec3_t org, const vec3_t dir, int color, + int count); +void SV_StartSound (edict_t *entity, int channel, const char *sample, + int volume, float attenuation); void SV_DropClient (qboolean crash); @@ -255,7 +256,7 @@ void SV_BroadcastPrintf (const char *fmt, ...) __attribute__((format(printf,1,2) void SV_Physics (void); qboolean SV_CheckBottom (edict_t *ent); -qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink); +qboolean SV_movestep (edict_t *ent, const vec3_t move, qboolean relink); void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg); diff --git a/nq/source/locs.c b/nq/source/locs.c index 56908c01b..87f593921 100644 --- a/nq/source/locs.c +++ b/nq/source/locs.c @@ -55,13 +55,10 @@ int locations_alloced = 0; int locations_count = 0; int location_blocks = 0; -void locs_add (vec3_t location, const char *name); -void locs_load (const char *filename); -void locs_free (void); void locs_more (void); int -locs_nearest (vec3_t loc) +locs_nearest (const vec3_t loc) { location_t *cur; float best_distance = 9999999, distance; @@ -79,7 +76,7 @@ locs_nearest (vec3_t loc) } location_t * -locs_find (vec3_t target) +locs_find (const vec3_t target) { int i; i = locs_nearest(target); @@ -89,7 +86,7 @@ locs_find (vec3_t target) } void -locs_add (vec3_t location, const char *name) +locs_add (const vec3_t location, const char *name) { int num; @@ -221,7 +218,7 @@ locs_save (const char *filename, qboolean gz) } void -locs_mark (vec3_t loc, const char *desc) +locs_mark (const vec3_t loc, const char *desc) { locs_add (loc,desc); Con_Printf ("Marked current location: %s\n",desc); @@ -234,7 +231,7 @@ locs_mark (vec3_t loc, const char *desc) */ void -locs_edit (vec3_t loc, const char *desc) +locs_edit (const vec3_t loc, const char *desc) { int i; if (locations_count) { @@ -254,7 +251,7 @@ locs_edit (vec3_t loc, const char *desc) } void -locs_del (vec3_t loc) +locs_del (const vec3_t loc) { int i; if (locations_count) { diff --git a/nq/source/pr_cmds.c b/nq/source/pr_cmds.c index 0b239975d..fb52a387f 100644 --- a/nq/source/pr_cmds.c +++ b/nq/source/pr_cmds.c @@ -141,7 +141,7 @@ PF_setorigin (progs_t *pr) void -SetMinMaxSize (progs_t *pr, edict_t *e, float *min, float *max, +SetMinMaxSize (progs_t *pr, edict_t *e, const vec3_t min, const vec3_t max, qboolean rotate) { float *angles; diff --git a/nq/source/sv_ded.c b/nq/source/sv_ded.c index f977dbef4..42bec4d8c 100644 --- a/nq/source/sv_ded.c +++ b/nq/source/sv_ded.c @@ -261,7 +261,8 @@ S_Shutdown (void) } void -S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up) +S_Update (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right, + const vec3_t v_up) { } diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 5431f7557..a5b16a31b 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -84,7 +84,7 @@ SV_Init (void) Make sure the event gets sent to all clients */ void -SV_StartParticle (vec3_t org, vec3_t dir, int color, int count) +SV_StartParticle (const vec3_t org, const vec3_t dir, int color, int count) { int i, v; diff --git a/nq/source/sv_move.c b/nq/source/sv_move.c index 149795019..ca225db93 100644 --- a/nq/source/sv_move.c +++ b/nq/source/sv_move.c @@ -116,7 +116,7 @@ SV_CheckBottom (edict_t *ent) pr_global_struct->trace_normal is set to the normal of the blocking wall */ qboolean -SV_movestep (edict_t *ent, vec3_t move, qboolean relink) +SV_movestep (edict_t *ent, const vec3_t move, qboolean relink) { int i; float dz; diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index ffc695917..48df396b5 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -585,7 +585,7 @@ SV_RunClients (void) Used by view and sv_user */ float -V_CalcRoll (vec3_t angles, vec3_t velocity) +V_CalcRoll (const vec3_t angles, const vec3_t velocity) { float side, sign, value; diff --git a/nq/source/world.c b/nq/source/world.c index 1ed194f54..e2afed12f 100644 --- a/nq/source/world.c +++ b/nq/source/world.c @@ -57,17 +57,15 @@ static const char rcsid[] = typedef struct { vec3_t boxmins, boxmaxs; // enclose the test object along // entire move - float *mins, *maxs; // size of the moving object + const float *mins, *maxs; // size of the moving object vec3_t mins2, maxs2; // size when clipping against // monsters - float *start, *end; + const float *start, *end; trace_t trace; int type; edict_t *passedict; } moveclip_t; -int SV_HullPointContents (hull_t *hull, int num, vec3_t p); - /* HULL BOXES */ static hull_t box_hull; @@ -120,7 +118,7 @@ SV_InitBoxHull (void) BSP trees instead of being compared directly. */ hull_t * -SV_HullForBox (vec3_t mins, vec3_t maxs) +SV_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; box_planes[1].dist = mins[0]; @@ -141,7 +139,8 @@ SV_HullForBox (vec3_t mins, vec3_t maxs) the returned hull. */ hull_t * -SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset) +SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, + vec3_t offset) { hull_t *hull = 0; int hull_index = 0; @@ -199,7 +198,7 @@ areanode_t sv_areanodes[AREA_NODES]; int sv_numareanodes; areanode_t * -SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs) +SV_CreateAreaNode (int depth, const vec3_t mins, const vec3_t maxs) { areanode_t *anode; vec3_t mins1, maxs1, mins2, maxs2, size; @@ -413,7 +412,7 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers) #ifndef USE_INTEL_ASM int -SV_HullPointContents (hull_t *hull, int num, vec3_t p) +SV_HullPointContents (hull_t *hull, int num, const vec3_t p) { dclipnode_t *node; float d; @@ -441,7 +440,7 @@ SV_HullPointContents (hull_t *hull, int num, vec3_t p) #endif // !USE_INTEL_ASM int -SV_PointContents (vec3_t p) +SV_PointContents (const vec3_t p) { int cont; @@ -452,7 +451,7 @@ SV_PointContents (vec3_t p) } int -SV_TruePointContents (vec3_t p) +SV_TruePointContents (const vec3_t p) { return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p); } @@ -486,8 +485,8 @@ SV_TestEntityPosition (edict_t *ent) #define DIST_EPSILON (0.03125) qboolean -SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, - vec3_t p2, trace_t *trace) +SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, + const vec3_t p1, const vec3_t p2, trace_t *trace) { dclipnode_t *node; float frac, midf, t1, t2; @@ -603,8 +602,8 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, eventually rotation) of the end points */ trace_t -SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start, - vec3_t mins, vec3_t maxs, vec3_t end) +SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, const vec3_t start, + const vec3_t mins, const vec3_t maxs, const vec3_t end) { hull_t *hull; trace_t trace; @@ -718,8 +717,8 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip) } void -SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, - vec3_t boxmins, vec3_t boxmaxs) +SV_MoveBounds (const vec3_t start, const vec3_t mins, const vec3_t maxs, + const vec3_t end, vec3_t boxmins, vec3_t boxmaxs) { #if 0 // debug to test against everything @@ -741,8 +740,8 @@ SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, } trace_t -SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, - edict_t *passedict) +SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs, + const vec3_t end, int type, edict_t *passedict) { int i; moveclip_t clip; @@ -750,7 +749,8 @@ SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, memset (&clip, 0, sizeof (moveclip_t)); // clip to world - clip.trace = SV_ClipMoveToEntity (sv.edicts, passedict, start, mins, maxs, end); + clip.trace = SV_ClipMoveToEntity (sv.edicts, passedict, start, + mins, maxs, end); clip.start = start; clip.end = end; @@ -781,7 +781,7 @@ SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t * -SV_TestPlayerPosition (edict_t *ent, vec3_t origin) +SV_TestPlayerPosition (edict_t *ent, const vec3_t origin) { edict_t *check; hull_t *hull; diff --git a/qw/include/pmove.h b/qw/include/pmove.h index bb363547d..ee71e5359 100644 --- a/qw/include/pmove.h +++ b/qw/include/pmove.h @@ -117,12 +117,13 @@ void PlayerMove (void); void Pmove_Init (void); void Pmove_Init_Cvars (void); -int PM_HullPointContents (hull_t *hull, int num, vec3_t p); +int PM_HullPointContents (hull_t *hull, int num, const vec3_t p); -int PM_PointContents (vec3_t point); -qboolean PM_TestPlayerPosition (vec3_t point); -pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop); +int PM_PointContents (const vec3_t point); +qboolean PM_TestPlayerPosition (const vec3_t point); +pmtrace_t PM_PlayerMove (const vec3_t start, const vec3_t stop); qboolean PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, - vec3_t p1, vec3_t p2, pmtrace_t *trace); + const vec3_t p1, const vec3_t p2, + pmtrace_t *trace); #endif // _PMOVE_H diff --git a/qw/include/server.h b/qw/include/server.h index 26db73ac8..bffe0c0cf 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -449,7 +449,8 @@ void SV_FullClientUpdate (client_t *client, sizebuf_t *buf); int SV_ModelIndex (const char *name); qboolean SV_CheckBottom (struct edict_s *ent); -qboolean SV_movestep (struct edict_s *ent, vec3_t move, qboolean relink); +qboolean SV_movestep (struct edict_s *ent, const vec3_t move, + qboolean relink); void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg); @@ -497,7 +498,7 @@ void SV_Print (const char *fmt, va_list args); void SV_Printf (const char *fmt, ...) __attribute__((format(printf,1,2))); void SV_SendClientMessages (void); -void SV_Multicast (vec3_t origin, int to); +void SV_Multicast (const vec3_t origin, int to); void SV_StartSound (struct edict_s *entity, int channel, const char *sample, int volume, float attenuation); void SV_ClientPrintf (client_t *cl, int level, const char *fmt, ...) __attribute__((format(printf,3,4))); diff --git a/qw/source/cl_view.c b/qw/source/cl_view.c index 053a355b5..caa173806 100644 --- a/qw/source/cl_view.c +++ b/qw/source/cl_view.c @@ -94,7 +94,7 @@ cshift_t cshift_bonus = { {215, 186, 60}, 50}; float -V_CalcRoll (vec3_t angles, vec3_t velocity) +V_CalcRoll (const vec3_t angles, const vec3_t velocity) { float side, sign, value; vec3_t forward, right, up; diff --git a/qw/source/locs.c b/qw/source/locs.c index 890be2620..5825afa34 100644 --- a/qw/source/locs.c +++ b/qw/source/locs.c @@ -55,14 +55,10 @@ int locations_alloced = 0; int locations_count = 0; int location_blocks = 0; -void locs_add (vec3_t location, const char *name); -void locs_load (const char *filename); -void locs_free (void); void locs_more (void); - int -locs_nearest (vec3_t loc) +locs_nearest (const vec3_t loc) { float best_distance = 9999999, distance; int i, j = -1; @@ -80,7 +76,7 @@ locs_nearest (vec3_t loc) } location_t * -locs_find (vec3_t target) +locs_find (const vec3_t target) { int i; @@ -91,7 +87,7 @@ locs_find (vec3_t target) } void -locs_add (vec3_t location, const char *name) +locs_add (const vec3_t location, const char *name) { int num; @@ -222,7 +218,7 @@ locs_save (const char *filename, qboolean gz) } void -locs_mark (vec3_t loc, const char *desc) +locs_mark (const vec3_t loc, const char *desc) { locs_add (loc,desc); Con_Printf ("Marked current location: %s\n",desc); @@ -235,7 +231,7 @@ locs_mark (vec3_t loc, const char *desc) call with NULL description to modify location vectors */ void -locs_edit (vec3_t loc, const char *desc) +locs_edit (const vec3_t loc, const char *desc) { int i; @@ -256,7 +252,7 @@ locs_edit (vec3_t loc, const char *desc) } void -locs_del (vec3_t loc) +locs_del (const vec3_t loc) { int i; diff --git a/qw/source/pmovetst.c b/qw/source/pmovetst.c index 588557dd1..a232e1d8a 100644 --- a/qw/source/pmovetst.c +++ b/qw/source/pmovetst.c @@ -91,7 +91,7 @@ PM_InitBoxHull (void) BSP trees instead of being compared directly. */ hull_t * -PM_HullForBox (vec3_t mins, vec3_t maxs) +PM_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; box_planes[1].dist = mins[0]; @@ -104,7 +104,7 @@ PM_HullForBox (vec3_t mins, vec3_t maxs) } int -PM_HullPointContents (hull_t *hull, int num, vec3_t p) +PM_HullPointContents (hull_t *hull, int num, const vec3_t p) { dclipnode_t *node; float d; @@ -128,7 +128,7 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p) } int -PM_PointContents (vec3_t p) +PM_PointContents (const vec3_t p) { dclipnode_t *node; float d; @@ -163,8 +163,8 @@ PM_PointContents (vec3_t p) #define DIST_EPSILON (0.03125) qboolean -PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, - vec3_t p2, pmtrace_t *trace) +PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, + const vec3_t p1, const vec3_t p2, pmtrace_t *trace) { dclipnode_t *node; float frac, midf, t1, t2; @@ -282,7 +282,7 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, Returns false if the given player position is not valid (in solid) */ qboolean -PM_TestPlayerPosition (vec3_t pos) +PM_TestPlayerPosition (const vec3_t pos) { hull_t *hull; int i; @@ -311,7 +311,7 @@ PM_TestPlayerPosition (vec3_t pos) /* PM_PlayerMove */ pmtrace_t -PM_PlayerMove (vec3_t start, vec3_t end) +PM_PlayerMove (const vec3_t start, const vec3_t end) { hull_t *hull; int i; diff --git a/qw/source/sv_move.c b/qw/source/sv_move.c index 2ff5150e8..b9359a584 100644 --- a/qw/source/sv_move.c +++ b/qw/source/sv_move.c @@ -122,7 +122,7 @@ SV_CheckBottom (edict_t *ent) pr_global_struct->trace_normal is set to the normal of the blocking wall */ qboolean -SV_movestep (edict_t *ent, vec3_t move, qboolean relink) +SV_movestep (edict_t *ent, const vec3_t move, qboolean relink) { edict_t *enemy; float dz; diff --git a/qw/source/sv_send.c b/qw/source/sv_send.c index 9eabf9c30..a913bb10d 100644 --- a/qw/source/sv_send.c +++ b/qw/source/sv_send.c @@ -326,7 +326,7 @@ SV_BroadcastCommand (const char *fmt, ...) MULTICAST_PHS send to clients potentially hearable from org */ void -SV_Multicast (vec3_t origin, int to) +SV_Multicast (const vec3_t origin, int to) { byte *mask; client_t *client; diff --git a/qw/source/world.c b/qw/source/world.c index fbabf236d..69492dfb0 100644 --- a/qw/source/world.c +++ b/qw/source/world.c @@ -56,17 +56,15 @@ static const char rcsid[] = typedef struct { vec3_t boxmins, boxmaxs; // enclose the test object along // entire move - float *mins, *maxs; // size of the moving object + const float *mins, *maxs; // size of the moving object vec3_t mins2, maxs2; // size when clipping against // monsters - float *start, *end; + const float *start, *end; trace_t trace; int type; edict_t *passedict; } moveclip_t; -int SV_HullPointContents (hull_t *hull, int num, vec3_t p); - /* HULL BOXES */ static hull_t box_hull; @@ -119,7 +117,7 @@ SV_InitBoxHull (void) BSP trees instead of being compared directly. */ hull_t * -SV_HullForBox (vec3_t mins, vec3_t maxs) +SV_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; box_planes[1].dist = mins[0]; @@ -140,7 +138,8 @@ SV_HullForBox (vec3_t mins, vec3_t maxs) the returned hull. */ hull_t * -SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset) +SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, + vec3_t offset) { hull_t *hull = 0; int hull_index = 0; @@ -198,7 +197,7 @@ areanode_t sv_areanodes[AREA_NODES]; int sv_numareanodes; areanode_t * -SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs) +SV_CreateAreaNode (int depth, const vec3_t mins, const vec3_t maxs) { areanode_t *anode; vec3_t mins1, maxs1, mins2, maxs2, size; @@ -412,7 +411,7 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers) #ifndef USE_INTEL_ASM int -SV_HullPointContents (hull_t *hull, int num, vec3_t p) +SV_HullPointContents (hull_t *hull, int num, const vec3_t p) { dclipnode_t *node; float d; @@ -440,7 +439,7 @@ SV_HullPointContents (hull_t *hull, int num, vec3_t p) #endif // !USE_INTEL_ASM int -SV_PointContents (vec3_t p) +SV_PointContents (const vec3_t p) { int cont; @@ -451,7 +450,7 @@ SV_PointContents (vec3_t p) } int -SV_TruePointContents (vec3_t p) +SV_TruePointContents (const vec3_t p) { return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p); } @@ -485,8 +484,8 @@ SV_TestEntityPosition (edict_t *ent) #define DIST_EPSILON (0.03125) qboolean -SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, - vec3_t p2, trace_t *trace) +SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, + const vec3_t p1, const vec3_t p2, trace_t *trace) { dclipnode_t *node; float frac, midf, t1, t2; @@ -602,8 +601,8 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, eventually rotation) of the end points */ trace_t -SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start, - vec3_t mins, vec3_t maxs, vec3_t end) +SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, const vec3_t start, + const vec3_t mins, const vec3_t maxs, const vec3_t end) { hull_t *hull; trace_t trace; @@ -717,8 +716,8 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip) } void -SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, - vec3_t boxmins, vec3_t boxmaxs) +SV_MoveBounds (const vec3_t start, const vec3_t mins, const vec3_t maxs, + const vec3_t end, vec3_t boxmins, vec3_t boxmaxs) { #if 0 // debug to test against everything @@ -740,8 +739,8 @@ SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, } trace_t -SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, - edict_t *passedict) +SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs, + const vec3_t end, int type, edict_t *passedict) { int i; moveclip_t clip; @@ -780,7 +779,7 @@ SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t * -SV_TestPlayerPosition (edict_t *ent, vec3_t origin) +SV_TestPlayerPosition (edict_t *ent, const vec3_t origin) { edict_t *check; hull_t *hull;