From 659009775232ac23b989a99053fde13c1e3b5fbb Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sun, 17 Mar 2024 15:44:32 +0200 Subject: [PATCH] soft: fix cppcheck warning and remove unused fullscreen property --- src/client/refresh/soft/header/local.h | 4 ++-- src/client/refresh/soft/sw_edge.c | 2 +- src/client/refresh/soft/sw_image.c | 2 +- src/client/refresh/soft/sw_light.c | 9 ++++++--- src/client/refresh/soft/sw_main.c | 23 ++++++++++++----------- src/client/refresh/soft/sw_misc.c | 2 +- src/client/refresh/soft/sw_poly.c | 9 +++++---- src/client/refresh/vk/vk_surf.c | 10 ++++++---- 8 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index e107caf3..38764fac 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -455,7 +455,7 @@ void R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t * void R_AliasDrawModel(entity_t *currententity, const model_t *currentmodel); void R_BeginEdgeFrame(void); -void R_ScanEdges(entity_t *currententity, surf_t *surface); +void R_ScanEdges(entity_t *currententity, const surf_t *surface); void RI_PushDlights(const model_t *model); void R_RotateBmodel(const entity_t *currententity); @@ -563,7 +563,7 @@ extern byte d_8to24table[256 * 4]; void R_InitImages(void); void R_ShutdownImages(void); image_t *R_FindImage(const char *name, imagetype_t type); -image_t *R_LoadPic(char *name, byte *pic, int width, int realwidth, int height, int realheight, +image_t *R_LoadPic(const char *name, const byte *pic, int width, int realwidth, int height, int realheight, size_t data_size, imagetype_t type, int bits); byte *Get_BestImageSize(const image_t *image, int *req_width, int *req_height); void R_FreeUnusedImages(void); diff --git a/src/client/refresh/soft/sw_edge.c b/src/client/refresh/soft/sw_edge.c index 18fc2069..1ee23119 100644 --- a/src/client/refresh/soft/sw_edge.c +++ b/src/client/refresh/soft/sw_edge.c @@ -598,7 +598,7 @@ Each surface has a linked list of its visible spans ============== */ void -R_ScanEdges (entity_t *currententity, surf_t *surface) +R_ScanEdges (entity_t *currententity, const surf_t *surface) { shift20_t iv, bottom; surf_t *s; diff --git a/src/client/refresh/soft/sw_image.c b/src/client/refresh/soft/sw_image.c index ad87dfd1..1f054128 100644 --- a/src/client/refresh/soft/sw_image.c +++ b/src/client/refresh/soft/sw_image.c @@ -331,7 +331,7 @@ R_LoadPic8(const char *name, const byte *pic, int width, int realwidth, int heig } image_t * -R_LoadPic(char *name, byte *pic, int width, int realwidth, int height, int realheight, +R_LoadPic(const char *name, const byte *pic, int width, int realwidth, int height, int realheight, size_t data_size, imagetype_t type, int bits) { if (!realwidth || !realheight) diff --git a/src/client/refresh/soft/sw_light.c b/src/client/refresh/soft/sw_light.c index e7f9f627..323954c7 100644 --- a/src/client/refresh/soft/sw_light.c +++ b/src/client/refresh/soft/sw_light.c @@ -225,8 +225,9 @@ RI_BuildLightMap(drawsurf_t* drawsurf) for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ; maps++) { + const light_t *max_light; + light_t *curr_light; unsigned scale; - light_t *curr_light, *max_light; curr_light = blocklights; max_light = blocklights + size; @@ -277,8 +278,9 @@ RI_BuildLightMap(drawsurf_t* drawsurf) for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ; maps++) { + const light_t *max_light; + light_t *curr_light; unsigned scale; - light_t *curr_light, *max_light; curr_light = blocklights; max_light = blocklights + size; @@ -302,7 +304,8 @@ RI_BuildLightMap(drawsurf_t* drawsurf) // bound, invert, and shift { - light_t *curr_light, *max_light; + const light_t *max_light; + light_t *curr_light; curr_light = blocklights; max_light = blocklights + size; diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 45ffb0ea..5d9084c0 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -64,11 +64,10 @@ pixel_t *r_warpbuffer; typedef struct swstate_s { - qboolean fullscreen; - int prev_mode; // last valid SW mode + int prev_mode; /* last valid SW mode */ - unsigned char gammatable[256]; - unsigned char currentpalette[1024]; + unsigned char gammatable[256]; + unsigned char currentpalette[1024]; } swstate_t; static swstate_t sw_state; @@ -928,7 +927,7 @@ R_BmodelCheckBBox ============= */ static int -R_BmodelCheckBBox (const float *minmaxs) +R_BmodelCheckBBox(const float *minmaxs) { int i, clipflags; @@ -937,7 +936,7 @@ R_BmodelCheckBBox (const float *minmaxs) for (i=0 ; i<4 ; i++) { vec3_t acceptpt, rejectpt; - int *pindex; + const int *pindex; float d; // generate accept and reject points @@ -986,7 +985,7 @@ R_FindTopnode (vec3_t mins, vec3_t maxs) while (1) { - cplane_t *splitplane; + const cplane_t *splitplane; int sides; if (node->visframe != r_visframecount) @@ -2085,7 +2084,7 @@ char shift_size; static void RE_CopyFrame (Uint32 * pixels, int pitch, int vmin, int vmax) { - Uint32 *sdl_palette = (Uint32 *)sw_state.currentpalette; + const Uint32 *sdl_palette = (Uint32 *)sw_state.currentpalette; // no gaps between images rows if (pitch == vid_buffer_width) @@ -2130,7 +2129,8 @@ RE_CopyFrame (Uint32 * pixels, int pitch, int vmin, int vmax) static int RE_BufferDifferenceStart(int vmin, int vmax) { - int *front_buffer, *back_buffer, *back_max; + int *front_buffer, *back_buffer; + const int *back_max; back_buffer = (int*)(swap_frames[0] + vmin); front_buffer = (int*)(swap_frames[1] + vmin); @@ -2146,7 +2146,8 @@ RE_BufferDifferenceStart(int vmin, int vmax) static int RE_BufferDifferenceEnd(int vmin, int vmax) { - int *front_buffer, *back_buffer, *back_min; + int *front_buffer, *back_buffer; + const int *back_min; back_buffer = (int*)(swap_frames[0] + vmax); front_buffer = (int*)(swap_frames[1] + vmax); @@ -2197,7 +2198,7 @@ RE_FlushFrame(int vmin, int vmax) if (is_render_flushed) { - Com_Printf("%s: Render is already flushed\n", __func__); + R_Printf(PRINT_DEVELOPER, "%s: Render is already flushed\n", __func__); return; } diff --git a/src/client/refresh/soft/sw_misc.c b/src/client/refresh/soft/sw_misc.c index 861dddc8..7b5cc390 100644 --- a/src/client/refresh/soft/sw_misc.c +++ b/src/client/refresh/soft/sw_misc.c @@ -336,7 +336,7 @@ R_SetupFrame (void) // current viewleaf if ( !( r_newrefdef.rdflags & RDF_NOWORLDMODEL ) ) { - mleaf_t *r_viewleaf; + const mleaf_t *r_viewleaf; if (!r_worldmodel) { diff --git a/src/client/refresh/soft/sw_poly.c b/src/client/refresh/soft/sw_poly.c index 957738df..6ab34495 100644 --- a/src/client/refresh/soft/sw_poly.c +++ b/src/client/refresh/soft/sw_poly.c @@ -519,10 +519,11 @@ R_DrawSpanlet66Stipple(const int *r_turb_turb) static int R_ClipPolyFace(int nump, clipplane_t *pclipplane) { - int i, outcount; - float frac, clipdist, *pclipnormal; - float *in, *instep, *outstep, *vert2; - float dists[MAXWORKINGVERTS+3] = {0}; + float dists[MAXWORKINGVERTS+3] = {0}; + const float *vert2, *pclipnormal; + float *in, *instep, *outstep; + float frac, clipdist; + int i, outcount; clipdist = pclipplane->dist; pclipnormal = pclipplane->normal; diff --git a/src/client/refresh/vk/vk_surf.c b/src/client/refresh/vk/vk_surf.c index 87c545c1..d1cb62a9 100644 --- a/src/client/refresh/vk/vk_surf.c +++ b/src/client/refresh/vk/vk_surf.c @@ -37,7 +37,7 @@ msurface_t *r_alpha_surfaces; vklightmapstate_t vk_lms; static void -DrawVkPoly(mpoly_t *p, image_t *texture, float *color) +DrawVkPoly(mpoly_t *p, image_t *texture, const float *color) { QVk_BindPipeline(&vk_drawPolyPipeline); @@ -74,7 +74,7 @@ DrawVkFlowingPoly -- version of DrawVkPoly that handles scrolling texture ================ */ static void -DrawVkFlowingPoly(msurface_t *fa, image_t *texture, float *color) +DrawVkFlowingPoly(msurface_t *fa, image_t *texture, const float *color) { float scroll; mpoly_t *p; @@ -187,7 +187,8 @@ R_DrawTriangleOutlines(void) } static void -R_RenderBrushPoly(msurface_t *fa, float *modelMatrix, float alpha, entity_t *currententity) +R_RenderBrushPoly(msurface_t *fa, const float *modelMatrix, float alpha, + const entity_t *currententity) { int maps; image_t *image; @@ -390,7 +391,8 @@ DrawTextureChains(entity_t *currententity) static void -Vk_RenderLightmappedPoly(msurface_t *surf, float *modelMatrix, float alpha, entity_t *currententity) +Vk_RenderLightmappedPoly(msurface_t *surf, const float *modelMatrix, float alpha, + const entity_t *currententity) { int i, nv = surf->polys->numverts; int map;