diff --git a/2dlib/surface.cpp b/2dlib/surface.cpp index 5114d128..c414b998 100644 --- a/2dlib/surface.cpp +++ b/2dlib/surface.cpp @@ -266,11 +266,8 @@ void grSurface::load(char *data, int w, int h, char *pal) { switch (ddsfObj.bpp) { case BPP_16: - if (Renderer_type == RENDERER_SOFTWARE_8BIT) - xlat8_16(data, w, h, pal); - else - xlat16_16(data, w, h); - break; + // TODO: This is probably software renderer only? + xlat16_16(data, w, h); default: Int3(); // NOT SUPPORTED YET } diff --git a/Descent3/game.cpp b/Descent3/game.cpp index 3d932c5b..8b4f23c0 100644 --- a/Descent3/game.cpp +++ b/Descent3/game.cpp @@ -1233,25 +1233,13 @@ void StartFrame(int x, int y, int x2, int y2, bool clear, bool push_on_stack) { last_fov = Render_FOV; } - // for software renderers perform frame buffer lock. - if (Renderer_type == RENDERER_SOFTWARE_16BIT) { - int w, h, color_depth, pitch; - ubyte *data; - - ddvid_GetVideoProperties(&w, &h, &color_depth); - ddvid_LockFrameBuffer(&data, &pitch); - rend_SetSoftwareParameters(ddvid_GetAspectRatio(), w, h, pitch, data); - } - if (push_on_stack) { // push this frame onto the stack FramePush(x, y, x2, y2, clear); } rend_StartFrame(x, y, x2, y2); - if (Renderer_type == RENDERER_SOFTWARE_16BIT && clear) { - rend_FillRect(GR_RGB(0, 0, 0), x, y, x2, y2); - } + grtext_SetParameters(0, 0, (x2 - x), (y2 - y)); } @@ -1273,11 +1261,6 @@ void EndFrame() { //@@Frame_inside = false; rend_EndFrame(); - // for software renderers perform unlock on frame buffer. - if (Renderer_type == RENDERER_SOFTWARE_16BIT) { - ddvid_UnlockFrameBuffer(); - } - // pop off frame int x1, x2, y1, y2; bool clear; diff --git a/Descent3/init.cpp b/Descent3/init.cpp index 7aa4708b..f0f140f5 100644 --- a/Descent3/init.cpp +++ b/Descent3/init.cpp @@ -1484,12 +1484,6 @@ void LoadGameSettings() { int len = _MAX_PATH; Database->read("Default_pilot", Default_pilot, &len); - // If preferred renderer set to software, force it to be glide - if ((PreferredRenderer == RENDERER_SOFTWARE_8BIT) || (PreferredRenderer == RENDERER_SOFTWARE_16BIT)) { - Int3(); // Warning: rederer was set to Software. Ok to ignore this. - PreferredRenderer = RENDERER_OPENGL; - } - // Now that we have read in all the data, set the detail level if it is a predef setting (custom is ignored in // function) diff --git a/bitmap/tga.cpp b/bitmap/tga.cpp index c88b68f3..b1d2e8fc 100644 --- a/bitmap/tga.cpp +++ b/bitmap/tga.cpp @@ -322,69 +322,6 @@ int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int typ return 1; } -// Reads a 8bit bitmap into memory -// Note: Even if we're are not using an 8bit renderer this routine still needs -// to be called due to the fact that we need to 'move' our position in the file -// We also need to extract the palette number - -/*int bm_tga_read_outrage_compressed8 (CFILE *infile,int n) -{ - - ubyte pal_num=tga_read_byte (); - ubyte num_mips=tga_read_byte (); - - ASSERT (pal_num>=0 && pal_num<=MAX_BITMAP_PALETTES); - if (num_mips>1) - GameBitmaps[n].mipmapped=1; - - GameBitmaps[n].palette_num=pal_num; - - for (int m=0;m=2 && command<=250) // next pixel is run of pixels - { - ubyte pixel=tga_read_byte (); - for (int k=0;k -1); - - *w = DDVideo_info.DDModes[DDVideo_info.curmode].dwWidth; - *h = DDVideo_info.DDModes[DDVideo_info.curmode].dwHeight; - *color_depth = (int)DDVideo_info.DDModes[DDVideo_info.curmode].ddpfPixelFormat.dwRGBBitCount; -} - // flips screen if there's a back buffer void ddvidfs_VideoFlip() { if (DDVideo_info.lpDDSBack) diff --git a/dd_vidwin32/video_win32.cpp b/dd_vidwin32/video_win32.cpp index 25accc0f..0efc372f 100644 --- a/dd_vidwin32/video_win32.cpp +++ b/dd_vidwin32/video_win32.cpp @@ -188,126 +188,3 @@ bool ddvid_SetVideoMode(int w, int h, int color_depth, bool paged) { // sets screen handle void ddvid_SetVideoHandle(unsigned handle) { DDVideo_info.hVidWnd = (HWND)handle; } - -// retrieves screen information -void ddvid_GetVideoProperties(int *w, int *h, int *color_depth) { - ASSERT(DDVideo_init); - - switch (DDVideo_info.subsystem) { - case VID_GDIF_SUBSYSTEM: - case VID_GDI_SUBSYSTEM: - ddvidwin_GetVideoProperties(w, h, color_depth); - break; - case VID_GDIX_SUBSYSTEM: - ddvidfs_GetVideoProperties(w, h, color_depth); - break; - case VID_DX_SUBSYSTEM: - ddvidfs_GetVideoProperties(w, h, color_depth); - break; - default: - Int3(); - } -} - -// retrieves screen aspect ratio. -float ddvid_GetAspectRatio() { - float aspect_ratio = (float)((3.0 * GetSystemMetrics(SM_CXSCREEN)) / (4.0 * GetSystemMetrics(SM_CYSCREEN))); - return aspect_ratio; -} - -// only available to DD_ACCESS libraries. -// dd_obj is the DIRECTDRAW OBJECT for the system. -// dds_obj is the DIRECTDRAWSURFACE OBJECT for the screen -void ddvid_GetVideoDDrawProps(uint *dd_obj, uint *dds_obj) { - switch (DDVideo_info.subsystem) { - case VID_GDIX_SUBSYSTEM: - *dd_obj = NULL; - break; - case VID_DX_SUBSYSTEM: - *dd_obj = ddvidfs_GetDirectDrawObject(); - break; - } - - *dds_obj = NULL; -} - -// flips screen if there's a back buffer -void ddvid_VideoFlip() { - switch (DDVideo_info.subsystem) { - case VID_GDIF_SUBSYSTEM: - case VID_GDI_SUBSYSTEM: - ddvidwin_VideoFlip(); - break; - case VID_GDIX_SUBSYSTEM: - ddvidwin_VideoFlip(); - break; - case VID_DX_SUBSYSTEM: - ddvidfs_VideoFlip(); - break; - default: - Int3(); - } -} - -// retreives frame buffer info for a video mode. -void ddvid_LockFrameBuffer(ubyte **data, int *pitch) { - // locks a direct draw paged surface or a paged window. unpaged buffers won't lock. - ASSERT(DDVideo_init); - - switch (DDVideo_info.subsystem) { - case VID_GDIF_SUBSYSTEM: - case VID_GDI_SUBSYSTEM: { - *data = (ubyte *)DDVideo_info.gdi.data; - *pitch = DDVideo_info.gdi.pitch; - } break; - case VID_GDIX_SUBSYSTEM: { - *data = (ubyte *)DDVideo_info.gdi.data; - *pitch = DDVideo_info.gdi.pitch; - } break; - case VID_DX_SUBSYSTEM: { - HRESULT hres; - DDSURFACEDESC ddsd; - - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - - if (DDVideo_info.lpDDSBack) { - hres = DDVideo_info.lpDDSBack->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL); - if (hres != DD_OK) { - Error("Unable to set lock DirectDraw surface(%d)\n", LOWORD(hres)); - } - *pitch = (int)ddsd.lPitch; - *data = (ubyte *)ddsd.lpSurface; - DDVideo_info.surf_data = (char *)(*data); - } else { - *data = NULL; - *pitch = 0; - } - } break; - default: - Int3(); - } -} - -void ddvid_UnlockFrameBuffer() { - ASSERT(DDVideo_init); - - switch (DDVideo_info.subsystem) { - case VID_GDIF_SUBSYSTEM: - case VID_GDI_SUBSYSTEM: - case VID_GDIX_SUBSYSTEM: - break; - case VID_DX_SUBSYSTEM: { - HRESULT hres; - - if (DDVideo_info.lpDDSBack) { - hres = DDVideo_info.lpDDSBack->Unlock(DDVideo_info.surf_data); - if (hres != DD_OK) - Error("Unable to unlock DirectDraw surface(%d)\n", LOWORD(hres)); - DDVideo_info.surf_data = NULL; - } - } break; - default: - Int3(); - } -} diff --git a/ddvid_lnx/video_lnx.cpp b/ddvid_lnx/video_lnx.cpp index 98b9ef5e..4720ff9a 100644 --- a/ddvid_lnx/video_lnx.cpp +++ b/ddvid_lnx/video_lnx.cpp @@ -153,59 +153,3 @@ bool ddvid_SetVideoMode(int w, int h, int color_depth, bool paged) { // sets screen handle void ddvid_SetVideoHandle(unsigned handle) {} - -// retrieves screen information -void ddvid_GetVideoProperties(int *w, int *h, int *color_depth) { - *w = 640; - *h = 480; - *color_depth = 16; - - /* - ASSERT(DDVideo_init); - if(!DDVideo_info.info){ - *w = *h = *color_depth = 0; - return; - } - *w = DDVideo_info.info->width; - *h = DDVideo_info.info->height; - *color_depth = DDVideo_info.info->bytesperpixel; - */ -} - -// retrieves screen aspect ratio. -float ddvid_GetAspectRatio() { - /* - float aspect_ratio = (float)((3.0 * vga_getxdim())/(4.0 * vga_getydim())); - return aspect_ratio; - */ - return 0.75f; -} - -// flips screen if there's a back buffer -void ddvid_VideoFlip() { - if (!DDVideo_info.paged) - return; - // vga_flip(); -} - -// retreives frame buffer info for a video mode. -void ddvid_LockFrameBuffer(ubyte **data, int *pitch) { - *data = NULL; - *pitch = 0; - - /* - ASSERT(DDVideo_init); - if(!DDVideo_info.info){ - *data = NULL; - *pitch = 0; - return; - } - - // *data = vga_getgraphmem(); - *pitch = DDVideo_info.info->linewidth; - */ -} - -void ddvid_UnlockFrameBuffer() { - // ASSERT(DDVideo_init); -} diff --git a/lib/ddvid.h b/lib/ddvid.h index 2d886baa..f4a98649 100644 --- a/lib/ddvid.h +++ b/lib/ddvid.h @@ -59,29 +59,4 @@ bool ddvid_SetVideoMode(int w, int h, int color_depth, bool paged); // sets screen handle void ddvid_SetVideoHandle(unsigned handle); -// retrieves screen information -void ddvid_GetVideoProperties(int *w, int *h, int *color_depth); - -// retrieves screen aspect ratio. -float ddvid_GetAspectRatio(); - -// retreives frame buffer info for a video mode. -void ddvid_LockFrameBuffer(ubyte **data, int *pitch); -void ddvid_UnlockFrameBuffer(); - -// flips screen if there's a back buffer -void ddvid_VideoFlip(); - -// only available to DD_ACCESS libraries. -#if defined(DD_ACCESS_RING) -#if defined(WIN32) - -// dd_obj is the DIRECTDRAW OBJECT for the system. -// dds_obj is the DIRECTDRAWSURFACE OBJECT for the screen -void ddvid_GetVideoDDrawProps(uint *dd_obj, uint *dds_obj); - -#endif // WIN32 - -#endif // DD_ACCESS - #endif diff --git a/lib/renderer.h b/lib/renderer.h index 58b204a8..f3f37a41 100644 --- a/lib/renderer.h +++ b/lib/renderer.h @@ -316,8 +316,6 @@ extern int Triangles_drawn; // Is this hardware or software rendered? typedef enum { - RENDERER_SOFTWARE_8BIT, - RENDERER_SOFTWARE_16BIT, RENDERER_OPENGL, RENDERER_DIRECT3D, RENDERER_GLIDE, diff --git a/ui/UIDraw.cpp b/ui/UIDraw.cpp index c205f7f0..7e960c9f 100644 --- a/ui/UIDraw.cpp +++ b/ui/UIDraw.cpp @@ -100,16 +100,6 @@ static int m_UITextFlags = 0; // DRAWING PRIMATIVE FUNCTIONS void ui_StartDraw(int left, int top, int right, int bottom) { - // for software renderers perform frame buffer lock. - if (Renderer_type == RENDERER_SOFTWARE_16BIT) { - int w, h, color_depth, pitch; - ubyte *data; - - ddvid_GetVideoProperties(&w, &h, &color_depth); - ddvid_LockFrameBuffer(&data, &pitch); - rend_SetSoftwareParameters(ddvid_GetAspectRatio(), w, h, pitch, data); - } - m_UIDrawLeft = left; m_UIDrawTop = top; m_UIDrawRight = right; @@ -123,11 +113,6 @@ void ui_StartDraw(int left, int top, int right, int bottom) { void ui_EndDraw() { grtext_Flush(); rend_EndFrame(); - - // for software renderers perform unlock on frame buffer. - if (Renderer_type == RENDERER_SOFTWARE_16BIT) { - ddvid_UnlockFrameBuffer(); - } } // sets text clipping within the startdraw region