ref: df05cd8e0e71b4e48e88f12c779484e1abac45c1
parent: fa5c42dc122c8171743b4ac0471571f3e4a49003
parent: 38016635252144789edca209a208a8cdb0387c3a
author: Simon Howard <fraggle+github@gmail.com>
date: Fri Jan 13 19:08:25 EST 2017
Merge pull request #838 from chocolate-doom/pixel_t introduce a pixel_t type
--- a/src/doom/am_map.c
+++ b/src/doom/am_map.c
@@ -211,7 +211,7 @@
static int f_h;
static int lightlev; // used for funky strobing effect
-static byte* fb; // pseudo-frame buffer
+static pixel_t* fb; // pseudo-frame buffer
static int amclock;
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -227,7 +227,7 @@
void F_TextWrite (void)
{
byte* src;
- byte* dest;
+ pixel_t* dest;
int x,y,w;
signed int count;
@@ -576,8 +576,8 @@
{
column_t* column;
byte* source;
- byte* dest;
- byte* desttop;
+ pixel_t* dest;
+ pixel_t* desttop;
int count;
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
--- a/src/doom/f_wipe.c
+++ b/src/doom/f_wipe.c
@@ -34,22 +34,22 @@
// when zero, stop the wipe
static boolean go = 0;
-static byte* wipe_scr_start;
-static byte* wipe_scr_end;
-static byte* wipe_scr;
+static pixel_t* wipe_scr_start;
+static pixel_t* wipe_scr_end;
+static pixel_t* wipe_scr;
void
wipe_shittyColMajorXform
-( short* array,
+( dpixel_t* array,
int width,
int height )
{
int x;
int y;
- short* dest;
+ dpixel_t* dest;
- dest = (short*) Z_Malloc(width*height*sizeof(*dest), PU_STATIC, 0);
+ dest = (dpixel_t*) Z_Malloc(width*height*sizeof(*dest), PU_STATIC, 0);
for(y=0;y<height;y++)
for(x=0;x<width;x++)
@@ -78,8 +78,8 @@
int ticks )
{
boolean changed;
- byte* w;
- byte* e;
+ pixel_t* w;
+ pixel_t* e;
int newval;
changed = false;
@@ -142,8 +142,8 @@
// makes this wipe faster (in theory)
// to have stuff in column-major format
- wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height);
- wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height);
+ wipe_shittyColMajorXform((dpixel_t*)wipe_scr_start, width/2, height);
+ wipe_shittyColMajorXform((dpixel_t*)wipe_scr_end, width/2, height);
// setup initial column positions
// (y<0 => not ready to scroll yet)
@@ -171,8 +171,8 @@
int dy;
int idx;
- short* s;
- short* d;
+ dpixel_t* s;
+ dpixel_t* d;
boolean done = true;
width/=2;
@@ -189,8 +189,8 @@
{
dy = (y[i] < 16) ? y[i]+1 : 8;
if (y[i]+dy >= height) dy = height - y[i];
- s = &((short *)wipe_scr_end)[i*height+y[i]];
- d = &((short *)wipe_scr)[y[i]*width+i];
+ s = &((dpixel_t *)wipe_scr_end)[i*height+y[i]];
+ d = &((dpixel_t *)wipe_scr)[y[i]*width+i];
idx = 0;
for (j=dy;j;j--)
{
@@ -198,8 +198,8 @@
idx += width;
}
y[i] += dy;
- s = &((short *)wipe_scr_start)[i*height];
- d = &((short *)wipe_scr)[y[i]*width+i];
+ s = &((dpixel_t *)wipe_scr_start)[i*height];
+ d = &((dpixel_t *)wipe_scr)[y[i]*width+i];
idx = 0;
for (j=height-y[i];j;j--)
{
@@ -272,7 +272,7 @@
if (!go)
{
go = 1;
- // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
+ // wipe_scr = (pixel_t *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
wipe_scr = I_VideoBuffer;
(*wipes[wipeno*3])(width, height, ticks);
}
--- a/src/doom/r_defs.h
+++ b/src/doom/r_defs.h
@@ -295,7 +295,7 @@
// precalculating 24bpp lightmap/colormap LUT.
// from darkening PLAYPAL to all black.
// Could even us emore than 32 levels.
-typedef byte lighttable_t;
+typedef pixel_t lighttable_t;
--- a/src/doom/r_draw.c
+++ b/src/doom/r_draw.c
@@ -60,7 +60,7 @@
int viewheight;
int viewwindowx;
int viewwindowy;
-byte* ylookup[MAXHEIGHT];
+pixel_t* ylookup[MAXHEIGHT];
int columnofs[MAXWIDTH];
// Color tables for different players,
@@ -72,7 +72,7 @@
// Backing buffer containing the bezel drawn around the screen and
// surrounding background.
-static byte *background_buffer = NULL;
+static pixel_t *background_buffer = NULL;
//
@@ -102,7 +102,7 @@
void R_DrawColumn (void)
{
int count;
- byte* dest;
+ pixel_t* dest;
fixed_t frac;
fixed_t fracstep;
@@ -208,8 +208,8 @@
void R_DrawColumnLow (void)
{
int count;
- byte* dest;
- byte* dest2;
+ pixel_t* dest;
+ pixel_t* dest2;
fixed_t frac;
fixed_t fracstep;
int x;
@@ -283,7 +283,7 @@
void R_DrawFuzzColumn (void)
{
int count;
- byte* dest;
+ pixel_t* dest;
fixed_t frac;
fixed_t fracstep;
@@ -342,8 +342,8 @@
void R_DrawFuzzColumnLow (void)
{
int count;
- byte* dest;
- byte* dest2;
+ pixel_t* dest;
+ pixel_t* dest2;
fixed_t frac;
fixed_t fracstep;
int x;
@@ -424,7 +424,7 @@
void R_DrawTranslatedColumn (void)
{
int count;
- byte* dest;
+ pixel_t* dest;
fixed_t frac;
fixed_t fracstep;
@@ -468,8 +468,8 @@
void R_DrawTranslatedColumnLow (void)
{
int count;
- byte* dest;
- byte* dest2;
+ pixel_t* dest;
+ pixel_t* dest2;
fixed_t frac;
fixed_t fracstep;
int x;
@@ -590,7 +590,7 @@
void R_DrawSpan (void)
{
unsigned int position, step;
- byte *dest;
+ pixel_t *dest;
int count;
int spot;
unsigned int xtemp, ytemp;
@@ -649,7 +649,7 @@
byte* source;
byte* colormap;
- byte* dest;
+ pixel_t* dest;
unsigned count;
usingned spot;
@@ -720,7 +720,7 @@
{
unsigned int position, step;
unsigned int xtemp, ytemp;
- byte *dest;
+ pixel_t *dest;
int count;
int spot;
@@ -812,7 +812,7 @@
void R_FillBackScreen (void)
{
byte* src;
- byte* dest;
+ pixel_t* dest;
int x;
int y;
patch_t* patch;
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -260,7 +260,7 @@
#define ST_MAPHEIGHT 1
// graphics are drawn to a backing screen and blitted to the real screen
-byte *st_backing_screen;
+pixel_t *st_backing_screen;
// main player in game
static player_t* plyr;
@@ -1430,6 +1430,6 @@
void ST_Init (void)
{
ST_loadData();
- st_backing_screen = (byte *) Z_Malloc(ST_WIDTH * ST_HEIGHT * sizeof(*st_backing_screen), PU_STATIC, 0);
+ st_backing_screen = (pixel_t *) Z_Malloc(ST_WIDTH * ST_HEIGHT * sizeof(*st_backing_screen), PU_STATIC, 0);
}
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -90,6 +90,8 @@
#endif
typedef uint8_t byte;
+typedef uint8_t pixel_t;
+typedef int16_t dpixel_t;
#include <limits.h>
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -140,7 +140,7 @@
// The screen buffer; this is modified to draw things to the screen
-byte *I_VideoBuffer = NULL;
+pixel_t *I_VideoBuffer = NULL;
// If true, game is running as a screensaver
@@ -725,7 +725,7 @@
//
// I_ReadScreen
//
-void I_ReadScreen (byte* scr)
+void I_ReadScreen (pixel_t* scr)
{
memcpy(scr, I_VideoBuffer, SCREENWIDTH*SCREENHEIGHT*sizeof(*scr));
}
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -49,7 +49,7 @@
void I_UpdateNoBlit (void);
void I_FinishUpdate (void);
-void I_ReadScreen (byte* scr);
+void I_ReadScreen (pixel_t* scr);
void I_BeginRead (void);
@@ -84,7 +84,7 @@
extern int vanilla_keyboard_mapping;
extern boolean screensaver_mode;
extern int usegamma;
-extern byte *I_VideoBuffer;
+extern pixel_t *I_VideoBuffer;
extern int screen_width;
extern int screen_height;
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -56,7 +56,7 @@
// The screen buffer that the v_video.c code draws to.
-static byte *dest_screen = NULL;
+static pixel_t *dest_screen = NULL;
int dirtybox[4];
@@ -83,12 +83,12 @@
//
// V_CopyRect
//
-void V_CopyRect(int srcx, int srcy, byte *source,
+void V_CopyRect(int srcx, int srcy, pixel_t *source,
int width, int height,
int destx, int desty)
{
- byte *src;
- byte *dest;
+ pixel_t *src;
+ pixel_t *dest;
#ifdef RANGECHECK
if (srcx < 0
@@ -142,8 +142,8 @@
int count;
int col;
column_t *column;
- byte *desttop;
- byte *dest;
+ pixel_t *desttop;
+ pixel_t *dest;
byte *source;
int w;
@@ -206,8 +206,8 @@
int count;
int col;
column_t *column;
- byte *desttop;
- byte *dest;
+ pixel_t *desttop;
+ pixel_t *dest;
byte *source;
int w;
@@ -281,7 +281,8 @@
{
int count, col;
column_t *column;
- byte *desttop, *dest, *source;
+ pixel_t *desttop, *dest;
+ byte *source;
int w;
y -= SHORT(patch->topoffset);
@@ -331,7 +332,8 @@
{
int count, col;
column_t *column;
- byte *desttop, *dest, *source;
+ pixel_t *desttop, *dest;
+ byte *source;
int w;
y -= SHORT(patch->topoffset);
@@ -380,7 +382,8 @@
{
int count, col;
column_t *column;
- byte *desttop, *dest, *source;
+ pixel_t *desttop, *dest;
+ byte *source;
int w;
y -= SHORT(patch->topoffset);
@@ -430,8 +433,9 @@
{
int count, col;
column_t *column;
- byte *desttop, *dest, *source;
- byte *desttop2, *dest2;
+ pixel_t *desttop, *dest;
+ byte *source;
+ pixel_t *desttop2, *dest2;
int w;
y -= SHORT(patch->topoffset);
@@ -501,9 +505,9 @@
// Draw a linear block of pixels into the view buffer.
//
-void V_DrawBlock(int x, int y, int width, int height, byte *src)
+void V_DrawBlock(int x, int y, int width, int height, pixel_t *src)
{
- byte *dest;
+ pixel_t *dest;
#ifdef RANGECHECK
if (x < 0
@@ -604,7 +608,7 @@
// Set the buffer that the code draws to.
-void V_UseBuffer(byte *buffer)
+void V_UseBuffer(pixel_t *buffer)
{
dest_screen = buffer;
}
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -50,7 +50,7 @@
// Draw a block from the specified source screen to the screen.
-void V_CopyRect(int srcx, int srcy, byte *source,
+void V_CopyRect(int srcx, int srcy, pixel_t *source,
int width, int height,
int destx, int desty);
@@ -64,7 +64,7 @@
// Draw a linear block of pixels into the view buffer.
-void V_DrawBlock(int x, int y, int width, int height, byte *src);
+void V_DrawBlock(int x, int y, int width, int height, pixel_t *src);
void V_MarkRect(int x, int y, int width, int height);
@@ -79,7 +79,7 @@
// Temporarily switch to using a different buffer to draw graphics, etc.
-void V_UseBuffer(byte *buffer);
+void V_UseBuffer(pixel_t *buffer);
// Return to using the normal screen buffer to draw graphics.