switch(key)
{
case KSYM_Escape:
- RequestQuitGame();
+ RequestQuitGame(setup.ask_on_escape);
break;
#ifdef DEBUG
}
}
-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))
switch (id)
{
case GAME_CTRL_ID_STOP:
- RequestQuitGame();
+ RequestQuitGame(TRUE);
break;
case GAME_CTRL_ID_PAUSE:
void PlaySoundLevel(int, int, int);
void RaiseScore(int);
void RaiseScoreElement(int);
-void RequestQuitGame(void);
+void RequestQuitGame(boolean);
void CreateGameButtons();
void UnmapGameButtons();
}
}
#endif /* TARGET_X11_NATIVE */
+
+ XFreeGC(display, copy_clipmask_gc);
+
#endif /* TARGET_X11 */
}
}
InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
-
InitTileClipmasks();
}
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; x<MAX_BUF_XSIZE; x++)
for(y=0; y<MAX_BUF_YSIZE; y++)
{
if (artwork.graphics_set_current != artwork.gfx_current->name)
{
+ Bitmap *pix_new[NUM_PICTURES];
int i;
+ ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
+ for(i=0; i<NUM_PICTURES; i++)
+ {
+ DrawInitText(image_filename[i], 150, FC_YELLOW);
+ pix_new[i] = ReloadCustomImage(&pix[i], image_filename[i]);
+
+#if 0
+ if (pix_new[i] != NULL)
+ pix[i] = pix_new[i];
+#endif
+ }
+
+#if 0
+ InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
+ InitTileClipmasks();
+ InitGfxBackground();
+#endif
+
+#if 1
+ for(i=0; i<NUM_PICTURES; i++)
+ {
+ if (pix_new[i] != NULL)
+ TransferBitmapPointers(pix_new[i], pix[i]);
+ }
+#else
for(i=0; i<NUM_PICTURES; i++)
- ReloadCustomImage(&pix[i], image_filename[i]);
+ {
+ if (pix_new[i] != NULL)
+ FreeBitmap(pix_old[i]);
+ }
+#endif
+#if 1
+ InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
+ InitTileClipmasks();
InitGfxBackground();
+#endif
+
SetDoorState(DOOR_OPEN_1 | DOOR_CLOSE_2);
artwork.graphics_set_current = artwork.gfx_current->name;
return new_bitmap;
}
-inline void FreeBitmap(Bitmap *bitmap)
+inline static void FreeBitmapPointers(Bitmap *bitmap)
{
if (bitmap == NULL)
return;
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);
}
return new_bitmap;
}
-void ReloadCustomImage(Bitmap **bitmap, char *basename)
+Bitmap *ReloadCustomImage(Bitmap **bitmap, char *basename)
{
char *filename = getCustomImageFilename(basename);
Bitmap *old_bitmap = *bitmap;
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)
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 ||
{
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);
old_bitmap->width, old_bitmap->height, 0,0);
FreeBitmap(new_bitmap);
+#else
+ /*
+ *bitmap = new_bitmap;
+ */
+ return new_bitmap;
+#endif
}
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);
Bitmap *LoadImage(char *);
Bitmap *LoadCustomImage(char *);
-void ReloadCustomImage(Bitmap **, char *);
+Bitmap *ReloadCustomImage(Bitmap **, char *);
inline void OpenAudio(void);
inline void CloseAudio(void);
#if 0
ClearEventQueue();
#endif
-
}
static void gotoTopLevelDir()
-#define COMPILE_DATE_STRING "[2002-04-07 13:13]"
+#define COMPILE_DATE_STRING "[2002-04-07 18:38]"