X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=8e65d97056a32dd2baebed276d6016ab46dedc30;hb=ea6e4698905d7440a265e323d03cf13fc323c44b;hp=704c5b252c78a2de7aa54ed34385c3398a27b4e4;hpb=322c8667eecfd313a24523a489b06b8454005d68;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index 704c5b25..8e65d970 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -75,8 +75,8 @@ void InitProgramInfo(char *argv0, char *cookie_prefix, char *filename_prefix, int program_version) { - program.command_basename = - (strrchr(argv0, '/') ? strrchr(argv0, '/') + 1 : argv0); + program.command_basepath = getBasePath(argv0); + program.command_basename = getBaseName(argv0); program.userdata_directory = userdata_directory; program.program_title = program_title; @@ -213,6 +213,8 @@ static void DrawBitmapFromTile(Bitmap *bitmap, Bitmap *tile, void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) { + /* !!! THIS DOES NOT WORK !!! REPLACED BITMAPS MAY HAVE SAME ADDRESS !!! */ +#if 0 static Bitmap *main_bitmap_tile = NULL; static Bitmap *door_bitmap_tile = NULL; @@ -226,14 +228,15 @@ void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) else if (mask == REDRAW_DOOR_1) { if (background_bitmap_tile == door_bitmap_tile) - return; /* main background tile has not changed */ + return; /* main background tile has not changed */ door_bitmap_tile = background_bitmap_tile; } - else /* should not happen */ + else /* should not happen */ return; +#endif - if (background_bitmap_tile) + if (background_bitmap_tile != NULL) gfx.background_bitmap_mask |= mask; else gfx.background_bitmap_mask &= ~mask; @@ -249,10 +252,12 @@ void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) DrawBitmapFromTile(gfx.background_bitmap, background_bitmap_tile, gfx.real_sx, gfx.real_sy, gfx.full_sxsize, gfx.full_sysize); - else + else if (mask == REDRAW_DOOR_1) + { DrawBitmapFromTile(gfx.background_bitmap, background_bitmap_tile, gfx.dx, gfx.dy, gfx.dxsize, gfx.dysize); + } } void SetMainBackgroundBitmap(Bitmap *background_bitmap_tile) @@ -439,8 +444,13 @@ inline boolean DrawingDeactivated(int x, int y, int width, int height) inline boolean DrawingOnBackground(int x, int y) { +#if 1 + return (CheckDrawingArea(x, y, 1, 1, gfx.background_bitmap_mask) && + CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask)); +#else return ((gfx.draw_background_mask & gfx.background_bitmap_mask) && CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask)); +#endif } inline void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, @@ -917,6 +927,7 @@ void CreateBitmapWithSmallBitmaps(Bitmap *old_bitmap, int zoom_factor) #endif + old_bitmap->width = new_bitmap->width; old_bitmap->height = new_bitmap->height; FreeBitmap(new_bitmap); @@ -1142,6 +1153,15 @@ inline void NextEvent(Event *event) #endif } +inline void PeekEvent(Event *event) +{ +#if defined(TARGET_SDL) + SDL_PeepEvents(event, 1, SDL_PEEKEVENT, SDL_ALLEVENTS); +#else + XPeekEvent(display, event); +#endif +} + inline Key GetEventKey(KeyEvent *event, boolean with_modifiers) { #if defined(TARGET_SDL)