various init order fixes and a */[] snafu sorted

also make translations big enough for the 32 bit colors
This commit is contained in:
Bill Currie 2001-08-25 05:54:21 +00:00
parent 2634b447b5
commit 2a027969d5
8 changed files with 17 additions and 12 deletions

View File

@ -31,7 +31,7 @@
#endif #endif
#include "QF/cvar.h" #include "QF/cvar.h"
// #include "QF/render.h" #include "QF/render.h"
// #include "QF/vid.h" // #include "QF/vid.h"
#include "compat.h" #include "compat.h"
@ -65,13 +65,18 @@ D_Init (void)
r_aliasuvscale = 1.0; r_aliasuvscale = 1.0;
// LordHavoc: compute 1/zi table for use in rendering code everywhere // LordHavoc: compute 1/zi table for use in rendering code everywhere
if (!d_zitable[1]) if (!d_zitable[1]) {
{
int i; int i;
d_zitable[0] = 0; d_zitable[0] = 0;
for (i = 1;i < 65536;i++) for (i = 1;i < 65536;i++)
d_zitable[i] = (65536.0 * 65536.0 / (double) 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 void

View File

@ -46,7 +46,7 @@ int r_turb_spancount;
void D_DrawTurbulentSpan (void); void D_DrawTurbulentSpan (void);
extern float *d_zitable; extern float d_zitable[65536];
/* /*

View File

@ -39,7 +39,7 @@ static int sprite_height;
static int minindex, maxindex; static int minindex, maxindex;
static sspan_t *sprite_spans; static sspan_t *sprite_spans;
extern float *d_zitable; extern float d_zitable[65536];
void void

View File

@ -111,6 +111,8 @@ D_InitCaches (void *buffer, int size)
sc_base->owner = NULL; sc_base->owner = NULL;
sc_base->size = sc_size; sc_base->size = sc_size;
d_pzbuffer = vid.zbuffer;
D_ClearCacheGuard (); D_ClearCacheGuard ();
} }

View File

@ -210,7 +210,6 @@ void
VID_InitBuffers (void) VID_InitBuffers (void)
{ {
int buffersize, zbuffersize, cachesize = 1; int buffersize, zbuffersize, cachesize = 1;
void *vid_surfcache;
// Calculate the sizes we want first // Calculate the sizes we want first
buffersize = vid.rowbytes * vid.height; buffersize = vid.rowbytes * vid.height;
@ -252,8 +251,8 @@ VID_InitBuffers (void)
Sys_Error ("Not enough memory for video mode\n"); Sys_Error ("Not enough memory for video mode\n");
} }
// Allocate the new surface cache; free the z-buffer if we fail // Allocate the new surface cache; free the z-buffer if we fail
vid_surfcache = calloc (cachesize, 1); vid.surfcache = calloc (cachesize, 1);
if (!vid_surfcache) { if (!vid.surfcache) {
free (vid.buffer); free (vid.buffer);
free (vid.zbuffer); free (vid.zbuffer);
vid.zbuffer = NULL; vid.zbuffer = NULL;

View File

@ -95,8 +95,7 @@ VID_Init (unsigned char *palette)
Uint32 flags; Uint32 flags;
// Load the SDL library // Load the SDL library
if (SDL_Init (SDL_INIT_VIDEO) < 0) // |SDL_INIT_AUDIO|SDL_INIT_CDROM) < if (SDL_Init (SDL_INIT_VIDEO) < 0)
// 0)
Sys_Error ("VID: Couldn't load SDL: %s", SDL_GetError ()); Sys_Error ("VID: Couldn't load SDL: %s", SDL_GetError ());
// Set up display mode (width and height) // Set up display mode (width and height)

View File

@ -64,7 +64,7 @@ typedef struct
int frags; int frags;
int colors; // two 4 bit fields int colors; // two 4 bit fields
int _colors; int _colors;
byte translations[VID_GRADES*256]; byte translations[4*VID_GRADES*256]; // space for colormap32
} scoreboard_t; } scoreboard_t;
#define NAME_LENGTH 64 #define NAME_LENGTH 64

View File

@ -92,7 +92,7 @@ typedef struct player_info_s
int _bottomcolor; int _bottomcolor;
int spectator; int spectator;
byte translations[VID_GRADES*256]; byte translations[4*VID_GRADES*256]; // space for colormap32
struct skin_s *skin; struct skin_s *skin;
} player_info_t; } player_info_t;