diff --git a/libs/video/renderer/sw32/d_init.c b/libs/video/renderer/sw32/d_init.c index e91628626..761adb726 100644 --- a/libs/video/renderer/sw32/d_init.c +++ b/libs/video/renderer/sw32/d_init.c @@ -31,7 +31,7 @@ #endif #include "QF/cvar.h" -// #include "QF/render.h" + #include "QF/render.h" // #include "QF/vid.h" #include "compat.h" @@ -65,13 +65,18 @@ D_Init (void) r_aliasuvscale = 1.0; // LordHavoc: compute 1/zi table for use in rendering code everywhere - if (!d_zitable[1]) - { + if (!d_zitable[1]) { int i; d_zitable[0] = 0; for (i = 1;i < 65536;i++) d_zitable[i] = (65536.0 * 65536.0 / (double) i); } + + vid.surf_cache_size = D_SurfaceCacheForRes; + vid.flush_caches = D_FlushCaches; + vid.init_caches = D_InitCaches; + + VID_InitBuffers (); } void diff --git a/libs/video/renderer/sw32/d_scan.c b/libs/video/renderer/sw32/d_scan.c index d394eeba0..cf67e1e30 100644 --- a/libs/video/renderer/sw32/d_scan.c +++ b/libs/video/renderer/sw32/d_scan.c @@ -46,7 +46,7 @@ int r_turb_spancount; void D_DrawTurbulentSpan (void); -extern float *d_zitable; +extern float d_zitable[65536]; /* diff --git a/libs/video/renderer/sw32/d_sprite.c b/libs/video/renderer/sw32/d_sprite.c index b3884d43f..2d3c6bf26 100644 --- a/libs/video/renderer/sw32/d_sprite.c +++ b/libs/video/renderer/sw32/d_sprite.c @@ -39,7 +39,7 @@ static int sprite_height; static int minindex, maxindex; static sspan_t *sprite_spans; -extern float *d_zitable; +extern float d_zitable[65536]; void diff --git a/libs/video/renderer/sw32/d_surf.c b/libs/video/renderer/sw32/d_surf.c index 1bb4f3ad7..d00a6ab16 100644 --- a/libs/video/renderer/sw32/d_surf.c +++ b/libs/video/renderer/sw32/d_surf.c @@ -111,6 +111,8 @@ D_InitCaches (void *buffer, int size) sc_base->owner = NULL; sc_base->size = sc_size; + d_pzbuffer = vid.zbuffer; + D_ClearCacheGuard (); } diff --git a/libs/video/targets/vid_common_sw32.c b/libs/video/targets/vid_common_sw32.c index 37bca3d0e..5d4d7c119 100644 --- a/libs/video/targets/vid_common_sw32.c +++ b/libs/video/targets/vid_common_sw32.c @@ -210,7 +210,6 @@ void VID_InitBuffers (void) { int buffersize, zbuffersize, cachesize = 1; - void *vid_surfcache; // Calculate the sizes we want first buffersize = vid.rowbytes * vid.height; @@ -252,8 +251,8 @@ VID_InitBuffers (void) Sys_Error ("Not enough memory for video mode\n"); } // Allocate the new surface cache; free the z-buffer if we fail - vid_surfcache = calloc (cachesize, 1); - if (!vid_surfcache) { + vid.surfcache = calloc (cachesize, 1); + if (!vid.surfcache) { free (vid.buffer); free (vid.zbuffer); vid.zbuffer = NULL; diff --git a/libs/video/targets/vid_sdl.c b/libs/video/targets/vid_sdl.c index 8bf59c46b..0e1cc4115 100644 --- a/libs/video/targets/vid_sdl.c +++ b/libs/video/targets/vid_sdl.c @@ -95,8 +95,7 @@ VID_Init (unsigned char *palette) Uint32 flags; // Load the SDL library - if (SDL_Init (SDL_INIT_VIDEO) < 0) // |SDL_INIT_AUDIO|SDL_INIT_CDROM) < - // 0) + if (SDL_Init (SDL_INIT_VIDEO) < 0) Sys_Error ("VID: Couldn't load SDL: %s", SDL_GetError ()); // Set up display mode (width and height) diff --git a/nq/include/client.h b/nq/include/client.h index b188e2b28..da079d2e7 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -64,7 +64,7 @@ typedef struct int frags; int colors; // two 4 bit fields int _colors; - byte translations[VID_GRADES*256]; + byte translations[4*VID_GRADES*256]; // space for colormap32 } scoreboard_t; #define NAME_LENGTH 64 diff --git a/qw/include/client.h b/qw/include/client.h index d94d8d4d8..23cecaef5 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -92,7 +92,7 @@ typedef struct player_info_s int _bottomcolor; int spectator; - byte translations[VID_GRADES*256]; + byte translations[4*VID_GRADES*256]; // space for colormap32 struct skin_s *skin; } player_info_t;