Lots of const correctness.

This commit is contained in:
Bill Currie 2010-09-02 13:01:45 +09:00
parent f4bff1d3b0
commit ef7958d680
19 changed files with 121 additions and 120 deletions

View file

@ -314,20 +314,20 @@ bsp_t *LoadBSPFile (QFile *file, size_t size);
void WriteBSPFile (const bsp_t *bsp, QFile *file); void WriteBSPFile (const bsp_t *bsp, QFile *file);
bsp_t *BSP_New (void); bsp_t *BSP_New (void);
void BSP_Free (bsp_t *bsp); void BSP_Free (bsp_t *bsp);
void BSP_AddPlane (bsp_t *bsp, dplane_t *plane); void BSP_AddPlane (bsp_t *bsp, const dplane_t *plane);
void BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf); void BSP_AddLeaf (bsp_t *bsp, const dleaf_t *leaf);
void BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex); void BSP_AddVertex (bsp_t *bsp, const dvertex_t *vertex);
void BSP_AddNode (bsp_t *bsp, dnode_t *node); void BSP_AddNode (bsp_t *bsp, const dnode_t *node);
void BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo); void BSP_AddTexinfo (bsp_t *bsp, const texinfo_t *texinfo);
void BSP_AddFace (bsp_t *bsp, dface_t *face); void BSP_AddFace (bsp_t *bsp, const dface_t *face);
void BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode); void BSP_AddClipnode (bsp_t *bsp, const dclipnode_t *clipnode);
void BSP_AddMarkSurface (bsp_t *bsp, int marksurface); void BSP_AddMarkSurface (bsp_t *bsp, int marksurface);
void BSP_AddSurfEdge (bsp_t *bsp, int surfedge); void BSP_AddSurfEdge (bsp_t *bsp, int surfedge);
void BSP_AddEdge (bsp_t *bsp, dedge_t *edge); void BSP_AddEdge (bsp_t *bsp, const dedge_t *edge);
void BSP_AddModel (bsp_t *bsp, dmodel_t *model); void BSP_AddModel (bsp_t *bsp, const dmodel_t *model);
void BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize); void BSP_AddLighting (bsp_t *bsp, const byte *lightdata, size_t lightdatasize);
void BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize); void BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize);
void BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize); void BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize);
void BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize); void BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize);
#endif//__bspfile_h_ #endif//__bspfile_h_

View file

@ -402,49 +402,49 @@ BSP_Free (bsp_t *bsp)
} while (0) } while (0)
VISIBLE void VISIBLE void
BSP_AddPlane (bsp_t *bsp, dplane_t *plane) BSP_AddPlane (bsp_t *bsp, const dplane_t *plane)
{ {
REALLOC (planes); REALLOC (planes);
bsp->planes[bsp->numplanes++] = *plane; bsp->planes[bsp->numplanes++] = *plane;
} }
VISIBLE void VISIBLE void
BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf) BSP_AddLeaf (bsp_t *bsp, const dleaf_t *leaf)
{ {
REALLOC (leafs); REALLOC (leafs);
bsp->leafs[bsp->numleafs++] = *leaf; bsp->leafs[bsp->numleafs++] = *leaf;
} }
VISIBLE void VISIBLE void
BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex) BSP_AddVertex (bsp_t *bsp, const dvertex_t *vertex)
{ {
REALLOC (vertexes); REALLOC (vertexes);
bsp->vertexes[bsp->numvertexes++] = *vertex; bsp->vertexes[bsp->numvertexes++] = *vertex;
} }
VISIBLE void VISIBLE void
BSP_AddNode (bsp_t *bsp, dnode_t *node) BSP_AddNode (bsp_t *bsp, const dnode_t *node)
{ {
REALLOC (nodes); REALLOC (nodes);
bsp->nodes[bsp->numnodes++] = *node; bsp->nodes[bsp->numnodes++] = *node;
} }
VISIBLE void VISIBLE void
BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo) BSP_AddTexinfo (bsp_t *bsp, const texinfo_t *texinfo)
{ {
REALLOC (texinfo); REALLOC (texinfo);
bsp->texinfo[bsp->numtexinfo++] = *texinfo; bsp->texinfo[bsp->numtexinfo++] = *texinfo;
} }
VISIBLE void VISIBLE void
BSP_AddFace (bsp_t *bsp, dface_t *face) BSP_AddFace (bsp_t *bsp, const dface_t *face)
{ {
REALLOC (faces); REALLOC (faces);
bsp->faces[bsp->numfaces++] = *face; bsp->faces[bsp->numfaces++] = *face;
} }
VISIBLE void VISIBLE void
BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode) BSP_AddClipnode (bsp_t *bsp, const dclipnode_t *clipnode)
{ {
REALLOC (clipnodes); REALLOC (clipnodes);
bsp->clipnodes[bsp->numclipnodes++] = *clipnode; bsp->clipnodes[bsp->numclipnodes++] = *clipnode;
@ -465,14 +465,14 @@ BSP_AddSurfEdge (bsp_t *bsp, int surfedge)
} }
VISIBLE void VISIBLE void
BSP_AddEdge (bsp_t *bsp, dedge_t *edge) BSP_AddEdge (bsp_t *bsp, const dedge_t *edge)
{ {
REALLOC (edges); REALLOC (edges);
bsp->edges[bsp->numedges++] = *edge; bsp->edges[bsp->numedges++] = *edge;
} }
VISIBLE void VISIBLE void
BSP_AddModel (bsp_t *bsp, dmodel_t *model) BSP_AddModel (bsp_t *bsp, const dmodel_t *model)
{ {
REALLOC (models); REALLOC (models);
bsp->models[bsp->nummodels++] = *model; bsp->models[bsp->nummodels++] = *model;
@ -485,7 +485,7 @@ BSP_AddModel (bsp_t *bsp, dmodel_t *model)
} while (0) } while (0)
VISIBLE void VISIBLE void
BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize) BSP_AddLighting (bsp_t *bsp, const byte *lightdata, size_t lightdatasize)
{ {
OWN (lightdata); OWN (lightdata);
bsp->lightdatasize = lightdatasize; bsp->lightdatasize = lightdatasize;
@ -494,7 +494,7 @@ BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize)
} }
VISIBLE void VISIBLE void
BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize) BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize)
{ {
OWN (visdata); OWN (visdata);
bsp->visdatasize = visdatasize; bsp->visdatasize = visdatasize;
@ -503,7 +503,7 @@ BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize)
} }
VISIBLE void VISIBLE void
BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize) BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize)
{ {
OWN (entdata); OWN (entdata);
bsp->entdatasize = entdatasize; bsp->entdatasize = entdatasize;
@ -512,7 +512,7 @@ BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize)
} }
VISIBLE void VISIBLE void
BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize) BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize)
{ {
OWN (texdata); OWN (texdata);
bsp->texdatasize = texdatasize; bsp->texdatasize = texdatasize;

View file

@ -77,7 +77,7 @@ int PlaneTypeForNormal (const vec3_t normal);
\param side The side of the plane that will be front. \param side The side of the plane that will be front.
\return global plane number. \return global plane number.
*/ */
int FindPlane (plane_t *dplane, int *side); int FindPlane (const plane_t *dplane, int *side);
//@} //@}

View file

@ -37,22 +37,22 @@ struct brush_s;
struct winding_s; struct winding_s;
void Draw_ClearBounds (void); void Draw_ClearBounds (void);
void Draw_AddToBounds (vec3_t v); void Draw_AddToBounds (const vec3_t v);
void Draw_DrawFace (struct visfacet_s *f); void Draw_DrawFace (const struct visfacet_s *f);
void Draw_ClearWindow (void); void Draw_ClearWindow (void);
void Draw_SetRed (void); void Draw_SetRed (void);
void Draw_SetGrey (void); void Draw_SetGrey (void);
void Draw_SetBlack (void); void Draw_SetBlack (void);
void DrawPoint (vec3_t v); void DrawPoint (const vec3_t v);
void Draw_SetColor (int c); void Draw_SetColor (int c);
void SetColor (int c); void SetColor (int c);
void DrawPortal (struct portal_s *p); void DrawPortal (const struct portal_s *p);
void DrawLeaf (struct node_s *l, int color); void DrawLeaf (const struct node_s *l, int color);
void DrawBrush (struct brush_s *b); void DrawBrush (const struct brush_s *b);
void DrawWinding (struct winding_s *w); void DrawWinding (const struct winding_s *w);
void DrawTri (vec3_t p1, vec3_t p2, vec3_t p3); void DrawTri (const vec3_t p1, const vec3_t p2, const vec3_t p3);
//@} //@}

View file

@ -89,7 +89,7 @@ int FindMiptex (const char *name);
\param ent The entity to dump. \param ent The entity to dump.
*/ */
void PrintEntity (entity_t *ent); void PrintEntity (const entity_t *ent);
/** Get the value for the specified key from an entity. /** Get the value for the specified key from an entity.
@ -98,7 +98,7 @@ void PrintEntity (entity_t *ent);
\return The value for the key, or the empty string if the key \return The value for the key, or the empty string if the key
does not exist in this entity. does not exist in this entity.
*/ */
const char *ValueForKey (entity_t *ent, const char *key); const char *ValueForKey (const entity_t *ent, const char *key);
/** Set the value of the entity's key. /** Set the value of the entity's key.
If the key does not exist, one will be added. If the key does not exist, one will be added.
@ -114,7 +114,7 @@ void SetKeyValue (entity_t *ent, const char *key, const char *value);
\param key The key of wich to parse the vector value. \param key The key of wich to parse the vector value.
\param vec The destination of the vector value. \param vec The destination of the vector value.
*/ */
void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); void GetVectorForKey (const entity_t *ent, const char *key, vec3_t vec);
/** Write all valid entities to the bsp file. /** Write all valid entities to the bsp file.

View file

@ -45,7 +45,7 @@ typedef struct winding_s {
\return The new winding. \return The new winding.
\note It is the caller's responsibiltiy to free the new winding. \note It is the caller's responsibiltiy to free the new winding.
*/ */
winding_t *BaseWindingForPlane (struct plane_s *p); winding_t *BaseWindingForPlane (const struct plane_s *p);
/** Create a new, empty winding with. /** Create a new, empty winding with.
@ -67,7 +67,7 @@ void FreeWinding (winding_t *w);
\return The new winding. \return The new winding.
\note It is the caller's responsibiltiy to free the new winding. \note It is the caller's responsibiltiy to free the new winding.
*/ */
winding_t *CopyWinding (winding_t *w); winding_t *CopyWinding (const winding_t *w);
/** Create a new winding with the reverse points of the given winding. /** Create a new winding with the reverse points of the given winding.
@ -75,7 +75,7 @@ winding_t *CopyWinding (winding_t *w);
\return The new winding. \return The new winding.
\note It is the caller's responsibiltiy to free the new winding. \note It is the caller's responsibiltiy to free the new winding.
*/ */
winding_t *CopyWindingReverse (winding_t *w); winding_t *CopyWindingReverse (const winding_t *w);
/** Clip the winding to the plain. /** Clip the winding to the plain.

View file

@ -48,7 +48,7 @@ void WriteClipNodes (struct node_s *headnode);
\param headnode The root of the map bsp. \param headnode The root of the map bsp.
*/ */
void WriteDrawNodes (struct node_s *headnode); void WriteDrawNodes (const struct node_s *headnode);
/** Write the model information for the clipping hull. /** Write the model information for the clipping hull.
@ -64,7 +64,7 @@ void BumpModel (int hullnum);
\param p The plane to add to the bsp. \param p The plane to add to the bsp.
\return The plane number within the bsp. \return The plane number within the bsp.
*/ */
int FindFinalPlane (dplane_t *p); int FindFinalPlane (const dplane_t *p);
/** Prepare the bsp file for writing. /** Prepare the bsp file for writing.

View file

@ -67,7 +67,7 @@ AllocBrush (void)
Note: this will not catch 0 area polygons Note: this will not catch 0 area polygons
*/ */
static void static void
CheckFace (face_t *f) CheckFace (const face_t *f)
{ {
int i, j; int i, j;
vec_t *p1, *p2; vec_t *p1, *p2;
@ -91,8 +91,7 @@ CheckFace (face_t *f)
j = i + 1 == f->points->numpoints ? 0 : i + 1; j = i + 1 == f->points->numpoints ? 0 : i + 1;
// check the point is on the face plane // check the point is on the face plane
d = DotProduct (p1, planes[f->planenum].normal) d = PlaneDiff (p1, &planes[f->planenum]);
- planes[f->planenum].dist;
// point off plane autofix // point off plane autofix
if (d < -ON_EPSILON || d > ON_EPSILON) if (d < -ON_EPSILON || d > ON_EPSILON)
@ -137,7 +136,7 @@ ClearBounds (brushset_t *bs)
} }
static void static void
AddToBounds (brushset_t *bs, vec3_t v) AddToBounds (brushset_t *bs, const vec3_t v)
{ {
int i; int i;
@ -245,7 +244,7 @@ NormalizePlane (plane_t *dp)
} }
int int
FindPlane (plane_t *dplane, int *side) FindPlane (const plane_t *dplane, int *side)
{ {
int i; int i;
plane_t *dp, pl; plane_t *dp, pl;
@ -437,7 +436,7 @@ int num_hull_edges;
int hull_edges[MAX_HULL_EDGES][2]; int hull_edges[MAX_HULL_EDGES][2];
static void static void
AddBrushPlane (plane_t *plane) AddBrushPlane (const plane_t *plane)
{ {
float l; float l;
int i; int i;
@ -467,7 +466,7 @@ AddBrushPlane (plane_t *plane)
vertexes can be put on the front side vertexes can be put on the front side
*/ */
static void static void
TestAddPlane (plane_t *plane) TestAddPlane (const plane_t *plane)
{ {
int c, i; int c, i;
int counts[3]; int counts[3];
@ -523,7 +522,7 @@ TestAddPlane (plane_t *plane)
Doesn't add if duplicated Doesn't add if duplicated
*/ */
static int static int
AddHullPoint (vec3_t p, int hullnum) AddHullPoint (const vec3_t p, int hullnum)
{ {
int i, x, y, z; int i, x, y, z;
vec_t *c; vec_t *c;
@ -559,7 +558,7 @@ AddHullPoint (vec3_t p, int hullnum)
Creates all of the hull planes around the given edge, if not done already Creates all of the hull planes around the given edge, if not done already
*/ */
static void static void
AddHullEdge (vec3_t p1, vec3_t p2, int hullnum) AddHullEdge (const vec3_t p1, const vec3_t p2, int hullnum)
{ {
int pt1, pt2, a, b, c, d, e, i; int pt1, pt2, a, b, c, d, e, i;
plane_t plane; plane_t plane;
@ -662,12 +661,12 @@ ExpandBrush (int hullnum)
Converts a mapbrush to a bsp brush Converts a mapbrush to a bsp brush
*/ */
static brush_t * static brush_t *
LoadBrush (mbrush_t *mb, int hullnum) LoadBrush (const mbrush_t *mb, int hullnum)
{ {
brush_t *b; brush_t *b;
char *name; const char *name;
int contents; int contents;
mface_t *f; const mface_t *f;
// check texture name for attributes // check texture name for attributes
if (mb->faces->texinfo < 0) { if (mb->faces->texinfo < 0) {
@ -738,7 +737,7 @@ LoadBrush (mbrush_t *mb, int hullnum)
} }
static void static void
Brush_DrawAll (brushset_t *bs) Brush_DrawAll (const brushset_t *bs)
{ {
brush_t *b; brush_t *b;
face_t *f; face_t *f;

View file

@ -516,9 +516,9 @@ LoadMapFile (const char *filename)
} }
void void
PrintEntity (entity_t *ent) PrintEntity (const entity_t *ent)
{ {
epair_t *ep; const epair_t *ep;
for (ep = ent->epairs; ep; ep = ep->next) for (ep = ent->epairs; ep; ep = ep->next)
printf ("%20s : %s\n", ep->key, ep->value); printf ("%20s : %s\n", ep->key, ep->value);
@ -526,9 +526,9 @@ PrintEntity (entity_t *ent)
const char * const char *
ValueForKey (entity_t *ent, const char *key) ValueForKey (const entity_t *ent, const char *key)
{ {
epair_t *ep; const epair_t *ep;
for (ep = ent->epairs; ep; ep = ep->next) for (ep = ent->epairs; ep; ep = ep->next)
if (!strcmp (ep->key, key)) if (!strcmp (ep->key, key))
@ -555,7 +555,7 @@ SetKeyValue (entity_t *ent, const char *key, const char *value)
} }
void void
GetVectorForKey (entity_t *ent, const char *key, vec3_t vec) GetVectorForKey (const entity_t *ent, const char *key, vec3_t vec)
{ {
const char *k; const char *k;
double v1, v2, v3; double v1, v2, v3;
@ -573,7 +573,7 @@ void
WriteEntitiesToString (void) WriteEntitiesToString (void)
{ {
dstring_t *buf; dstring_t *buf;
epair_t *ep; const epair_t *ep;
int i; int i;
buf = dstring_newstr (); buf = dstring_newstr ();

View file

@ -220,7 +220,7 @@ MergePlaneFaces (surface_t *plane)
} }
void void
MergeAll (surface_t * surfhead) MergeAll (surface_t *surfhead)
{ {
face_t *f; face_t *f;
int mergefaces; int mergefaces;

View file

@ -37,12 +37,12 @@ Draw_ClearBounds (void)
} }
void void
Draw_AddToBounds (vec3_t v) Draw_AddToBounds (const vec3_t v)
{ {
} }
void void
Draw_DrawFace (struct visfacet_s *f) Draw_DrawFace (const struct visfacet_s *f)
{ {
} }
@ -67,32 +67,32 @@ Draw_SetBlack (void)
} }
void void
DrawPoint (vec3_t v) DrawPoint (const vec3_t v)
{ {
} }
void void
DrawLeaf (struct node_s *l, int color) DrawLeaf (const struct node_s *l, int color)
{ {
} }
void void
DrawBrush (struct brush_s *b) DrawBrush (const struct brush_s *b)
{ {
} }
void void
DrawWinding (struct winding_s *w) DrawWinding (const struct winding_s *w)
{ {
} }
void void
DrawTri (vec3_t p1, vec3_t p2, vec3_t p3) DrawTri (const vec3_t p1, const vec3_t p2, const vec3_t p3)
{ {
} }
void void
DrawPortal (struct portal_s *portal) DrawPortal (const struct portal_s *portal)
{ {
} }

View file

@ -46,7 +46,7 @@ int outleafs;
\return The leaf node in which the point is. \return The leaf node in which the point is.
*/ */
static node_t * static node_t *
PointInLeaf (node_t *node, vec3_t point) PointInLeaf (node_t *node, const vec3_t point)
{ {
vec_t d; vec_t d;
@ -98,7 +98,7 @@ FloodEntDist_r (node_t *n, int dist)
\return true if the entity could be placed, false otherwise. \return true if the entity could be placed, false otherwise.
*/ */
static qboolean static qboolean
PlaceOccupant (int num, vec3_t point, node_t *headnode) PlaceOccupant (int num, const vec3_t point, node_t *headnode)
{ {
node_t *n; node_t *n;
@ -112,7 +112,7 @@ PlaceOccupant (int num, vec3_t point, node_t *headnode)
return true; return true;
} }
portal_t *prevleaknode; const portal_t *prevleaknode;
FILE *leakfile; FILE *leakfile;
/** Write the coords for points joining two portals to the point file. /** Write the coords for points joining two portals to the point file.
@ -121,11 +121,11 @@ FILE *leakfile;
\note The first portal is set by the preceeding call. \note The first portal is set by the preceeding call.
*/ */
static void static void
MarkLeakTrail (portal_t *n2) MarkLeakTrail (const portal_t *n2)
{ {
float len; float len;
int i, j; int i, j;
portal_t *n1; const portal_t *n1;
vec3_t p1, p2, dir; vec3_t p1, p2, dir;
n1 = prevleaknode; n1 = prevleaknode;
@ -172,10 +172,10 @@ MarkLeakTrail2 (void)
{ {
int i; int i;
int next, side; int next, side;
node_t *n, *nextnode; const node_t *n, *nextnode;
portal_t *p, *p2; const portal_t *p, *p2;
vec3_t wc; vec3_t wc;
vec_t *v; const vec_t *v;
leakfile = fopen (options.pointfile, "w"); leakfile = fopen (options.pointfile, "w");
if (!leakfile) if (!leakfile)
@ -238,7 +238,7 @@ RecursiveFillOutside (node_t *l, qboolean fill)
return false; return false;
if (l->occupied) { if (l->occupied) {
vec_t *v; const vec_t *v;
hit_occupied = l->occupied; hit_occupied = l->occupied;
v = entities[hit_occupied].origin; v = entities[hit_occupied].origin;
qprintf ("reached occupant at: (%4.0f,%4.0f,%4.0f) %s\n", v[0], v[1], qprintf ("reached occupant at: (%4.0f,%4.0f,%4.0f) %s\n", v[0], v[1],

View file

@ -237,7 +237,7 @@ MakeHeadnodePortals (node_t *node)
\param plane The plane to set. \param plane The plane to set.
*/ */
static void static void
PlaneFromWinding (winding_t *w, plane_t *plane) PlaneFromWinding (const winding_t *w, plane_t *plane)
{ {
vec3_t v1, v2; vec3_t v1, v2;
@ -432,7 +432,7 @@ int num_realleafs;
\return 1 if the node has the specified contents, otherwise 0. \return 1 if the node has the specified contents, otherwise 0.
*/ */
static int static int
HasContents (node_t *n, int cont) HasContents (const node_t *n, int cont)
{ {
if (n->contents == cont) if (n->contents == cont)
return 1; return 1;
@ -449,7 +449,7 @@ HasContents (node_t *n, int cont)
\param n2 The second node to check. \param n2 The second node to check.
*/ */
static int static int
ShareContents (node_t *n1, node_t *n2) ShareContents (const node_t *n1, const node_t *n2)
{ {
if (n1->contents) { if (n1->contents) {
if (n1->contents == CONTENTS_SOLID) if (n1->contents == CONTENTS_SOLID)
@ -471,7 +471,7 @@ ShareContents (node_t *n1, node_t *n2)
\param n2 The second node to check. \param n2 The second node to check.
*/ */
static int static int
SameContents (node_t *n1, node_t *n2) SameContents (const node_t *n1, const node_t *n2)
{ {
if (n1->contents == CONTENTS_SOLID || n2->contents == CONTENTS_SOLID) if (n1->contents == CONTENTS_SOLID || n2->contents == CONTENTS_SOLID)
return 0; return 0;
@ -494,12 +494,13 @@ SameContents (node_t *n1, node_t *n2)
\param node The current node of the bsp. Call with the root node. \param node The current node of the bsp. Call with the root node.
*/ */
static void static void
WritePortalFile_r (node_t *node) WritePortalFile_r (const node_t *node)
{ {
int i; int i;
plane_t *pl, plane2; const plane_t *pl;
portal_t *p; plane_t plane2;
winding_t *w; const portal_t *p;
const winding_t *w;
if (!node->contents && !node->detail) { if (!node->contents && !node->detail) {
WritePortalFile_r (node->children[0]); WritePortalFile_r (node->children[0]);
@ -547,7 +548,7 @@ WritePortalFile_r (node_t *node)
\param n The current node of the bsp. Call with the root node. \param n The current node of the bsp. Call with the root node.
*/ */
static void static void
WritePortalLeafs_r (node_t *n) WritePortalLeafs_r (const node_t *n)
{ {
if (!n->contents) { if (!n->contents) {
WritePortalLeafs_r (n->children[0]); WritePortalLeafs_r (n->children[0]);

View file

@ -104,7 +104,7 @@ load_edges (void)
static void static void
load_planes (void) load_planes (void)
{ {
dplane_t *p; const dplane_t *p;
int i; int i;
memset (planes, 0, sizeof (planes)); memset (planes, 0, sizeof (planes));
@ -126,7 +126,7 @@ load_marksurfaces (void)
static void static void
load_faces (void) load_faces (void)
{ {
dface_t *f; const dface_t *f;
int i, j; int i, j;
winding_t *points; winding_t *points;
@ -164,7 +164,7 @@ load_vertices (void)
static void static void
load_leafs (void) load_leafs (void)
{ {
dleaf_t *l; const dleaf_t *l;
int i, j; int i, j;
leafs = calloc (bsp->numleafs, sizeof (node_t)); leafs = calloc (bsp->numleafs, sizeof (node_t));
@ -186,7 +186,7 @@ load_leafs (void)
static void static void
load_nodes (void) load_nodes (void)
{ {
dnode_t *n; const dnode_t *n;
face_t *f; face_t *f;
int i, j; int i, j;
@ -373,10 +373,10 @@ unique_name (wad_t *wad, const char *name)
void void
extract_textures (void) extract_textures (void)
{ {
dmiptexlump_t *miptexlump = (dmiptexlump_t *) bsp->texdata; const dmiptexlump_t *miptexlump = (dmiptexlump_t *) bsp->texdata;
miptex_t *miptex; miptex_t *miptex;
int i, mtsize, pixels; int i, mtsize, pixels;
char *wadfile; const char *wadfile;
wad_t *wad; wad_t *wad;
const char *uname; const char *uname;
@ -409,7 +409,7 @@ extract_textures (void)
void void
extract_entities (void) extract_entities (void)
{ {
char *entfile; const char *entfile;
int i; int i;
QFile *ef; QFile *ef;
@ -431,7 +431,7 @@ void
extract_hull (void) extract_hull (void)
{ {
// hullfile = output_file (".c"); // hullfile = output_file (".c");
char *hullfile; const char *hullfile;
int i, j; int i, j;
QFile *hf; QFile *hf;

View file

@ -66,12 +66,12 @@ qboolean usemidsplit;
</dl> </dl>
*/ */
static int static int
FaceSide (face_t *in, plane_t *split) FaceSide (const face_t *in, const plane_t *split)
{ {
int frontcount, backcount, i; int frontcount, backcount, i;
vec_t dot; vec_t dot;
vec_t *p; const vec_t *p;
winding_t *inp = in->points; const winding_t *inp = in->points;
frontcount = backcount = 0; frontcount = backcount = 0;
@ -126,7 +126,8 @@ FaceSide (face_t *in, plane_t *split)
\return The chosen surface. \return The chosen surface.
*/ */
static surface_t * static surface_t *
ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) ChooseMidPlaneFromList (surface_t *surfaces,
const vec3_t mins, const vec3_t maxs)
{ {
int j, l; int j, l;
plane_t *plane; plane_t *plane;
@ -190,7 +191,7 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs)
not be found. not be found.
*/ */
static surface_t * static surface_t *
ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, ChoosePlaneFromList (surface_t *surfaces, const vec3_t mins, const vec3_t maxs,
qboolean usefloors, qboolean usedetail) qboolean usefloors, qboolean usedetail)
{ {
face_t *f; face_t *f;

View file

@ -252,7 +252,7 @@ InitHash (void)
\return The hash value of the vector. \return The hash value of the vector.
*/ */
static unsigned static unsigned
HashVec (vec3_t vec) HashVec (const vec3_t vec)
{ {
unsigned h; unsigned h;
@ -269,7 +269,7 @@ HashVec (vec3_t vec)
\param planenum The plane on which this vertex is. \param planenum The plane on which this vertex is.
*/ */
static int static int
GetVertex (vec3_t in, int planenum) GetVertex (const vec3_t in, int planenum)
{ {
hashvert_t *hv; hashvert_t *hv;
int h, i; int h, i;
@ -343,7 +343,7 @@ int c_tryedges;
be negative, indicating the ends of the edge are reversed. be negative, indicating the ends of the edge are reversed.
*/ */
static int static int
GetEdge (vec3_t p1, vec3_t p2, face_t *f) GetEdge (const vec3_t p1, const vec3_t p2, face_t *f)
{ {
dedge_t edge; dedge_t edge;
int v1, v2, i; int v1, v2, i;

View file

@ -77,7 +77,7 @@ static vec3_t hash_min, hash_scale;
\param maxs The maximum of the bounding box in which the edges reside. \param maxs The maximum of the bounding box in which the edges reside.
*/ */
static void static void
InitHash (vec3_t mins, vec3_t maxs) InitHash (const vec3_t mins, const vec3_t maxs)
{ {
int newsize[2]; int newsize[2];
vec3_t size; vec3_t size;
@ -106,7 +106,7 @@ InitHash (vec3_t mins, vec3_t maxs)
\return The hash value of the vector. \return The hash value of the vector.
*/ */
static unsigned static unsigned
HashVec (vec3_t vec) HashVec (const vec3_t vec)
{ {
unsigned h; unsigned h;
@ -178,7 +178,7 @@ CanonicalVector (vec3_t vec)
point is represented by t1 and t2. point is represented by t1 and t2.
*/ */
static wedge_t * static wedge_t *
FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) FindEdge (const vec3_t p1, const vec3_t p2, vec_t *t1, vec_t *t2)
{ {
int h; int h;
vec3_t dir, origin; vec3_t dir, origin;
@ -276,7 +276,7 @@ AddVert (wedge_t *w, vec_t t)
\param p2 The second point of the face's edge. \param p2 The second point of the face's edge.
*/ */
static void static void
AddEdge (vec3_t p1, vec3_t p2) AddEdge (const vec3_t p1, const vec3_t p2)
{ {
wedge_t *w; wedge_t *w;
vec_t t1, t2; vec_t t1, t2;
@ -292,7 +292,7 @@ AddEdge (vec3_t p1, vec3_t p2)
\param f The face from which to add the faces. \param f The face from which to add the faces.
*/ */
static void static void
AddFaceEdges (face_t *f) AddFaceEdges (const face_t *f)
{ {
int i, j; int i, j;

View file

@ -47,7 +47,7 @@ static __attribute__ ((used)) const char rcsid[] =
int c_activewindings, c_peakwindings; int c_activewindings, c_peakwindings;
winding_t * winding_t *
BaseWindingForPlane (plane_t *p) BaseWindingForPlane (const plane_t *p)
{ {
int i, x; int i, x;
vec_t max, v; vec_t max, v;
@ -111,7 +111,7 @@ BaseWindingForPlane (plane_t *p)
} }
winding_t * winding_t *
CopyWinding (winding_t *w) CopyWinding (const winding_t *w)
{ {
size_t size; size_t size;
winding_t *c; winding_t *c;
@ -123,7 +123,7 @@ CopyWinding (winding_t *w)
} }
winding_t * winding_t *
CopyWindingReverse (winding_t *w) CopyWindingReverse (const winding_t *w)
{ {
int i; int i;
size_t size; size_t size;

View file

@ -54,9 +54,9 @@ int firstface;
int int
FindFinalPlane (dplane_t *p) FindFinalPlane (const dplane_t *p)
{ {
dplane_t *dplane; const dplane_t *dplane;
int i; int i;
for (i = 0, dplane = bsp->planes; i < bsp->numplanes; i++, dplane++) { for (i = 0, dplane = bsp->planes; i < bsp->numplanes; i++, dplane++) {
@ -160,7 +160,7 @@ WriteClipNodes (node_t *nodes)
\param node The leaf node to be written to the bsp file. \param node The leaf node to be written to the bsp file.
*/ */
static void static void
WriteLeaf (node_t *node) WriteLeaf (const node_t *node)
{ {
dleaf_t leaf_p; dleaf_t leaf_p;
face_t **fp, *f; face_t **fp, *f;
@ -201,7 +201,7 @@ WriteLeaf (node_t *node)
\param node The current node to be written. \param node The current node to be written.
*/ */
static void static void
WriteDrawNodes_r (node_t *node) WriteDrawNodes_r (const node_t *node)
{ {
static dnode_t dummy; static dnode_t dummy;
dnode_t *n; dnode_t *n;
@ -239,7 +239,7 @@ WriteDrawNodes_r (node_t *node)
} }
void void
WriteDrawNodes (node_t *headnode) WriteDrawNodes (const node_t *headnode)
{ {
dmodel_t bm; dmodel_t bm;
int start, i; int start, i;
@ -299,7 +299,7 @@ wadlist_t *wadlist;
\param path The path to the wad file. \param path The path to the wad file.
*/ */
static int static int
TEX_InitFromWad (char *path) TEX_InitFromWad (const char *path)
{ {
wadlist_t *wl; wadlist_t *wl;
wad_t *wad; wad_t *wad;
@ -334,7 +334,7 @@ TEX_InitFromWad (char *path)
found. found.
*/ */
static int static int
LoadLump (char *name, dstring_t *dest) LoadLump (const char *name, dstring_t *dest)
{ {
int r; int r;
int ofs = dest->size; int ofs = dest->size;