From: Holger Schemel Date: Sun, 3 Dec 2000 03:36:29 +0000 (+0100) Subject: rnd-20001203-2-src X-Git-Tag: 2.0.0^2~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1465ca1ffdf2104d25b9a46ca9bf8a3f175403fd;p=rocksndiamonds.git rnd-20001203-2-src --- diff --git a/src/init.c b/src/init.c index 1c56fc0a..08bbb05b 100644 --- a/src/init.c +++ b/src/init.c @@ -328,11 +328,9 @@ void InitDisplay() void InitGfx() { - int i, j; + int i; -#if defined(TARGET_SDL) - SDL_Surface *sdl_image_tmp; -#else +#if defined(TARGET_X11) GC copy_clipmask_gc; XGCValues clip_gc_values; unsigned long clip_gc_valuemask; @@ -368,6 +366,7 @@ void InitGfx() }; #endif +#ifdef TARGET_X11 static struct { int start; @@ -419,6 +418,7 @@ void InitGfx() { GFX2_SHIELD_ACTIVE, 3 }, { -1, 0 } }; +#endif /* initialize playfield properties */ @@ -454,6 +454,7 @@ void InitGfx() #if defined(TARGET_SDL) +#if 0 /* initialize surface array to 'NULL' */ for(i=0; i=0; i++) { + int j; + for(j=0; jsurface = SDL_DisplayFormat(sdl_image_tmp)) == NULL) Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); /* create native transparent surface for current image */ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY, SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00)); - if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL) + if ((pix[pos]->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL) Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); /* free temporary surface */ diff --git a/src/libgame/msdos.c b/src/libgame/msdos.c index 53a0b08f..a4914881 100644 --- a/src/libgame/msdos.c +++ b/src/libgame/msdos.c @@ -642,6 +642,10 @@ void XFreeGC(Display *display, GC gc) free(gcv); } +void XUnmapWindow(Display *display, Window window) +{ +} + void XCloseDisplay(Display *display) { BITMAP *bitmap = video_bitmap; @@ -887,6 +891,10 @@ void XDestroyImage(XImage *ximage) { } +void XDestroyWindow(Display *display, Window window) +{ +} + Bool XQueryPointer(Display *display, Window window, Window *root, Window *child, int *root_x, int *root_y, int *win_x, int *win_y, unsigned int *mask) diff --git a/src/libgame/msdos.h b/src/libgame/msdos.h index 12b0bb6d..f2bfabef 100644 --- a/src/libgame/msdos.h +++ b/src/libgame/msdos.h @@ -21,6 +21,9 @@ /* symbol 'window' is defined in DJGPP cross-compiler in libc.a(conio.o) */ #define window window_djgpp +/* symbol 'font' is defined in "allegro.h" */ +#define font font_allegro + /* system dependent definitions */ #define TARGET_STRING "DOS" @@ -690,6 +693,7 @@ int XReadBitmapFile(Display *, Drawable, char *, unsigned int *, unsigned int *, Pixmap *, int *, int *); void XFreePixmap(Display *, Pixmap); void XFreeGC(Display *, GC); +void XUnmapWindow(Display *, Window); void XCloseDisplay(Display *); void XNextEvent(Display *, XEvent *); int XPending(Display *); @@ -698,6 +702,7 @@ int XLookupString(XKeyEvent *, char *, int, KeySym *, XComposeStatus *); void XSetForeground(Display *, GC, unsigned long); void XDrawLine(Display *, Drawable, GC, int, int, int, int); void XDestroyImage(XImage *); +void XDestroyWindow(Display *, Window); Bool XQueryPointer(Display *, Window, Window *, Window *, int *, int *, int *, int *, unsigned int *); void XAutoRepeatOn(Display *); diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 2d6d16b5..19526fe0 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -65,10 +65,11 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen) { /* switch display to fullscreen mode, if available */ DrawWindow window_old = *backbuffer; - DrawWindow window_new; + DrawWindow window_new = CreateBitmapStruct(); - if ((window_new = SDL_SetVideoMode(video.width, video.height, video.depth, - surface_flags)) == NULL) + if ((window_new->surface = SDL_SetVideoMode(video.width, video.height, + video.depth, surface_flags)) + == NULL) { /* switching display to fullscreen mode failed */ Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError()); @@ -80,7 +81,7 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen) else { if (window_old) - SDL_FreeSurface(window_old); + FreeBitmap(window_old); *backbuffer = window_new; video.fullscreen_enabled = TRUE; @@ -92,10 +93,11 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen) { /* switch display to window mode */ DrawWindow window_old = *backbuffer; - DrawWindow window_new; + DrawWindow window_new = CreateBitmapStruct(); - if ((window_new = SDL_SetVideoMode(video.width, video.height, video.depth, - surface_flags)) == NULL) + if ((window_new->surface = SDL_SetVideoMode(video.width, video.height, + video.depth, surface_flags)) + == NULL) { /* switching display to window mode failed -- should not happen */ Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError()); @@ -105,7 +107,7 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen) else { if (window_old) - SDL_FreeSurface(window_old); + FreeBitmap(window_old); *backbuffer = window_new; video.fullscreen_enabled = FALSE; diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index cc60462b..c3c46682 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -33,15 +33,6 @@ #define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE -/* structure definitions */ - -struct SDLSurfaceInfo -{ - SDL_Surface *surface; - SDL_Surface *surface_masked; -}; - - /* SDL type definitions */ typedef struct SDLSurfaceInfo *Bitmap; @@ -65,6 +56,17 @@ typedef int Visual; typedef int Colormap; +/* structure definitions */ + +struct SDLSurfaceInfo +{ + SDL_Surface *surface; + SDL_Surface *surface_masked; + GC gc; + GC stored_clip_gc; +}; + + /* SDL symbol definitions */ #define None 0L diff --git a/src/libgame/system.c b/src/libgame/system.c index fe32a073..a88b78cf 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -162,14 +162,14 @@ inline Bitmap CreateBitmap(int width, int height, int depth) if (!(pixmap = XCreatePixmap(display, window->drawable, width, height, real_depth))) Error(ERR_EXIT, "cannot create pixmap"); - new_bitmap->drawable = pixmap; -#endif if (window == NULL) Error(ERR_EXIT, "Window GC needed for Bitmap -- create Window first"); new_bitmap->gc = window->gc; +#endif + return new_bitmap; } @@ -283,7 +283,7 @@ inline void DrawSimpleWhiteLine(Bitmap bitmap, int from_x, int from_y, int to_x, int to_y) { #ifdef TARGET_SDL - SDLDrawSimpleLine(bitmap->drawable, from_x, from_y, to_x, to_y, 0xffffff); + SDLDrawSimpleLine(bitmap->surface, from_x, from_y, to_x, to_y, 0xffffff); #else XSetForeground(display, bitmap->gc, WhitePixel(display, screen)); XDrawLine(display, bitmap->drawable, bitmap->gc, from_x, from_y, to_x, to_y); diff --git a/src/libgame/text.c b/src/libgame/text.c index 513166fd..2fbf1cb3 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -15,10 +15,6 @@ #include "libgame.h" -#if 1 -#include "main_TMP.h" -#endif - /* ========================================================================= */ /* exported variables */ diff --git a/src/libgame/x11.h b/src/libgame/x11.h index dc407766..f4858421 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -38,18 +38,6 @@ #define FULLSCREEN_STATUS FULLSCREEN_NOT_AVAILABLE -/* structure definitions */ - -struct X11DrawableInfo -{ - Drawable drawable; - Drawable clip_mask; - GC gc; /* GC for normal drawing (inheritated from 'window') */ - GC stored_clip_gc; /* GC for masked drawing (used for whole Pixmap) */ - GC clip_gc; /* can be 'stored_clip_gc' or one-tile-only clip GC */ -}; - - /* X11 type definitions */ typedef struct X11DrawableInfo *Bitmap; @@ -67,6 +55,18 @@ typedef XFocusChangeEvent FocusChangeEvent; typedef XClientMessageEvent ClientMessageEvent; +/* structure definitions */ + +struct X11DrawableInfo +{ + Drawable drawable; + Drawable clip_mask; + GC gc; /* GC for normal drawing (inheritated from 'window') */ + GC stored_clip_gc; /* GC for masked drawing (used for whole Pixmap) */ + GC clip_gc; /* can be 'stored_clip_gc' or one-tile-only clip GC */ +}; + + /* X11 symbol definitions */ #define EVENT_BUTTONPRESS ButtonPress diff --git a/src/main.c b/src/main.c index 5547d822..bf7e3f5b 100644 --- a/src/main.c +++ b/src/main.c @@ -36,9 +36,9 @@ GC tile_clip_gc; Bitmap pix[NUM_BITMAPS]; #if 0 Bitmap pix_masked[NUM_BITMAPS]; -#endif + Bitmap tile_masked[NUM_TILES]; -#if 0 + Pixmap clipmask[NUM_BITMAPS]; #endif Pixmap tile_clipmask[NUM_TILES]; @@ -602,6 +602,8 @@ int num_element_info = sizeof(element_info)/sizeof(char *); +#if 0 + /* +-----------------------------------------------------------------------+ */ /* | SDL TEST STUFF | */ /* +-----------------------------------------------------------------------+ */ @@ -976,6 +978,8 @@ void TEST_SDL_JOYSTICK() /* | SDL TEST STUFF | */ /* +-----------------------------------------------------------------------+ */ +#endif + int main(int argc, char *argv[]) diff --git a/src/main.h b/src/main.h index 512fe3f6..f2b5320e 100644 --- a/src/main.h +++ b/src/main.h @@ -448,9 +448,9 @@ extern GC tile_clip_gc; extern Bitmap pix[]; #if 0 extern Bitmap pix_masked[]; -#endif + extern Bitmap tile_masked[]; -#if 0 + extern Pixmap clipmask[]; #endif extern Pixmap tile_clipmask[];