diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index e4f6dccb..1f2b6e93 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -358,8 +358,8 @@ extern float d_sdivzstepu, d_tdivzstepu; extern float d_sdivzstepv, d_tdivzstepv; extern float d_sdivzorigin, d_tdivzorigin; -void D_DrawSpansPow2(espan_t *pspans, float d_ziorigin, float d_zistepu, float d_zistepv); -void D_DrawZSpans(espan_t *pspans, float d_ziorigin, float d_zistepu, float d_zistepv); +void D_DrawSpansPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv); +void D_DrawZSpans(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv); void TurbulentPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv); void NonTurbulentPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv); @@ -557,14 +557,14 @@ void Draw_InitLocal(void); void R_InitCaches(void); void D_FlushCaches(void); -void RE_BeginRegistration (char *map); -struct model_s *RE_RegisterModel (char *name); +void RE_BeginRegistration (char *model); +struct model_s *RE_RegisterModel (char *name); void RE_EndRegistration (void); struct image_s *RE_Draw_FindPic (char *name); void RE_Draw_GetPicSize (int *w, int *h, char *name); -void RE_Draw_PicScaled (int x, int y, char *name, float factor); +void RE_Draw_PicScaled (int x, int y, char *name, float scale); void RE_Draw_StretchPic (int x, int y, int w, int h, char *name); void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data); void RE_Draw_CharScaled (int x, int y, int c, float scale); diff --git a/src/client/refresh/soft/sw_aclip.c b/src/client/refresh/soft/sw_aclip.c index 734686f8..c5a2276c 100644 --- a/src/client/refresh/soft/sw_aclip.c +++ b/src/client/refresh/soft/sw_aclip.c @@ -177,7 +177,7 @@ R_AliasClip (const finalvert_t *in, finalvert_t *out, int flag, int count, j = count-1; k = 0; - for (i=0 ; i vid.height ) // status text was missing in sw... return; - row = num>>4; - col = num&15; + row = c>>4; + col = c&15; source = draw_chars->pixels[0] + (row<<10) + (col<<3); if (y < 0) @@ -146,11 +146,11 @@ RE_Draw_GetPicSize ============= */ void -RE_Draw_GetPicSize (int *w, int *h, char *pic) +RE_Draw_GetPicSize (int *w, int *h, char *name) { image_t *gl; - gl = RE_Draw_FindPic (pic); + gl = RE_Draw_FindPic (name); if (!gl) { *w = *h = -1; @@ -170,7 +170,6 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic { pixel_t *dest; byte *source; - int v, u; int height; int skip; @@ -198,6 +197,8 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic if (w == pic->width) { + int v; + for (v=0 ; vheight/h; @@ -207,9 +208,10 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic } else { + int v; for (v=0 ; vheight/h; source = pic->pixels[0] + sv*pic->width; f = 0; diff --git a/src/client/refresh/soft/sw_image.c b/src/client/refresh/soft/sw_image.c index 2d2544bd..f2e96b31 100644 --- a/src/client/refresh/soft/sw_image.c +++ b/src/client/refresh/soft/sw_image.c @@ -190,6 +190,12 @@ R_LoadPic (char *name, byte *pic, int width, int height, imagetype_t type) size = width * height; full_size = R_GetImageMipsSize(size); image->pixels[0] = malloc(full_size); + if (!image->pixels[0]) + { + ri.Sys_Error(ERR_FATAL, "%s: Can't allocate image.", __func__); + // code never returns after ERR_FATAL + return NULL; + } image->transparent = false; for (i=0 ; ivieworg, r_refdef.vieworg); VectorCopy (fd->viewangles, r_refdef.viewangles); - // compare current possition with old + // compare current position with old if (!VectorCompareRound(fd->vieworg, lastvieworg) || !VectorCompare(fd->viewangles, lastviewangles)) { @@ -1278,7 +1278,7 @@ RE_RenderFrame (refdef_t *fd) fastmoving = false; } - // save possition for next check + // save position for next check VectorCopy (fd->vieworg, lastvieworg); VectorCopy (fd->viewangles, lastviewangles); @@ -1340,10 +1340,10 @@ RE_RenderFrame (refdef_t *fd) D_WarpScreen (); if (r_dspeeds->value) + { da_time1 = SDL_GetTicks(); - - if (r_dspeeds->value) da_time2 = SDL_GetTicks(); + } // Modify the palette (when taking hit or pickup item) so all colors are modified R_CalcPalette (); @@ -2172,6 +2172,12 @@ SWimp_CreateRender(void) { swap_current = 0; swap_buffers = malloc(vid.height * vid.width * sizeof(pixel_t) * 2); + if (!swap_buffers) + { + ri.Sys_Error(ERR_FATAL, "%s: Can't allocate swapbuffer.", __func__); + // code never returns after ERR_FATAL + return; + } swap_frames[0] = swap_buffers; swap_frames[1] = swap_buffers + vid.height * vid.width * sizeof(pixel_t); vid_buffer = swap_frames[swap_current&1]; diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 44fb4b70..7489153c 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -210,6 +210,7 @@ Mod_PointInLeaf (vec3_t p, model_t *model) if (!model || !model->nodes) { ri.Sys_Error(ERR_DROP, "%s: bad model", __func__); + return NULL; } node = model->nodes; @@ -982,7 +983,7 @@ Mod_LoadBrushModel(model_t *mod, void *buffer, int modfilelen) int hunkSize = 0; hunkSize += calcLumpHunkSize(&header->lumps[LUMP_VERTEXES], sizeof(dvertex_t), sizeof(mvertex_t), 8); hunkSize += calcLumpHunkSize(&header->lumps[LUMP_EDGES], sizeof(dedge_t), sizeof(medge_t), 13); - float surfEdgeCount = header->lumps[LUMP_SURFEDGES].filelen/sizeof(int); + float surfEdgeCount = (float)header->lumps[LUMP_SURFEDGES].filelen / sizeof(int); if(surfEdgeCount < MAX_MAP_SURFEDGES) // else it errors out later anyway hunkSize += calcLumpHunkSize(&header->lumps[LUMP_SURFEDGES], sizeof(int), sizeof(int), 24); diff --git a/src/client/refresh/soft/sw_surf.c b/src/client/refresh/soft/sw_surf.c index 8131c79d..ed212302 100644 --- a/src/client/refresh/soft/sw_surf.c +++ b/src/client/refresh/soft/sw_surf.c @@ -234,6 +234,12 @@ R_InitCaches (void) sc_size = size; sc_base = (surfcache_t *)malloc(size); + if (!sc_base) + { + ri.Sys_Error(ERR_FATAL, "%s: Can't allocate cache.", __func__); + // code never returns after ERR_FATAL + return; + } sc_rover = sc_base; sc_base->next = NULL;