From: Holger Schemel Date: Sun, 7 Apr 2002 16:39:05 +0000 (+0200) Subject: rnd-20020407-2-src X-Git-Tag: 2.1.0^2~62 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=066b410c0573fe64a1783116daf9d64883e9f03e;p=rocksndiamonds.git rnd-20020407-2-src --- diff --git a/src/events.c b/src/events.c index a4b60829..879b5396 100644 --- a/src/events.c +++ b/src/events.c @@ -594,7 +594,7 @@ void HandleKey(Key key, int key_status) switch(key) { case KSYM_Escape: - RequestQuitGame(); + RequestQuitGame(setup.ask_on_escape); break; #ifdef DEBUG diff --git a/src/game.c b/src/game.c index 6d536ec6..f0bf7dd9 100644 --- a/src/game.c +++ b/src/game.c @@ -6305,10 +6305,10 @@ void RaiseScoreElement(int element) } } -void RequestQuitGame() +void RequestQuitGame(boolean ask_if_really_quit) { if (AllPlayersGone || - !setup.ask_on_escape || + !ask_if_really_quit || level_editor_test_game || Request("Do you really want to quit the game ?", REQ_ASK | REQ_STAY_CLOSED)) @@ -6478,7 +6478,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) switch (id) { case GAME_CTRL_ID_STOP: - RequestQuitGame(); + RequestQuitGame(TRUE); break; case GAME_CTRL_ID_PAUSE: diff --git a/src/game.h b/src/game.h index 3a66264e..acd25c1b 100644 --- a/src/game.h +++ b/src/game.h @@ -92,7 +92,7 @@ boolean PlaceBomb(struct PlayerInfo *); void PlaySoundLevel(int, int, int); void RaiseScore(int); void RaiseScoreElement(int); -void RequestQuitGame(void); +void RequestQuitGame(boolean); void CreateGameButtons(); void UnmapGameButtons(); diff --git a/src/init.c b/src/init.c index 3118aa35..bc29424e 100644 --- a/src/init.c +++ b/src/init.c @@ -297,6 +297,9 @@ void InitTileClipmasks() } } #endif /* TARGET_X11_NATIVE */ + + XFreeGC(display, copy_clipmask_gc); + #endif /* TARGET_X11 */ } @@ -343,7 +346,6 @@ void InitGfx() } InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]); - InitTileClipmasks(); } @@ -355,9 +357,9 @@ void InitGfxBackground() fieldbuffer = pix[PIX_DB_FIELD]; SetDrawtoField(DRAW_BACKBUFFER); - BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0); - ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE); - ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE); + BlitBitmap(pix[PIX_BACK], backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); + ClearRectangle(pix[PIX_DB_DOOR], 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE); for(x=0; xname) { + Bitmap *pix_new[NUM_PICTURES]; int i; + ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE); + for(i=0; iname; diff --git a/src/libgame/system.c b/src/libgame/system.c index 7eaadf68..2ffce007 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -281,7 +281,7 @@ inline Bitmap *CreateBitmap(int width, int height, int depth) return new_bitmap; } -inline void FreeBitmap(Bitmap *bitmap) +inline static void FreeBitmapPointers(Bitmap *bitmap) { if (bitmap == NULL) return; @@ -298,10 +298,29 @@ inline void FreeBitmap(Bitmap *bitmap) XFreePixmap(display, bitmap->clip_mask); if (bitmap->stored_clip_gc) XFreeGC(display, bitmap->stored_clip_gc); + /* the other GCs are only pointers to GCs used elsewhere */ #endif if (bitmap->source_filename) free(bitmap->source_filename); +} + +inline void TransferBitmapPointers(Bitmap *src_bitmap, Bitmap *dst_bitmap) +{ + if (src_bitmap == NULL || dst_bitmap == NULL) + return; + + FreeBitmapPointers(dst_bitmap); + + *dst_bitmap = *src_bitmap; +} + +inline void FreeBitmap(Bitmap *bitmap) +{ + if (bitmap == NULL) + return; + + FreeBitmapPointers(bitmap); free(bitmap); } @@ -647,7 +666,7 @@ Bitmap *LoadCustomImage(char *basename) return new_bitmap; } -void ReloadCustomImage(Bitmap **bitmap, char *basename) +Bitmap *ReloadCustomImage(Bitmap **bitmap, char *basename) { char *filename = getCustomImageFilename(basename); Bitmap *old_bitmap = *bitmap; @@ -656,7 +675,7 @@ void ReloadCustomImage(Bitmap **bitmap, char *basename) if (filename == NULL) /* (should never happen) */ { Error(ERR_WARN, "ReloadCustomImage(): cannot find file '%s'", basename); - return; + return NULL; } if (strcmp(filename, old_bitmap->source_filename) == 0) @@ -665,13 +684,13 @@ void ReloadCustomImage(Bitmap **bitmap, char *basename) This usually means that this image does not exist in this graphic set and a fallback to the existing image is done. */ - return; + return NULL; } if ((new_bitmap = LoadImage(filename)) == NULL) { Error(ERR_WARN, "LoadImage() failed: %s", GetError()); - return; + return NULL; } if (old_bitmap->width != new_bitmap->width || @@ -679,9 +698,10 @@ void ReloadCustomImage(Bitmap **bitmap, char *basename) { Error(ERR_WARN, "ReloadCustomImage: new image has wrong dimensions"); FreeBitmap(new_bitmap); - return; + return NULL; } +#if 0 /* copy filename for new image */ free(old_bitmap->source_filename); old_bitmap->source_filename = getStringCopy(filename); @@ -691,6 +711,12 @@ void ReloadCustomImage(Bitmap **bitmap, char *basename) old_bitmap->width, old_bitmap->height, 0,0); FreeBitmap(new_bitmap); +#else + /* + *bitmap = new_bitmap; + */ + return new_bitmap; +#endif } diff --git a/src/libgame/system.h b/src/libgame/system.h index 145bac1d..19fdf645 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -443,6 +443,7 @@ inline void CloseVideoDisplay(void); inline void InitVideoBuffer(DrawBuffer **,DrawWindow **, int,int,int, boolean); inline Bitmap *CreateBitmapStruct(void); inline Bitmap *CreateBitmap(int, int, int); +inline void TransferBitmapPointers(Bitmap *, Bitmap *); inline void FreeBitmap(Bitmap *); inline void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int); inline void ClearRectangle(Bitmap *, int, int, int, int); @@ -465,7 +466,7 @@ inline boolean ChangeVideoModeIfNeeded(boolean); Bitmap *LoadImage(char *); Bitmap *LoadCustomImage(char *); -void ReloadCustomImage(Bitmap **, char *); +Bitmap *ReloadCustomImage(Bitmap **, char *); inline void OpenAudio(void); inline void CloseAudio(void); diff --git a/src/screens.c b/src/screens.c index e6556da2..ece8b097 100644 --- a/src/screens.c +++ b/src/screens.c @@ -234,7 +234,6 @@ void DrawMainMenu() #if 0 ClearEventQueue(); #endif - } static void gotoTopLevelDir() diff --git a/src/timestamp.h b/src/timestamp.h index 078b3c9b..4a85f3d7 100644 --- a/src/timestamp.h +++ b/src/timestamp.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-04-07 13:13]" +#define COMPILE_DATE_STRING "[2002-04-07 18:38]"