From 4ed75b014a55e0c6f16d119425dde4aa527e0083 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 25 Aug 2001 03:52:34 +0000 Subject: [PATCH] "Yay, it builds!" "Ah, but does it work?" --- libs/video/renderer/sw32/screen.c | 7 +++ libs/video/renderer/sw32/sw32_redge.c | 10 ----- libs/video/renderer/sw32/sw32_skin.c | 5 +++ libs/video/targets/Makefile.am | 2 +- libs/video/targets/vid_common_sw32.c | 61 +++++++++++++++++++++++++++ libs/video/targets/vid_sdl32.c | 6 +++ 6 files changed, 80 insertions(+), 11 deletions(-) diff --git a/libs/video/renderer/sw32/screen.c b/libs/video/renderer/sw32/screen.c index 879fddfb2..8dc7d2201 100644 --- a/libs/video/renderer/sw32/screen.c +++ b/libs/video/renderer/sw32/screen.c @@ -963,3 +963,10 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap) VID_Update (&vrect); } } + +void +VID_ShiftPalette (unsigned char *p) +{ + VID_SetPalette (p); +} + diff --git a/libs/video/renderer/sw32/sw32_redge.c b/libs/video/renderer/sw32/sw32_redge.c index 903e9bd32..4a83454ee 100644 --- a/libs/video/renderer/sw32/sw32_redge.c +++ b/libs/video/renderer/sw32/sw32_redge.c @@ -366,9 +366,6 @@ R_TrailingEdge (surf_t *surf, edge_t *edge) // don't generate a span if this is an inverted span, with the end edge // preceding the start edge (that is, we haven't seen the start edge yet) if (--surf->spanstate == 0) { - if (surf->insubmodel) - r_bmodelactive--; - if (surf == surfaces[1].next) { // emit a span (current top going away) iu = edge->u >> 20; @@ -404,9 +401,6 @@ R_LeadingEdge (edge_t *edge) // don't start a span if this is an inverted span, with the end edge // preceding the start edge (that is, we've already seen the end edge) if (++surf->spanstate == 1) { - if (surf->insubmodel) - r_bmodelactive++; - surf2 = surfaces[1].next; if (surf->key < surf2->key) @@ -504,8 +498,6 @@ R_GenerateSpans (void) edge_t *edge; surf_t *surf; - r_bmodelactive = 0; - // clear active surfaces to just the background surface surfaces[1].next = surfaces[1].prev = &surfaces[1]; surfaces[1].last_u = edge_head_u_shift20; @@ -533,8 +525,6 @@ R_GenerateSpansBackward (void) { edge_t *edge; - r_bmodelactive = 0; - // clear active surfaces to just the background surface surfaces[1].next = surfaces[1].prev = &surfaces[1]; surfaces[1].last_u = edge_head_u_shift20; diff --git a/libs/video/renderer/sw32/sw32_skin.c b/libs/video/renderer/sw32/sw32_skin.c index a3c3382d5..ba95ea385 100644 --- a/libs/video/renderer/sw32/sw32_skin.c +++ b/libs/video/renderer/sw32/sw32_skin.c @@ -176,6 +176,11 @@ Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin) { } +void +Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin) +{ +} + void Skin_Init_Translation (void) { diff --git a/libs/video/targets/Makefile.am b/libs/video/targets/Makefile.am index 60c145ef6..bb732389f 100644 --- a/libs/video/targets/Makefile.am +++ b/libs/video/targets/Makefile.am @@ -64,7 +64,7 @@ libQFsdl.la: $(libQFsdl_la_OBJECTS) $(libQFsdl_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libQFsdl_la_LDFLAGS) $(libQFsdl_la_OBJECTS) $(libQFsdl_la_LIBADD) $(LIBS) libQFsdl32_la_LDFLAGS= -version-info 1:0:0 -libQFsdl32_la_SOURCES= $(in_common_SOURCE) in_sdl.c vid.c vid_common_sw.c vid_sdl32.c +libQFsdl32_la_SOURCES= $(in_common_SOURCE) in_sdl.c vid.c vid_common_sw32.c vid_sdl32.c libQFsdl32.la: $(libQFsdl32_la_OBJECTS) $(libQFsdl32_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libQFsdl32_la_LDFLAGS) $(libQFsdl32_la_OBJECTS) $(libQFsdl32_la_LIBADD) $(LIBS) diff --git a/libs/video/targets/vid_common_sw32.c b/libs/video/targets/vid_common_sw32.c index 1683cf3e6..033f9d9ad 100644 --- a/libs/video/targets/vid_common_sw32.c +++ b/libs/video/targets/vid_common_sw32.c @@ -36,6 +36,8 @@ #include "QF/va.h" #include "QF/vid.h" +#include "compat.h" + extern viddef_t vid; // global video state int scr_width, scr_height; @@ -199,3 +201,62 @@ VID_MakeColormaps (int fullbrights, byte *pal) VID_MakeColormap16(vid.colormap16, pal); VID_MakeColormap32(vid.colormap32, pal); } + + +void +VID_InitBuffers (void) +{ + int buffersize, zbuffersize, cachesize = 1; + void *vid_surfcache; + + // Calculate the sizes we want first + buffersize = vid.rowbytes * vid.height; + zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer); + if (vid.surf_cache_size) + cachesize = vid.surf_cache_size (vid.width, vid.height); + + // Free the old z-buffer + if (vid.zbuffer) { + free (vid.zbuffer); + vid.zbuffer = NULL; + } + // Free the old surface cache + if (vid.surfcache) { + if (vid.flush_caches) + vid.flush_caches (); + free (vid.surfcache); + vid.surfcache = NULL; + } + if (vid.do_screen_buffer) { + vid.do_screen_buffer (); + } else { + // Free the old screen buffer + if (vid.buffer) { + free (vid.buffer); + vid.conbuffer = vid.buffer = NULL; + } + // Allocate the new screen buffer + vid.conbuffer = vid.buffer = calloc (buffersize, 1); + if (!vid.conbuffer) { + Sys_Error ("Not enough memory for video mode\n"); + } + } + // Allocate the new z-buffer + vid.zbuffer = calloc (zbuffersize, 1); + if (!vid.zbuffer) { + free (vid.buffer); + vid.conbuffer = vid.buffer = NULL; + 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) { + free (vid.buffer); + free (vid.zbuffer); + vid.zbuffer = NULL; + Sys_Error ("Not enough memory for video mode\n"); + } + + if (vid.init_caches) + vid.init_caches (vid.surfcache, cachesize); +} diff --git a/libs/video/targets/vid_sdl32.c b/libs/video/targets/vid_sdl32.c index 5863c4ffe..e951be4ae 100644 --- a/libs/video/targets/vid_sdl32.c +++ b/libs/video/targets/vid_sdl32.c @@ -281,3 +281,9 @@ VID_SetCaption (const char *text) } else SDL_WM_SetCaption (va ("%s %s", PROGRAM, VERSION), NULL); } + +qboolean +VID_SetGamma (double gamma) +{ + return false; //FIXME +}