2006-04-28
* added "CE score gets zero [of]" to custom element trigger conditions
+ * added setup option to display element token name in level editor
2006-04-19
* added compatibility code for Juergen Bonhagen's menu artwork settings
{ "background.envelope_4.anim_mode", "default" },
{ "background.envelope_4.draw_masked", "false" },
+ { "titlescreen_1", UNDEFINED_FILENAME },
+ { "titlescreen_2", UNDEFINED_FILENAME },
+ { "titlescreen_3", UNDEFINED_FILENAME },
+ { "titlescreen_4", UNDEFINED_FILENAME },
+ { "titlescreen_5", UNDEFINED_FILENAME },
+
{ "background", UNDEFINED_FILENAME },
+ { "background.TITLE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.LEVELS", UNDEFINED_FILENAME },
{ "background.SCORES", UNDEFINED_FILENAME },
#define IMG_BACKGROUND_ENVELOPE_2 1520
#define IMG_BACKGROUND_ENVELOPE_3 1521
#define IMG_BACKGROUND_ENVELOPE_4 1522
-#define IMG_BACKGROUND 1523
-#define IMG_BACKGROUND_MAIN 1524
-#define IMG_BACKGROUND_LEVELS 1525
-#define IMG_BACKGROUND_SCORES 1526
-#define IMG_BACKGROUND_EDITOR 1527
-#define IMG_BACKGROUND_INFO 1528
-#define IMG_BACKGROUND_INFO_ELEMENTS 1529
-#define IMG_BACKGROUND_INFO_MUSIC 1530
-#define IMG_BACKGROUND_INFO_CREDITS 1531
-#define IMG_BACKGROUND_INFO_PROGRAM 1532
-#define IMG_BACKGROUND_INFO_LEVELSET 1533
-#define IMG_BACKGROUND_SETUP 1534
-#define IMG_BACKGROUND_DOOR 1535
+#define IMG_TITLESCREEN_1 1523
+#define IMG_TITLESCREEN_2 1524
+#define IMG_TITLESCREEN_3 1525
+#define IMG_TITLESCREEN_4 1526
+#define IMG_TITLESCREEN_5 1527
+#define IMG_BACKGROUND 1528
+#define IMG_BACKGROUND_TITLE 1529
+#define IMG_BACKGROUND_MAIN 1530
+#define IMG_BACKGROUND_LEVELS 1531
+#define IMG_BACKGROUND_SCORES 1532
+#define IMG_BACKGROUND_EDITOR 1533
+#define IMG_BACKGROUND_INFO 1534
+#define IMG_BACKGROUND_INFO_ELEMENTS 1535
+#define IMG_BACKGROUND_INFO_MUSIC 1536
+#define IMG_BACKGROUND_INFO_CREDITS 1537
+#define IMG_BACKGROUND_INFO_PROGRAM 1538
+#define IMG_BACKGROUND_INFO_LEVELSET 1539
+#define IMG_BACKGROUND_SETUP 1540
+#define IMG_BACKGROUND_DOOR 1541
-#define NUM_IMAGE_FILES 1536
+#define NUM_IMAGE_FILES 1542
#endif /* CONF_GFX_H */
-#define COMPILE_DATE_STRING "[2006-04-28 20:25]"
+#define COMPILE_DATE_STRING "[2006-04-30 04:12]"
int screen_line = 0;
int i, x, y;
+#if 1
+ if (setup.editor.show_element_token)
+ {
+ DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
+ "[%s]", element_info[properties_element].token_name);
+ screen_line++;
+ }
+
+#else
+
#if DEBUG
if (IS_CUSTOM_ELEMENT(properties_element))
{
"[Group Element %d]", properties_element - EL_GROUP_START + 1);
screen_line++;
}
+#endif
#endif
/* ----- print number of elements / percentage of this element in level */
switch(game_status)
{
+ case GAME_MODE_TITLE:
+ HandleTitleScreen(mx,my, 0,0, button);
+ break;
+
case GAME_MODE_MAIN:
HandleMainMenu(mx,my, 0,0, button);
break;
HandleTypeName(0, key);
break;
+ case GAME_MODE_TITLE:
case GAME_MODE_MAIN:
case GAME_MODE_LEVELS:
case GAME_MODE_SETUP:
case KSYM_space:
#endif
case KSYM_Return:
- if (game_status == GAME_MODE_MAIN)
+ if (game_status == GAME_MODE_TITLE)
+ HandleTitleScreen(0,0, 0,0, MB_MENU_CHOICE);
+ else if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
else if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE);
break;
case KSYM_Escape:
- if (game_status == GAME_MODE_LEVELS)
+ if (game_status == GAME_MODE_TITLE)
+ HandleTitleScreen(0,0, 0,0, MB_MENU_LEAVE);
+ else if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE);
!DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY))
newbutton = dx = dy = 0;
- if (game_status == GAME_MODE_MAIN)
+ if (game_status == GAME_MODE_TITLE)
+ HandleTitleScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+ else if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
else if (game_status == GAME_MODE_LEVELS)
HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
#define SETUP_TOKEN_EDITOR_EL_HEADLINES 10
#define SETUP_TOKEN_EDITOR_EL_USER_DEFINED 11
#define SETUP_TOKEN_EDITOR_EL_DYNAMIC 12
+#define SETUP_TOKEN_EDITOR_SHOW_ELEMENT_TOKEN 13
-#define NUM_EDITOR_SETUP_TOKENS 13
+#define NUM_EDITOR_SETUP_TOKENS 14
/* editor cascade setup */
#define SETUP_TOKEN_EDITOR_CASCADE_BD 0
{ TYPE_SWITCH, &sei.el_headlines, "editor.el_headlines" },
{ TYPE_SWITCH, &sei.el_user_defined, "editor.el_user_defined" },
{ TYPE_SWITCH, &sei.el_dynamic, "editor.el_dynamic" },
+ { TYPE_SWITCH, &sei.show_element_token,"editor.show_element_token" },
};
static struct TokenInfo editor_cascade_setup_tokens[] =
si->editor.el_user_defined = FALSE;
si->editor.el_dynamic = TRUE;
+ si->editor.show_element_token = FALSE;
+
si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME;
si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE;
InitElementSmallImagesScaledUp(special_graphics[i]);
}
+void InitScaledImages()
+{
+ int i;
+
+ /* scale normal images from static configuration, if not already scaled */
+ for (i = 0; i < NUM_IMAGE_FILES; i++)
+ ScaleImage(i, graphic_info[i].scale_up_factor);
+}
+
#if 1
/* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */
void SetBitmaps_EM(Bitmap **em_bitmap)
InitElementGraphicInfo(); /* element game graphic mapping */
InitElementSpecialGraphicInfo(); /* element special graphic mapping */
- InitElementSmallImages(); /* scale images to all needed sizes */
+ InitElementSmallImages(); /* scale elements to all needed sizes */
+ InitScaledImages(); /* scale all other images, if needed */
InitFontGraphicInfo(); /* initialize text drawing functions */
InitGraphicInfo_EM(); /* graphic mapping for EM engine */
if (filename_font_initial == NULL) /* should not happen */
Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL);
- /* create additional image buffers for double-buffering */
+ /* create additional image buffers for double-buffering and cross-fading */
+ bitmap_db_title = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
DrawInitText("Loading graphics:", 120, FC_GREEN);
}
+void RedrawBackground()
+{
+ BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
+ 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+
+ redraw_mask = REDRAW_ALL;
+}
+
void InitGfxBackground()
{
int x, y;
fieldbuffer = bitmap_db_field;
SetDrawtoField(DRAW_BACKBUFFER);
- BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
- 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ RedrawBackground();
+
ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
if (redraw_screen)
{
+#if 1
+ RedrawBackground();
+#else
InitGfxBackground();
+#endif
/* force redraw of (open or closed) door graphics */
SetDoorState(DOOR_OPEN_ALL);
void InitElementPropertiesEngine(int);
void ReloadCustomArtwork(int);
+void RedrawBackground();
void KeyboardAutoRepeatOffUnlessAutoplay();
img_info->scaled_up = TRUE;
}
+void ScaleImage(int pos, int zoom_factor)
+{
+ ImageInfo *img_info = getImageInfoEntryFromImageID(pos);
+
+ if (img_info == NULL || img_info->scaled_up)
+ return;
+
+ if (zoom_factor != 1)
+ ScaleBitmap(img_info->bitmap, zoom_factor);
+
+ img_info->scaled_up = TRUE;
+}
+
void FreeAllImages()
{
FreeCustomArtworkLists(image_info);
void ReloadCustomImages();
void CreateImageWithSmallImages(int, int);
+void ScaleImage(int, int);
void FreeAllImages();
return dst_bitmap;
}
-void CreateBitmapWithSmallBitmaps(Bitmap *old_bitmap, int zoom_factor)
+static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
+ boolean create_small_bitmaps)
{
Bitmap swap_bitmap;
Bitmap *new_bitmap, *tmp_bitmap_1, *tmp_bitmap_2, *tmp_bitmap_8;
int width_1, height_1, width_2, height_2, width_8, height_8;
int new_width, new_height;
+ /* calculate new image dimensions for normal sized image */
width_1 = old_bitmap->width * zoom_factor;
height_1 = old_bitmap->height * zoom_factor;
- width_2 = width_1 / 2;
- height_2 = height_1 / 2;
- width_8 = width_1 / 8;
- height_8 = height_1 / 8;
/* get image with normal size (this might require scaling up) */
if (zoom_factor != 1)
else
tmp_bitmap_1 = old_bitmap;
- /* get image with 1/2 of normal size (for use in the level editor) */
- if (zoom_factor != 2)
- tmp_bitmap_2 = ZoomBitmap(tmp_bitmap_1, width_1 / 2, height_1 / 2);
- else
- tmp_bitmap_2 = old_bitmap;
+ if (create_small_bitmaps)
+ {
+ /* calculate new image dimensions for small images */
+ width_2 = width_1 / 2;
+ height_2 = height_1 / 2;
+ width_8 = width_1 / 8;
+ height_8 = height_1 / 8;
+
+ /* get image with 1/2 of normal size (for use in the level editor) */
+ if (zoom_factor != 2)
+ tmp_bitmap_2 = ZoomBitmap(tmp_bitmap_1, width_1 / 2, height_1 / 2);
+ else
+ tmp_bitmap_2 = old_bitmap;
- /* get image with 1/8 of normal size (for use on the preview screen) */
- if (zoom_factor != 8)
- tmp_bitmap_8 = ZoomBitmap(tmp_bitmap_1, width_1 / 8, height_1 / 8);
- else
- tmp_bitmap_8 = old_bitmap;
+ /* get image with 1/8 of normal size (for use on the preview screen) */
+ if (zoom_factor != 8)
+ tmp_bitmap_8 = ZoomBitmap(tmp_bitmap_1, width_1 / 8, height_1 / 8);
+ else
+ tmp_bitmap_8 = old_bitmap;
+ }
/* if image was scaled up, create new clipmask for normal size image */
if (zoom_factor != 1)
#endif
}
- new_width = width_1;
- new_height = height_1 + (height_1 + 1) / 2; /* prevent odd height */
+ if (create_small_bitmaps)
+ {
+ new_width = width_1;
+ new_height = height_1 + (height_1 + 1) / 2; /* prevent odd height */
- new_bitmap = CreateBitmap(new_width, new_height, DEFAULT_DEPTH);
+ new_bitmap = CreateBitmap(new_width, new_height, DEFAULT_DEPTH);
- BlitBitmap(tmp_bitmap_1, new_bitmap, 0, 0, width_1, height_1, 0, 0);
- BlitBitmap(tmp_bitmap_2, new_bitmap, 0, 0, width_1 / 2, height_1 / 2,
- 0, height_1);
- BlitBitmap(tmp_bitmap_8, new_bitmap, 0, 0, width_1 / 8, height_1 / 8,
- 3 * width_1 / 4, height_1);
+ BlitBitmap(tmp_bitmap_1, new_bitmap, 0, 0, width_1, height_1, 0, 0);
+ BlitBitmap(tmp_bitmap_2, new_bitmap, 0, 0, width_1 / 2, height_1 / 2,
+ 0, height_1);
+ BlitBitmap(tmp_bitmap_8, new_bitmap, 0, 0, width_1 / 8, height_1 / 8,
+ 3 * width_1 / 4, height_1);
+ }
+ else
+ {
+ new_width = width_1;
+ new_height = height_1;
- if (zoom_factor != 1)
- FreeBitmap(tmp_bitmap_1);
+ new_bitmap = tmp_bitmap_1; /* directly use tmp_bitmap_1 as new bitmap */
+ }
+
+ if (create_small_bitmaps)
+ {
+ /* if no small bitmaps created, tmp_bitmap_1 is used as new bitmap now */
+ if (zoom_factor != 1)
+ FreeBitmap(tmp_bitmap_1);
- if (zoom_factor != 2)
- FreeBitmap(tmp_bitmap_2);
+ if (zoom_factor != 2)
+ FreeBitmap(tmp_bitmap_2);
- if (zoom_factor != 8)
- FreeBitmap(tmp_bitmap_8);
+ if (zoom_factor != 8)
+ FreeBitmap(tmp_bitmap_8);
+ }
/* replace image with extended image (containing normal, 1/2 and 1/8 size) */
#if defined(TARGET_SDL)
old_bitmap->width = new_bitmap->width;
old_bitmap->height = new_bitmap->height;
- FreeBitmap(new_bitmap);
+ FreeBitmap(new_bitmap); /* this actually frees the _old_ bitmap now */
+}
+
+void CreateBitmapWithSmallBitmaps(Bitmap *old_bitmap, int zoom_factor)
+{
+ CreateScaledBitmaps(old_bitmap, zoom_factor, TRUE);
+}
+
+void ScaleBitmap(Bitmap *old_bitmap, int zoom_factor)
+{
+ CreateScaledBitmaps(old_bitmap, zoom_factor, FALSE);
}
boolean el_dynamic;
boolean el_headlines;
+
+ boolean show_element_token;
};
struct SetupEditorCascadeInfo
Bitmap *ZoomBitmap(Bitmap *, int, int);
void CreateBitmapWithSmallBitmaps(Bitmap *, int);
+void ScaleBitmap(Bitmap *, int);
void SetMouseCursor(int);
#include "events.h"
#include "config.h"
-Bitmap *bitmap_db_field, *bitmap_db_door;
+Bitmap *bitmap_db_title;
+Bitmap *bitmap_db_field;
+Bitmap *bitmap_db_door;
DrawBuffer *fieldbuffer;
DrawBuffer *drawto_field;
#define MAX_ELEMENT_NAME_LEN 32
#define MAX_TAPES_PER_SET 1024
#define MAX_SCORE_ENTRIES 100
+#define MAX_NUM_TITLE_SCREENS 5
+
#define MAX_NUM_AMOEBA 100
+
#if 0 /* game.h */
#define MAX_INVENTORY_SIZE 1000
#define STD_NUM_KEYS 4
#define MAX_NUM_KEYS 8
#endif
+
#define NUM_BELTS 4
#define NUM_BELT_PARTS 3
#define MIN_ENVELOPE_XSIZE 1
/* values for special image configuration suffixes (must match game mode) */
#define GFX_SPECIAL_ARG_DEFAULT 0
-#define GFX_SPECIAL_ARG_MAIN 1
-#define GFX_SPECIAL_ARG_LEVELS 2
-#define GFX_SPECIAL_ARG_SCORES 3
-#define GFX_SPECIAL_ARG_EDITOR 4
-#define GFX_SPECIAL_ARG_INFO 5
-#define GFX_SPECIAL_ARG_SETUP 6
-#define GFX_SPECIAL_ARG_PLAYING 7
-#define GFX_SPECIAL_ARG_DOOR 8
-#define GFX_SPECIAL_ARG_PREVIEW 9
-#define GFX_SPECIAL_ARG_CRUMBLED 10
+#define GFX_SPECIAL_ARG_TITLE 1
+#define GFX_SPECIAL_ARG_MAIN 2
+#define GFX_SPECIAL_ARG_LEVELS 3
+#define GFX_SPECIAL_ARG_SCORES 4
+#define GFX_SPECIAL_ARG_EDITOR 5
+#define GFX_SPECIAL_ARG_INFO 6
+#define GFX_SPECIAL_ARG_SETUP 7
+#define GFX_SPECIAL_ARG_PLAYING 8
+#define GFX_SPECIAL_ARG_DOOR 9
+#define GFX_SPECIAL_ARG_PREVIEW 10
+#define GFX_SPECIAL_ARG_CRUMBLED 11
-#define NUM_SPECIAL_GFX_ARGS 11
+#define NUM_SPECIAL_GFX_ARGS 12
/* values for image configuration suffixes */
/* values for game_status (must match special image configuration suffixes) */
#define GAME_MODE_DEFAULT 0
-#define GAME_MODE_MAIN 1
-#define GAME_MODE_LEVELS 2
-#define GAME_MODE_SCORES 3
-#define GAME_MODE_EDITOR 4
-#define GAME_MODE_INFO 5
-#define GAME_MODE_SETUP 6
-#define GAME_MODE_PLAYING 7
-#define GAME_MODE_PSEUDO_DOOR 8
-#define GAME_MODE_PSEUDO_PREVIEW 9
-#define GAME_MODE_PSEUDO_CRUMBLED 10
+#define GAME_MODE_TITLE 1
+#define GAME_MODE_MAIN 2
+#define GAME_MODE_LEVELS 3
+#define GAME_MODE_SCORES 4
+#define GAME_MODE_EDITOR 5
+#define GAME_MODE_INFO 6
+#define GAME_MODE_SETUP 7
+#define GAME_MODE_PLAYING 8
+#define GAME_MODE_PSEUDO_DOOR 9
+#define GAME_MODE_PSEUDO_PREVIEW 10
+#define GAME_MODE_PSEUDO_CRUMBLED 11
/* there are no special config file suffixes for these modes */
-#define GAME_MODE_PSEUDO_TYPENAME 11
-#define GAME_MODE_QUIT 12
+#define GAME_MODE_PSEUDO_TYPENAME 12
+#define GAME_MODE_QUIT 13
/* special definitions currently only used for custom artwork configuration */
#define MUSIC_PREFIX_BACKGROUND 0
};
-extern Bitmap *bitmap_db_field, *bitmap_db_door;
+extern Bitmap *bitmap_db_title;
+extern Bitmap *bitmap_db_field;
+extern Bitmap *bitmap_db_door;
extern Pixmap tile_clipmask[];
-extern DrawBuffer *fieldbuffer;
-extern DrawBuffer *drawto_field;
+extern DrawBuffer *fieldbuffer;
+extern DrawBuffer *drawto_field;
extern int game_status;
extern boolean level_editor_test_game;
return getNextLevelButtonPos() + 1;
}
+void DrawTitleScreenImage(int nr)
+{
+ int graphic = IMG_TITLESCREEN_1 + nr;
+ Bitmap *bitmap = graphic_info[graphic].bitmap;
+ int width = graphic_info[graphic].src_image_width;
+ int height = graphic_info[graphic].src_image_height;
+ int src_x = 0, src_y = 0;
+ int dst_x, dst_y;
+
+ if (bitmap == NULL)
+ return;
+
+ if (width > WIN_XSIZE)
+ {
+ src_x = (width - WIN_XSIZE) / 2;
+ width = WIN_XSIZE;
+ }
+
+ if (height > WIN_YSIZE)
+ {
+ src_y = (height - WIN_YSIZE) / 2;
+ height = WIN_YSIZE;
+ }
+
+ dst_x = (WIN_XSIZE - width) / 2;
+ dst_y = (WIN_YSIZE - height) / 2;
+
+#if 1
+ ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
+#else
+ DrawBackground(0, 0, WIN_XSIZE, WIN_YSIZE);
+#endif
+
+ if (DrawingOnBackground(dst_x, dst_y))
+ BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
+ else
+ BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
+
+ redraw_mask = REDRAW_ALL;
+}
+
+void DrawTitleScreen()
+{
+ KeyboardAutoRepeatOff();
+
+ SetMainBackgroundImage(IMG_BACKGROUND_TITLE);
+
+#if 0
+ CloseDoor(DOOR_CLOSE_1);
+#endif
+
+ HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
+
+ PlayMenuSound();
+ PlayMenuMusic();
+
+#if 1
+ FadeIn(1000);
+#else
+ FadeToFront();
+#endif
+ StopAnimation();
+}
+
void DrawMainMenu()
{
static LevelDirTree *leveldir_last_valid = NULL;
+ boolean levelset_has_changed = FALSE;
char *name_text = (!options.network && setup.team_mode ? "Team:" : "Name:");
#if 1
char *level_text = "Levelset";
if (!validLevelSeries(leveldir_current))
leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
+ if (leveldir_current != leveldir_last_valid)
+ levelset_has_changed = TRUE;
+
/* store valid level series information */
leveldir_last_valid = leveldir_current;
SetDrawtoField(DRAW_BACKBUFFER);
#endif
+ if (levelset_has_changed && graphic_info[IMG_TITLESCREEN_1].bitmap != NULL)
+ {
+ game_status = GAME_MODE_TITLE;
+ DrawTitleScreen();
+
+ return;
+ }
+
#if 0
/* map gadgets for main menu screen */
MapTapeButtons();
}
#endif
+void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
+{
+ static int title_nr = 0;
+ boolean return_to_main_menu = FALSE;
+ boolean use_cross_fading = TRUE;
+ int fade_delay = 1000;
+ int post_delay = 500;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ title_nr = 0;
+
+ DrawTitleScreenImage(title_nr);
+
+ return;
+ }
+ else if (button == MB_MENU_LEAVE)
+ {
+ return_to_main_menu = TRUE;
+ }
+ else if (button == MB_MENU_CHOICE)
+ {
+ title_nr++;
+
+ if (!use_cross_fading)
+ {
+ FadeOut(fade_delay);
+ Delay(post_delay);
+ }
+
+ if (title_nr < MAX_NUM_TITLE_SCREENS &&
+ graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL)
+ {
+ Bitmap *drawto_last = drawto;
+
+ if (use_cross_fading)
+ drawto = bitmap_db_title;
+
+ DrawTitleScreenImage(title_nr);
+
+ drawto = drawto_last;
+
+ if (use_cross_fading)
+ FadeCross(bitmap_db_title, fade_delay);
+ else
+ FadeIn(fade_delay);
+ }
+ else
+ {
+ FadeOut(fade_delay);
+ Delay(post_delay);
+
+ return_to_main_menu = TRUE;
+ }
+ }
+
+ if (return_to_main_menu)
+ {
+ RedrawBackground();
+
+ game_status = GAME_MODE_MAIN;
+ DrawMainMenu();
+ }
+}
+
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
{
static unsigned long level_delay = 0;
static struct TokenInfo setup_info_editor[] =
{
+#if 0
{ TYPE_SWITCH, &setup.editor.el_boulderdash, "Boulder Dash:" },
{ TYPE_SWITCH, &setup.editor.el_emerald_mine, "Emerald Mine:" },
{ TYPE_SWITCH, &setup.editor.el_emerald_mine_club, "Emerald Mine Club:" },
{ TYPE_SWITCH, &setup.editor.el_supaplex, "Supaplex:" },
{ TYPE_SWITCH, &setup.editor.el_diamond_caves, "Diamond Caves II:" },
{ TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX-Boulderdash:" },
+#endif
{ TYPE_SWITCH, &setup.editor.el_chars, "Text Characters:" },
{ TYPE_SWITCH, &setup.editor.el_custom, "Custom & Group Elements:" },
{ TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" },
{ TYPE_SWITCH, &setup.editor.el_user_defined, "User defined element list:" },
{ TYPE_SWITCH, &setup.editor.el_dynamic, "Dynamic level elements:" },
{ TYPE_EMPTY, NULL, "" },
+ { TYPE_SWITCH, &setup.editor.show_element_token, "Show element token:" },
+ { TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
{ 0, NULL, NULL }
void DrawMainMenu(void);
void DrawHallOfFame(int);
+void HandleTitleScreen(int, int, int, int, int);
void HandleMainMenu(int, int, int, int, int);
void HandleChooseLevel(int, int, int, int, int);
void HandleHallOfFame(int, int, int, int, int);
if (redraw_mask & REDRAW_ALL)
{
BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
- redraw_mask = 0;
+
+ redraw_mask = REDRAW_NONE;
}
if (redraw_mask & REDRAW_FIELD)
BackToFront();
}
+#define FADE_MODE_FADE_IN 0
+#define FADE_MODE_FADE_OUT 1
+#define FADE_MODE_CROSSFADE 2
+
+static void FadeExt(Bitmap *bitmap_cross, int fade_ms, int fade_mode)
+{
+ SDL_Surface *surface_screen = backbuffer->surface;
+ SDL_Surface *surface_screen_copy = NULL;
+ SDL_Surface *surface_black = NULL;
+ SDL_Surface *surface_cross; /* initialized later */
+ boolean fade_reverse; /* initialized later */
+ unsigned int flags = SDL_SRCALPHA;
+ unsigned int time_last, time_current;
+ float alpha;
+ int alpha_final;
+
+ /* use same surface type as screen surface */
+ if ((surface_screen->flags & SDL_HWSURFACE))
+ flags |= SDL_HWSURFACE;
+ else
+ flags |= SDL_SWSURFACE;
+
+ /* create surface for copy of screen buffer */
+ if ((surface_screen_copy =
+ SDL_CreateRGBSurface(flags,
+ surface_screen->w,
+ surface_screen->h,
+ surface_screen->format->BitsPerPixel,
+ surface_screen->format->Rmask,
+ surface_screen->format->Gmask,
+ surface_screen->format->Bmask,
+ surface_screen->format->Amask)) == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
+
+ SDL_BlitSurface(surface_screen, NULL, surface_screen_copy, NULL);
+
+ /* create black surface for fading from/to black */
+ if ((surface_black =
+ SDL_CreateRGBSurface(flags,
+ surface_screen->w,
+ surface_screen->h,
+ surface_screen->format->BitsPerPixel,
+ surface_screen->format->Rmask,
+ surface_screen->format->Gmask,
+ surface_screen->format->Bmask,
+ surface_screen->format->Amask)) == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
+
+ SDL_FillRect(surface_black, NULL, SDL_MapRGB(surface_screen->format, 0,0,0));
+
+ fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE);
+ surface_cross = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_cross->surface :
+ surface_black);
+
+ time_current = SDL_GetTicks();
+
+ for (alpha = 0.0; alpha < 255.0;)
+ {
+ time_last = time_current;
+ time_current = SDL_GetTicks();
+ alpha += 255 * ((float)(time_current - time_last) / fade_ms);
+ alpha_final = (int)(fade_reverse ? 255.0 - alpha : alpha);
+ alpha_final = MIN(MAX(0, alpha_final), 255);
+
+ /* draw existing image to screen buffer */
+ SDL_BlitSurface(surface_screen_copy, NULL, surface_screen, NULL);
+
+ /* draw new image to screen buffer using alpha blending */
+ SDL_SetAlpha(surface_cross, SDL_SRCALPHA, alpha_final);
+ SDL_BlitSurface(surface_cross, NULL, surface_screen, NULL);
+
+ /* draw screen buffer to visible display */
+ SDL_Flip(surface_screen);
+ }
+
+ SDL_FreeSurface(surface_screen_copy);
+ SDL_FreeSurface(surface_black);
+
+ redraw_mask = REDRAW_NONE;
+}
+
+void FadeIn(int fade_ms)
+{
+#ifdef TARGET_SDL
+ FadeExt(NULL, fade_ms, FADE_MODE_FADE_IN);
+#else
+ BackToFront();
+#endif
+}
+
+void FadeOut(int fade_ms)
+{
+#ifdef TARGET_SDL
+ FadeExt(NULL, fade_ms, FADE_MODE_FADE_OUT);
+#else
+ BackToFront();
+#endif
+}
+
+void FadeCross(Bitmap *bitmap, int fade_ms)
+{
+#ifdef TARGET_SDL
+ FadeExt(bitmap, fade_ms, FADE_MODE_CROSSFADE);
+#else
+ BackToFront();
+#endif
+}
+
void SetMainBackgroundImageIfDefined(int graphic)
{
if (graphic_info[graphic].bitmap)
door_2.height = VYSIZE;
if (door_state == DOOR_GET_STATE)
- return(door1 | door2);
+ return (door1 | door2);
if (door_state & DOOR_SET_STATE)
{
if (door_state & DOOR_ACTION_2)
door2 = door_state & DOOR_ACTION_2;
- return(door1 | door2);
+ return (door1 | door2);
}
if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
door_2_done = (a == VXSIZE);
}
- BackToFront();
+ if (!(door_state & DOOR_NO_DELAY))
+ {
+ BackToFront();
- if (game_status == GAME_MODE_MAIN)
- DoAnimation();
+ if (game_status == GAME_MODE_MAIN)
+ DoAnimation();
- if (!(door_state & DOOR_NO_DELAY))
WaitUntilDelayReached(&door_delay, door_delay_value);
+ }
}
}
void RedrawPlayfield(boolean, int, int, int, int);
void BackToFront();
void FadeToFront();
+
+void FadeIn(int);
+void FadeOut(int);
+void FadeCross(Bitmap *, int);
+
void ClearWindow();
void SetMainBackgroundImageIfDefined(int);
void SetMainBackgroundImage(int);