From ab329398d377012aeb267575b6f7e52a04c35096 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Tue, 26 May 2020 16:41:59 +0000 Subject: [PATCH] Fix most compiler warnings. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12592 d7cf8633-e32d-0410-b094-e92efae38249 --- client.h | 3 +++ gl_rmain.c | 8 +++++--- host_cmd.c | 2 +- image.c | 7 ++++--- model_shared.c | 6 +++--- r_shadow.c | 16 +++------------- svvm_cmds.c | 4 ++-- taskqueue.c | 2 +- vid_sdl.c | 11 ++++++----- 9 files changed, 28 insertions(+), 31 deletions(-) diff --git a/client.h b/client.h index b1dbac0e..435299c4 100644 --- a/client.h +++ b/client.h @@ -2042,6 +2042,9 @@ void V_FadeViewFlashs(void); void V_CalcViewBlend(void); void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight, qboolean cldead, qboolean clintermission, const vec3_t clvelocity); void V_CalcRefdef(void); +void V_MakeViewIsometric(void); +void V_MakeViewIsometric(void); +void V_StartPitchDrift(void); void CL_Locs_Reload_f(cmd_state_t *cmd); #endif diff --git a/gl_rmain.c b/gl_rmain.c index 7929d2f7..157d6eb8 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3989,12 +3989,14 @@ void R_AnimCache_CacheVisibleEntities(void) qboolean R_CanSeeBox(int numsamples, vec_t eyejitter, vec_t entboxenlarge, vec_t entboxexpand, vec_t pad, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs) { - int i; + long unsigned int i; + int j; vec3_t eyemins, eyemaxs; vec3_t boxmins, boxmaxs; vec3_t padmins, padmaxs; vec3_t start; vec3_t end; + trace_t trace; dp_model_t *model = r_refdef.scene.worldmodel; static vec3_t positions[] = { { 0.5f, 0.5f, 0.5f }, @@ -4055,7 +4057,7 @@ qboolean R_CanSeeBox(int numsamples, vec_t eyejitter, vec_t entboxenlarge, vec_t end[1] = boxmins[1] + (boxmaxs[1] - boxmins[1]) * positions[i][1]; end[2] = boxmins[2] + (boxmaxs[2] - boxmins[2]) * positions[i][2]; //trace_t trace = CL_TraceLine(start, end, MOVE_NORMAL, NULL, SUPERCONTENTS_SOLID, SUPERCONTENTS_SKY, MATERIALFLAGMASK_TRANSLUCENT, 0.0f, true, false, NULL, true, true); - trace_t trace = CL_Cache_TraceLineSurfaces(start, end, MOVE_NORMAL, SUPERCONTENTS_SOLID, 0, MATERIALFLAGMASK_TRANSLUCENT); + trace = CL_Cache_TraceLineSurfaces(start, end, MOVE_NORMAL, SUPERCONTENTS_SOLID, 0, MATERIALFLAGMASK_TRANSLUCENT); // not picky - if the trace ended anywhere in the box we're good if (BoxesOverlap(trace.endpos, trace.endpos, padmins, padmaxs)) return true; @@ -4065,7 +4067,7 @@ qboolean R_CanSeeBox(int numsamples, vec_t eyejitter, vec_t entboxenlarge, vec_t return true; // try various random positions - for (i = 0; i < numsamples; i++) + for (j = 0; j < numsamples; j++) { VectorSet(start, lhrandom(eyemins[0], eyemaxs[0]), lhrandom(eyemins[1], eyemaxs[1]), lhrandom(eyemins[2], eyemaxs[2])); VectorSet(end, lhrandom(boxmins[0], boxmaxs[0]), lhrandom(boxmins[1], boxmaxs[1]), lhrandom(boxmins[2], boxmaxs[2])); diff --git a/host_cmd.c b/host_cmd.c index ab429673..b095d181 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -2923,7 +2923,7 @@ Host_Pings_f Send back ping and packet loss update for all current players to this player ==================== */ -void Host_Pings_f(cmd_state_t *cmd) +static void Host_Pings_f(cmd_state_t *cmd) { int i, j, ping, packetloss, movementloss; char temp[128]; diff --git a/image.c b/image.c index 93d7d89b..37da0efa 100644 --- a/image.c +++ b/image.c @@ -878,7 +878,7 @@ static unsigned char* LoadLMP_BGRA(const unsigned char *f, int filesize, int *mi } // gfx/conchars is a raw 128x128 image with 0 as transparent color rather than 255 -unsigned char *LoadConChars_BGRA(const unsigned char *f, int filesize, int *miplevel) +static unsigned char *LoadConChars_BGRA(const unsigned char *f, int filesize, int *miplevel) { unsigned char *image_buffer; int i; @@ -1044,6 +1044,7 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo { fs_offset_t filesize; imageformat_t *firstformat, *format; + int mymiplevel; unsigned char *f, *data = NULL, *data2 = NULL; char basename[MAX_QPATH], name[MAX_QPATH], name2[MAX_QPATH], path[MAX_QPATH], afterpath[MAX_QPATH], *c; char vabuf[1024]; @@ -1086,7 +1087,7 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo f = FS_LoadFile(name, tempmempool, true, &filesize); if (f) { - int mymiplevel = miplevel ? *miplevel : 0; + mymiplevel = miplevel ? *miplevel : 0; image_width = 0; image_height = 0; data = format->loadfunc(f, (int)filesize, &mymiplevel); @@ -1152,7 +1153,7 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo if (developer_loading.integer) Con_Printf("loading gfx.wad lump \"%s\"\n", afterpath); - int mymiplevel = miplevel ? *miplevel : 0; + mymiplevel = miplevel ? *miplevel : 0; if (!strcmp(afterpath, "conchars")) { // conchars is a raw image and with color 0 as transparent instead of 255 diff --git a/model_shared.c b/model_shared.c index b650c448..19bbbc0a 100644 --- a/model_shared.c +++ b/model_shared.c @@ -2652,7 +2652,7 @@ void Mod_LoadCustomMaterial(mempool_t *mempool, texture_t *texture, const char * void Mod_UnloadCustomMaterial(texture_t *texture, qboolean purgeskins) { - int i, j; + long unsigned int i, j; for (i = 0; i < sizeof(texture->shaderpasses) / sizeof(texture->shaderpasses[0]); i++) { if (texture->shaderpasses[i]) @@ -4603,7 +4603,7 @@ static void Mod_Mesh_MakeSortedSurfaces(dp_model_t *mod) } } -void Mod_Mesh_ComputeBounds(dp_model_t *mod) +static void Mod_Mesh_ComputeBounds(dp_model_t *mod) { int i; vec_t x2a, x2b, y2a, y2b, z2a, z2b, x2, y2, z2, yawradius, rotatedradius; @@ -4683,7 +4683,7 @@ void Mod_Mesh_Validate(dp_model_t *mod) } } -void Mod_Mesh_UploadDynamicBuffers(dp_model_t *mod) +static void Mod_Mesh_UploadDynamicBuffers(dp_model_t *mod) { mod->surfmesh.data_element3s_indexbuffer = mod->surfmesh.data_element3s ? R_BufferData_Store(mod->surfmesh.num_triangles * sizeof(short[3]), mod->surfmesh.data_element3s, R_BUFFERDATA_INDEX16, &mod->surfmesh.data_element3s_bufferoffset) : NULL; mod->surfmesh.data_element3i_indexbuffer = mod->surfmesh.data_element3i ? R_BufferData_Store(mod->surfmesh.num_triangles * sizeof(int[3]), mod->surfmesh.data_element3i, R_BUFFERDATA_INDEX32, &mod->surfmesh.data_element3i_bufferoffset) : NULL; diff --git a/r_shadow.c b/r_shadow.c index e3999f24..75a85619 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -1550,7 +1550,7 @@ static void R_Shadow_SetShadowmapParametersForLight(qboolean noselfshadowpass) static void R_Shadow_RenderMode_ShadowMap(int side, int size, int x, int y) { - float nearclip, farclip, bias; + float nearclip, farclip; r_viewport_t viewport; int flipped; @@ -1572,7 +1572,6 @@ static void R_Shadow_RenderMode_ShadowMap(int side, int size, int x, int y) nearclip = r_shadow_shadowmapping_nearclip.value / rsurface.rtlight->radius; farclip = 1.0f; - bias = r_shadow_shadowmapping_bias.value * nearclip * (1024.0f / size);// * rsurface.rtlight->radius; R_Viewport_InitRectSideView(&viewport, &rsurface.rtlight->matrix_lighttoworld, side, size, r_shadow_shadowmapborder, nearclip, farclip, NULL, x, y); R_SetViewport(&viewport); @@ -2600,7 +2599,7 @@ static void R_Shadow_BounceGrid_ConvertPixelsAndUpload(void) r_shadow_bouncegrid_state.lastupdatetime = realtime; } -void R_Shadow_BounceGrid_ClearTex_Task(taskqueue_task_t *t) +static void R_Shadow_BounceGrid_ClearTex_Task(taskqueue_task_t *t) { memset(r_shadow_bouncegrid_state.highpixels, 0, r_shadow_bouncegrid_state.numpixels * sizeof(float[4])); t->done = 1; @@ -3875,8 +3874,6 @@ static void R_Shadow_DrawLight(rtlight_t *rtlight) int numlightentities_noselfshadow; entity_render_t **lightentities; entity_render_t **lightentities_noselfshadow; - entity_render_t **shadowentities; - entity_render_t **shadowentities_noselfshadow; int *surfacelist; qboolean castshadows; @@ -3897,8 +3894,6 @@ static void R_Shadow_DrawLight(rtlight_t *rtlight) numsurfaces = rtlight->cached_numsurfaces; lightentities = rtlight->cached_lightentities; lightentities_noselfshadow = rtlight->cached_lightentities_noselfshadow; - shadowentities = rtlight->cached_shadowentities; - shadowentities_noselfshadow = rtlight->cached_shadowentities_noselfshadow; lighttrispvs = rtlight->cached_lighttrispvs; surfacelist = rtlight->cached_surfacelist; castshadows = rtlight->castshadows; @@ -3921,14 +3916,9 @@ static void R_Shadow_DrawLight(rtlight_t *rtlight) if (castshadows && r_shadow_shadowmode == R_SHADOW_SHADOWMODE_SHADOWMAP2D) { - float borderbias; - int size; matrix4x4_t radiustolight = rtlight->matrix_worldtolight; Matrix4x4_Abs(&radiustolight); - size = rtlight->shadowmapatlassidesize; - borderbias = r_shadow_shadowmapborder / (float)(size - r_shadow_shadowmapborder); - //Con_Printf("distance %f lodlinear %i size %i\n", distance, lodlinear, size); // render lighting using the depth texture as shadowmap @@ -4057,7 +4047,7 @@ void R_Shadow_DrawPrepass(void) } #define MAX_SCENELIGHTS 65536 -qboolean R_Shadow_PrepareLights_AddSceneLight(rtlight_t *rtlight) +static qboolean R_Shadow_PrepareLights_AddSceneLight(rtlight_t *rtlight) { if (r_shadow_scenemaxlights <= r_shadow_scenenumlights) { diff --git a/svvm_cmds.c b/svvm_cmds.c index 5b99fc90..015c6b9d 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1717,13 +1717,13 @@ static void VM_SV_AddStat(prvm_prog_t *prog) if (i >= MAX_CL_STATS) { - VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_CL_STATS (%i), not supported by protocol, and AddStat beyond MAX_VM_STAT conflicts with engine MOVEVARS\n", i, MAX_CL_STATS, MAX_VM_STAT); + VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_CL_STATS (%i), not supported by protocol, and AddStat beyond MAX_VM_STAT (%i) conflicts with engine MOVEVARS\n", i, MAX_CL_STATS, MAX_VM_STAT); return; } if (i > (MAX_CL_STATS - 4) && type == 1) { - VM_Warning(prog, "PF_SV_AddStat: index (%i) > (MAX_CL_STATS-4) with string type won't fit in the protocol, and AddStat beyond MAX_VM_STAT conflicts with engine MOVEVARS\n", i, MAX_CL_STATS); + VM_Warning(prog, "PF_SV_AddStat: index (%i) > (MAX_CL_STATS (%i) - 4) with string type won't fit in the protocol, and AddStat beyond MAX_VM_STAT conflicts with engine MOVEVARS\n", i, MAX_CL_STATS); return; } diff --git a/taskqueue.c b/taskqueue.c index b43f8d46..0004e49e 100644 --- a/taskqueue.c +++ b/taskqueue.c @@ -141,7 +141,7 @@ qboolean TaskQueue_IsDone(taskqueue_task_t *t) return !t->done != 0; } -void TaskQueue_DistributeTasks(void) +static void TaskQueue_DistributeTasks(void) { Thread_AtomicLock(&taskqueue_state.command_lock); if (taskqueue_state.numthreads > 0) diff --git a/vid_sdl.c b/vid_sdl.c index 3db8b2b9..0b37e274 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1459,6 +1459,12 @@ static void AdjustWindowBounds(viddef_mode_t *mode, RECT *rect) } #endif +extern cvar_t gl_info_vendor; +extern cvar_t gl_info_renderer; +extern cvar_t gl_info_version; +extern cvar_t gl_info_platform; +extern cvar_t gl_info_driver; + static qboolean VID_InitModeGL(viddef_mode_t *mode) { int windowflags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL; @@ -1577,11 +1583,6 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) GL_Setup(); // VorteX: set other info - extern cvar_t gl_info_vendor; - extern cvar_t gl_info_renderer; - extern cvar_t gl_info_version; - extern cvar_t gl_info_platform; - extern cvar_t gl_info_driver; Cvar_SetQuick(&gl_info_vendor, gl_vendor); Cvar_SetQuick(&gl_info_renderer, gl_renderer); Cvar_SetQuick(&gl_info_version, gl_version); -- 2.39.2