Some cleanups for future merge.

This commit is contained in:
Marcus Sundberg 2000-01-07 01:49:28 +00:00
parent 0279cc5a4b
commit 682f7940d4
2 changed files with 70 additions and 69 deletions

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define _BSD #define _BSD
#include <ctype.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
@ -105,27 +106,28 @@ int d_con_indirect = 0;
int vid_buffersize; int vid_buffersize;
static Display *x_disp = NULL;
static Window x_win, x_root_win;
static Colormap x_cmap;
static GC x_gc;
static Visual *x_vis;
static XVisualInfo *x_visinfo;
static qboolean doShm;
#define STD_EVENT_MASK \ #define STD_EVENT_MASK \
( KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \ ( KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
PointerMotionMask | EnterWindowMask | LeaveWindowMask | VisibilityChangeMask | \ PointerMotionMask | EnterWindowMask | LeaveWindowMask | VisibilityChangeMask | \
ExposureMask | StructureNotifyMask ) ExposureMask | StructureNotifyMask )
qboolean x_fullscreen = true; qboolean x_fullscreen = true;
Display *x_disp = NULL; int x_screen, x_screen_width, x_screen_height;
int x_screen, x_screen_width, x_screen_height; int x_center_width, x_center_height;
int x_center_width, x_center_height; int x_std_event_mask = STD_EVENT_MASK;
int x_std_event_mask = STD_EVENT_MASK; qboolean mouse_in_window = false;
Window x_win, x_root_win; int global_dx, global_dy;
qboolean mouse_in_window = false;
int global_dx, global_dy;
static qboolean doShm; static Atom aHints = 0;
static Colormap x_cmap; static Atom aWMDelete = 0;
static GC x_gc;
static Visual *x_vis;
static XVisualInfo *x_visinfo;
static Atom aHints = 0;
static Atom aWMDelete = 0;
static int x_shmeventtype; static int x_shmeventtype;
//static XShmSegmentInfo x_shminfo; //static XShmSegmentInfo x_shminfo;
@ -296,7 +298,7 @@ D_BeginDirectRect
*/ */
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height) void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
{ {
// direct drawing of the "accessing disk" icon isn't supported under Nextstep // direct drawing of the "accessing disk" icon isn't supported
} }
@ -307,7 +309,7 @@ D_EndDirectRect
*/ */
void D_EndDirectRect (int x, int y, int width, int height) void D_EndDirectRect (int x, int y, int width, int height)
{ {
// direct drawing of the "accessing disk" icon isn't supported under Nextstep // direct drawing of the "accessing disk" icon isn't supported
} }
@ -388,7 +390,6 @@ static Cursor CreateNullCursor(Display *display, Window root)
void ResetFrameBuffer(void) void ResetFrameBuffer(void)
{ {
int mem; int mem;
int pwidth; int pwidth;
@ -425,7 +426,6 @@ void ResetFrameBuffer(void)
void ResetSharedFrameBuffers(void) void ResetSharedFrameBuffers(void)
{ {
int size; int size;
int key; int key;
int minsize = getpagesize(); int minsize = getpagesize();
@ -565,7 +565,6 @@ qboolean VID_FullScreen( Window win )
void VID_Init (unsigned char *palette) void VID_Init (unsigned char *palette)
{ {
int pnum, i; int pnum, i;
XVisualInfo template; XVisualInfo template;
int num_visuals; int num_visuals;

View file

@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define _BSD #define _BSD
typedef unsigned short PIXEL;
#include <ctype.h> #include <ctype.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
@ -57,8 +55,6 @@ float mouse_x, mouse_y;
float old_mouse_x, old_mouse_y; float old_mouse_x, old_mouse_y;
int p_mouse_x; int p_mouse_x;
int p_mouse_y; int p_mouse_y;
int ignorenext;
int bits_per_pixel;
typedef struct typedef struct
{ {
@ -75,14 +71,13 @@ int d_con_indirect = 0;
int vid_buffersize; int vid_buffersize;
static qboolean doShm; static Display *x_disp = NULL;
static Display *x_disp;
static Colormap x_cmap;
static Window x_win; static Window x_win;
static GC x_gc; static Colormap x_cmap;
static GC x_gc;
static Visual *x_vis; static Visual *x_vis;
static XVisualInfo *x_visinfo; static XVisualInfo *x_visinfo;
//static XImage *x_image; static qboolean doShm;
static int x_shmeventtype; static int x_shmeventtype;
//static XShmSegmentInfo x_shminfo; //static XShmSegmentInfo x_shminfo;
@ -103,14 +98,9 @@ static byte current_palette[768];
static long X11_highhunkmark; static long X11_highhunkmark;
static long X11_buffersize; static long X11_buffersize;
int vid_surfcachesize; typedef unsigned short PIXEL16;
void *vid_surfcache; typedef unsigned long PIXEL24;
static PIXEL16 st2d_8to16table[256];
void (*vid_menudrawfn)(void);
void (*vid_menukeyfn)(int key);
void VID_MenuKey (int key);
static PIXEL st2d_8to16table[256];
static int shiftmask_fl=0; static int shiftmask_fl=0;
static long r_shift,g_shift,b_shift; static long r_shift,g_shift,b_shift;
static unsigned long r_mask,g_mask,b_mask; static unsigned long r_mask,g_mask,b_mask;
@ -127,9 +117,9 @@ void shiftmask_init()
shiftmask_fl=1; shiftmask_fl=1;
} }
PIXEL xlib_rgb(int r, int g, int b) PIXEL16 xlib_rgb16(int r, int g, int b)
{ {
PIXEL p; PIXEL16 p;
if(shiftmask_fl==0) shiftmask_init(); if(shiftmask_fl==0) shiftmask_init();
p=0; p=0;
@ -158,13 +148,13 @@ void st2_fixup( XImage *framebuf, int x, int y, int width, int height)
{ {
int xi,yi; int xi,yi;
unsigned char *src; unsigned char *src;
PIXEL *dest; PIXEL16 *dest;
if( (x<0)||(y<0) )return; if( (x<0)||(y<0) )return;
for (yi = y; yi < (y+height); yi++) { for (yi = y; yi < (y+height); yi++) {
src = &framebuf->data [yi * framebuf->bytes_per_line]; src = &framebuf->data [yi * framebuf->bytes_per_line];
dest = (PIXEL*)src; dest = (PIXEL16*)src;
for(xi = (x+width-1); xi >= x; xi--) { for(xi = (x+width-1); xi >= x; xi--) {
dest[xi] = st2d_8to16table[src[xi]]; dest[xi] = st2d_8to16table[src[xi]];
} }
@ -172,6 +162,27 @@ void st2_fixup( XImage *framebuf, int x, int y, int width, int height)
} }
/*
================
D_BeginDirectRect
================
*/
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
{
// direct drawing of the "accessing disk" icon isn't supported
}
/*
================
D_EndDirectRect
================
*/
void D_EndDirectRect (int x, int y, int width, int height)
{
// direct drawing of the "accessing disk" icon isn't supported
}
// ======================================================================== // ========================================================================
// Tragic death handler // Tragic death handler
// ======================================================================== // ========================================================================
@ -211,6 +222,8 @@ static Cursor CreateNullCursor(Display *display, Window root)
void ResetFrameBuffer(void) void ResetFrameBuffer(void)
{ {
int vid_surfcachesize;
void *vid_surfcache;
int mem; int mem;
int pwidth; int pwidth;
@ -268,7 +281,8 @@ void ResetFrameBuffer(void)
void ResetSharedFrameBuffers(void) void ResetSharedFrameBuffers(void)
{ {
int vid_surfcachesize;
void *vid_surfcache;
int size; int size;
int key; int key;
int minsize = getpagesize(); int minsize = getpagesize();
@ -360,24 +374,22 @@ void ResetSharedFrameBuffers(void)
void VID_Init (unsigned char *palette) void VID_Init (unsigned char *palette)
{ {
int pnum, i;
XVisualInfo template;
int num_visuals;
int template_mask;
int pnum, i;
XVisualInfo template;
int num_visuals;
int template_mask;
S_Init(); // sound is initialized here S_Init(); // sound is initialized here
ignorenext=0; vid.width = 320;
vid.width = 320; vid.height = 200;
vid.height = 200; vid.maxwarpwidth = WARP_WIDTH;
vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpheight = WARP_HEIGHT;
vid.maxwarpheight = WARP_HEIGHT; vid.numpages = 2;
vid.numpages = 2; vid.colormap = host_colormap;
vid.colormap = host_colormap; vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048));
// vid.cbits = VID_CBITS; //vid.cbits = VID_CBITS;
// vid.grades = VID_GRADES; //vid.grades = VID_GRADES;
vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048));
srandom(getpid()); srandom(getpid());
@ -605,7 +617,7 @@ void VID_SetPalette(unsigned char *palette)
XColor colors[256]; XColor colors[256];
for(i=0;i<256;i++) for(i=0;i<256;i++)
st2d_8to16table[i]= xlib_rgb(palette[i*3], palette[i*3+1], palette[i*3+2]); st2d_8to16table[i]= xlib_rgb16(palette[i*3], palette[i*3+1], palette[i*3+2]);
if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8) if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8)
{ {
@ -1005,16 +1017,6 @@ char *Sys_ConsoleInput (void)
} }
#endif #endif
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
{
// direct drawing of the "accessing disk" icon isn't supported under Linux
}
void D_EndDirectRect (int x, int y, int width, int height)
{
// direct drawing of the "accessing disk" icon isn't supported under Linux
}
void IN_Init (void) void IN_Init (void)
{ {
Cvar_RegisterVariable (&_windowed_mouse); Cvar_RegisterVariable (&_windowed_mouse);