use const for ro parameters

This commit is contained in:
Denis Pauk 2018-08-01 18:18:20 +03:00
parent e748ed1af8
commit 4093a49f0f
9 changed files with 67 additions and 65 deletions

View file

@ -138,7 +138,7 @@ extern oldrefdef_t r_refdef;
#define VID_GRADES (1 << VID_CBITS)
// r_shared.h: general refresh-related stuff shared between the refresh and the
// sw_local.h: general refresh-related stuff shared between the refresh and the
// driver
@ -279,7 +279,7 @@ typedef struct espan_s
} espan_t;
extern espan_t *vid_polygon_spans; // space for spans in r_poly
// used by the polygon drawer (R_POLY.C) and sprite setup code (R_SPRITE.C)
// used by the polygon drawer (sw_poly.c) and sprite setup code (sw_sprite.c)
typedef struct
{
int nump;
@ -402,7 +402,7 @@ extern surf_t *surfaces, *surface_p, *surf_max;
// pointer is greater than another one, it should be drawn in front
// surfaces[1] is the background, and is used as the active surface stack.
// surfaces[0] is a dummy, because index 0 is used to indicate no surface
// attached to an edge_t
// attached to an edge_t
//===================================================================
@ -533,7 +533,7 @@ typedef struct
extern aliastriangleparms_t aliastriangleparms;
void R_DrawTriangle( void );
void R_AliasClipTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t *index2);
void R_AliasClipTriangle (const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2);
extern float r_time1;

View file

@ -31,7 +31,7 @@ pfv0 is the unclipped vertex, pfv1 is the z-clipped vertex
================
*/
static void
R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
R_Alias_clip_z (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *out)
{
float scale;
@ -50,7 +50,7 @@ R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
}
static void
R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
R_Alias_clip_left (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *out)
{
float scale;
@ -79,7 +79,7 @@ R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
}
static void
R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
R_Alias_clip_right (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *out)
{
float scale;
@ -108,7 +108,7 @@ R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
}
static void
R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
R_Alias_clip_top (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *out)
{
float scale;
@ -138,8 +138,7 @@ R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)
static void
R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1,
finalvert_t *out)
R_Alias_clip_bottom (const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *out)
{
float scale;
@ -171,8 +170,8 @@ R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1,
int
R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count,
void(*clip)(finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) )
R_AliasClip (const finalvert_t *in, finalvert_t *out, int flag, int count,
void(*clip)(const finalvert_t *pfv0, const finalvert_t *pfv1, finalvert_t *out) )
{
int i,j,k;
@ -218,7 +217,7 @@ R_AliasClipTriangle
================
*/
void
R_AliasClipTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t *index2)
R_AliasClipTriangle (const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2)
{
int i, k, pingpong;
unsigned clipflags;

View file

@ -53,12 +53,12 @@ static vec3_t s_alias_forward, s_alias_right, s_alias_up;
#define NUMVERTEXNORMALS 162
static float r_avertexnormals[NUMVERTEXNORMALS][3] = {
static const float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "../constants/anorms.h"
};
static void R_AliasTransformVector(vec3_t in, vec3_t out, float m[3][4]);
static void R_AliasTransformVector(const vec3_t in, vec3_t out, const float m[3][4]);
static void R_AliasTransformFinalVerts(int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv );
void R_AliasProjectAndClipTestFinalVert(finalvert_t *fv);
@ -206,7 +206,7 @@ R_AliasTransformVector
================
*/
static void
R_AliasTransformVector(vec3_t in, vec3_t out, float xf[3][4] )
R_AliasTransformVector(const vec3_t in, vec3_t out, const float xf[3][4] )
{
out[0] = DotProduct(in, xf[0]) + xf[0][3];
out[1] = DotProduct(in, xf[1]) + xf[1][3];
@ -223,7 +223,7 @@ General clipped case
*/
static void
R_AliasPreparePoints (finalvert_t *verts, finalvert_t *verts_max)
R_AliasPreparePoints (finalvert_t *verts, const finalvert_t *verts_max)
{
int i;
dstvert_t *pstverts;
@ -402,7 +402,8 @@ R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *oldv, d
for ( i = 0; i < numpoints; i++, fv++, oldv++, newv++ )
{
int temp;
float lightcos, *plightnormal;
float lightcos;
const float *plightnormal;
vec3_t lerped_vert;
lerped_vert[0] = r_lerp_move[0] + oldv->v[0]*r_lerp_backv[0] + newv->v[0]*r_lerp_frontv[0];

View file

@ -158,7 +158,7 @@ RE_Draw_StretchPicImplementation
=============
*/
void
RE_Draw_StretchPicImplementation (int x, int y, int w, int h, image_t *pic)
RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic)
{
pixel_t *dest;
byte *source;

View file

@ -1422,8 +1422,8 @@ RE_SetSky
============
*/
// 3dstudio environment map names
char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
static int r_skysideimage[6] = {5, 2, 4, 1, 0, 3};
static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
static const int r_skysideimage[6] = {5, 2, 4, 1, 0, 3};
extern mtexinfo_t r_skytexinfo[6];
static void

View file

@ -30,7 +30,7 @@ float d_scalemip[NUM_MIPS-1];
static mleaf_t *r_viewleaf;
static int r_frustum_indexes[4*6];
static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8};
static const float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8};
int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
float xcenter, ycenter;
int d_pix_min, d_pix_max, d_pix_mul;

View file

@ -110,45 +110,47 @@ static void R_PolysetScanLeftEdge_C(int height);
// ======================
// PGM
// 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
static byte irtable[256] = { 79, 78, 77, 76, 75, 74, 73, 72, // black/white
71, 70, 69, 68, 67, 66, 65, 64,
64, 65, 66, 67, 68, 69, 70, 71, // dark taupe
72, 73, 74, 75, 76, 77, 78, 79,
static const byte irtable[256] = {
79, 78, 77, 76, 75, 74, 73, 72, // black/white
71, 70, 69, 68, 67, 66, 65, 64,
64, 65, 66, 67, 68, 69, 70, 71, // dark taupe
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // slate grey
72, 73, 74, 75, 76, 77, 78, 79,
208, 208, 208, 208, 208, 208, 208, 208, // unused?'
64, 66, 68, 70, 72, 74, 76, 78, // dark yellow
64, 65, 66, 67, 68, 69, 70, 71, // slate grey
72, 73, 74, 75, 76, 77, 78, 79,
208, 208, 208, 208, 208, 208, 208, 208, // unused?'
64, 66, 68, 70, 72, 74, 76, 78, // dark yellow
64, 65, 66, 67, 68, 69, 70, 71, // dark red
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // grey/tan
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // dark red
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // grey/tan
72, 73, 74, 75, 76, 77, 78, 79,
64, 66, 68, 70, 72, 74, 76, 78, // chocolate
68, 67, 66, 65, 64, 65, 66, 67, // mauve / teal
68, 69, 70, 71, 72, 73, 74, 75,
76, 76, 77, 77, 78, 78, 79, 79,
64, 66, 68, 70, 72, 74, 76, 78, // chocolate
68, 67, 66, 65, 64, 65, 66, 67, // mauve / teal
68, 69, 70, 71, 72, 73, 74, 75,
76, 76, 77, 77, 78, 78, 79, 79,
64, 65, 66, 67, 68, 69, 70, 71, // more mauve
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // olive
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // more mauve
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // olive
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // maroon
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // sky blue
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // maroon
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // sky blue
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // olive again
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // nuclear green
64, 65, 66, 67, 68, 69, 70, 71, // bright yellow
64, 65, 66, 67, 68, 69, 70, 71, // olive again
72, 73, 74, 75, 76, 77, 78, 79,
64, 65, 66, 67, 68, 69, 70, 71, // nuclear green
64, 65, 66, 67, 68, 69, 70, 71, // bright yellow
64, 65, 66, 67, 68, 69, 70, 71, // fire colors
72, 73, 74, 75, 76, 77, 78, 79,
208, 208, 64, 64, 70, 71, 72, 64, // mishmash1
66, 68, 70, 64, 65, 66, 67, 68}; // mishmash2
64, 65, 66, 67, 68, 69, 70, 71, // fire colors
72, 73, 74, 75, 76, 77, 78, 79,
208, 208, 64, 64, 70, 71, 72, 64, // mishmash1
66, 68, 70, 64, 65, 66, 67, 68}; // mishmash2
// PGM
// ======================

View file

@ -67,15 +67,15 @@ static medge_t *r_skyedges;
static int *r_skysurfedges;
// I just copied this data from a box map...
static int skybox_planes[12] = {2,-128, 0,-128, 2,128, 1,128, 0,128, 1,-128};
static const int skybox_planes[12] = {2,-128, 0,-128, 2,128, 1,128, 0,128, 1,-128};
static int box_surfedges[24] = { 1,2,3,4, -1,5,6,7, 8,9,-6,10, -2,-7,-9,11,
static const int box_surfedges[24] = { 1,2,3,4, -1,5,6,7, 8,9,-6,10, -2,-7,-9,11,
12,-3,-11,-8, -12,-10,-5,-4};
static int box_edges[24] = { 1,2, 2,3, 3,4, 4,1, 1,5, 5,6, 6,2, 7,8, 8,6, 5,7, 8,3, 7,4};
static const int box_edges[24] = { 1,2, 2,3, 3,4, 4,1, 1,5, 5,6, 6,2, 7,8, 8,6, 5,7, 8,3, 7,4};
static int box_faces[6] = {0,0,2,2,2,0};
static const int box_faces[6] = {0,0,2,2,2,0};
static vec3_t box_vecs[6][2] = {
static const vec3_t box_vecs[6][2] = {
{ {0,-1,0}, {-1,0,0} },
{ {0,1,0}, {0,0,-1} },
{ {0,-1,0}, {1,0,0} },
@ -84,7 +84,7 @@ static vec3_t box_vecs[6][2] = {
{ {-1,0,0}, {0,0,-1} }
};
static float box_verts[8][3] = {
static const float box_verts[8][3] = {
{-1,-1,-1},
{-1,1,-1},
{1,1,-1},

View file

@ -388,14 +388,14 @@ NonTurbulent8 (espan_t *pspan)
// Enable custom filtering
extern cvar_t *sw_texture_filtering;
static int filtering_kernel[2][2][2] = {
static const int filtering_kernel[2][2][2] = {
{
{16384, 0},
{49152, 32768}
{0x1 << (SHIFT16XYZ-2), 0x0},
{0xC << (SHIFT16XYZ-4), 0x1 << (SHIFT16XYZ-1)}
},
{
{32768, 49152},
{0, 16384}
{0x1 << (SHIFT16XYZ-1), 0xC << (SHIFT16XYZ-4)},
{0x0, 0x1 << (SHIFT16XYZ-2)}
}
};