Fixes to 256-color mode
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "doomgeneric.h"
|
||||
|
||||
uint32_t* DG_ScreenBuffer = 0;
|
||||
pixel_t* DG_ScreenBuffer = NULL;
|
||||
|
||||
void M_FindResponseFile(void);
|
||||
void D_DoomMain (void);
|
||||
|
||||
@@ -13,7 +13,18 @@
|
||||
#endif // DOOMGENERIC_RESY
|
||||
|
||||
|
||||
extern uint32_t* DG_ScreenBuffer;
|
||||
#ifdef CMAP256
|
||||
|
||||
typedef uint8_t pixel_t;
|
||||
|
||||
#else // CMAP256
|
||||
|
||||
typedef uint32_t pixel_t;
|
||||
|
||||
#endif // CMAP256
|
||||
|
||||
|
||||
extern pixel_t* DG_ScreenBuffer;
|
||||
|
||||
void doomgeneric_Create(int argc, char **argv);
|
||||
void doomgeneric_Tick();
|
||||
|
||||
+34
-8
@@ -75,15 +75,20 @@ static struct FB_ScreenInfo s_Fb;
|
||||
int fb_scaling = 1;
|
||||
int usemouse = 0;
|
||||
|
||||
struct color {
|
||||
uint32_t b:8;
|
||||
uint32_t g:8;
|
||||
uint32_t r:8;
|
||||
uint32_t a:8;
|
||||
};
|
||||
|
||||
#ifdef CMAP256
|
||||
|
||||
boolean palette_changed;
|
||||
struct color colors[256];
|
||||
|
||||
#else // CMAP256
|
||||
|
||||
static struct color colors[256];
|
||||
|
||||
|
||||
#endif // CMAP256
|
||||
|
||||
|
||||
void I_GetEvent(void);
|
||||
|
||||
// The screen buffer; this is modified to draw things to the screen
|
||||
@@ -183,6 +188,13 @@ void I_InitGraphics (void)
|
||||
s_Fb.yres = DOOMGENERIC_RESY;
|
||||
s_Fb.xres_virtual = s_Fb.xres;
|
||||
s_Fb.yres_virtual = s_Fb.yres;
|
||||
|
||||
#ifdef CMAP256
|
||||
|
||||
s_Fb.bits_per_pixel = 8;
|
||||
|
||||
#else // CMAP256
|
||||
|
||||
s_Fb.bits_per_pixel = 32;
|
||||
|
||||
s_Fb.blue.length = 8;
|
||||
@@ -195,6 +207,7 @@ void I_InitGraphics (void)
|
||||
s_Fb.red.offset = 16;
|
||||
s_Fb.transp.offset = 24;
|
||||
|
||||
#endif // CMAP256
|
||||
|
||||
printf("I_InitGraphics: framebuffer: x_res: %d, y_res: %d, x_virtual: %d, y_virtual: %d, bpp: %d\n",
|
||||
s_Fb.xres, s_Fb.yres, s_Fb.xres_virtual, s_Fb.yres_virtual, s_Fb.bits_per_pixel);
|
||||
@@ -277,10 +290,17 @@ void I_FinishUpdate (void)
|
||||
for (i = 0; i < fb_scaling; i++) {
|
||||
line_out += x_offset;
|
||||
#ifdef CMAP256
|
||||
for (fb_scaling == 1) {
|
||||
if (fb_scaling == 1) {
|
||||
memcpy(line_out, line_in, SCREENWIDTH); /* fb_width is bigger than Doom SCREENWIDTH... */
|
||||
} else {
|
||||
//XXX FIXME fb_scaling support!
|
||||
int j;
|
||||
|
||||
for (j = 0; j < SCREENWIDTH; j++) {
|
||||
int k;
|
||||
for (k = 0; k < fb_scaling; k++) {
|
||||
line_out[j * fb_scaling + k] = line_in[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
//cmap_to_rgb565((void*)line_out, (void*)line_in, SCREENWIDTH);
|
||||
@@ -336,6 +356,12 @@ void I_SetPalette (byte* palette)
|
||||
colors[i].g = gammatable[usegamma][*palette++];
|
||||
colors[i].b = gammatable[usegamma][*palette++];
|
||||
}
|
||||
|
||||
#ifdef CMAP256
|
||||
|
||||
palette_changed = true;
|
||||
|
||||
#endif // CMAP256
|
||||
}
|
||||
|
||||
// Given an RGB value, find the closest matching palette index.
|
||||
|
||||
@@ -138,6 +138,14 @@ void I_EnableLoadingDisk(void);
|
||||
|
||||
void I_EndRead (void);
|
||||
|
||||
struct color {
|
||||
uint32_t b:8;
|
||||
uint32_t g:8;
|
||||
uint32_t r:8;
|
||||
uint32_t a:8;
|
||||
};
|
||||
|
||||
|
||||
extern char *video_driver;
|
||||
extern boolean screenvisible;
|
||||
|
||||
@@ -157,4 +165,11 @@ extern int aspect_ratio_correct;
|
||||
extern int show_diskicon;
|
||||
extern int diskicon_readbytes;
|
||||
|
||||
#ifdef CMAP256
|
||||
|
||||
extern boolean palette_changed;
|
||||
extern struct color colors[256];
|
||||
|
||||
#endif // CMAP256
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user