2006-04-30
- * fixed bug that forced re-defining menu settings in each config file
+ * fixed bug that forced re-defining of menu settings in local graphics
+ config file which are already defined in existing base config file
2006-04-29
* added the possibility to define up to five title screens for each
-#define COMPILE_DATE_STRING "[2006-04-30 15:04]"
+#define COMPILE_DATE_STRING "[2006-04-30 16:56]"
#define SETUP_TOKEN_SOFT_SCROLLING 7
#define SETUP_TOKEN_FADING 8
#define SETUP_TOKEN_AUTORECORD 9
-#define SETUP_TOKEN_QUICK_DOORS 10
-#define SETUP_TOKEN_TEAM_MODE 11
-#define SETUP_TOKEN_HANDICAP 12
-#define SETUP_TOKEN_SKIP_LEVELS 13
-#define SETUP_TOKEN_TIME_LIMIT 14
-#define SETUP_TOKEN_FULLSCREEN 15
-#define SETUP_TOKEN_ASK_ON_ESCAPE 16
-#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 17
-#define SETUP_TOKEN_QUICK_SWITCH 18
-#define SETUP_TOKEN_INPUT_ON_FOCUS 19
-#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 20
-#define SETUP_TOKEN_GRAPHICS_SET 21
-#define SETUP_TOKEN_SOUNDS_SET 22
-#define SETUP_TOKEN_MUSIC_SET 23
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 24
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 25
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 26
-
-#define NUM_GLOBAL_SETUP_TOKENS 27
+#define SETUP_TOKEN_SHOW_TITLESCREEN 10
+#define SETUP_TOKEN_QUICK_DOORS 11
+#define SETUP_TOKEN_TEAM_MODE 12
+#define SETUP_TOKEN_HANDICAP 13
+#define SETUP_TOKEN_SKIP_LEVELS 14
+#define SETUP_TOKEN_TIME_LIMIT 15
+#define SETUP_TOKEN_FULLSCREEN 16
+#define SETUP_TOKEN_ASK_ON_ESCAPE 17
+#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 18
+#define SETUP_TOKEN_QUICK_SWITCH 19
+#define SETUP_TOKEN_INPUT_ON_FOCUS 20
+#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 21
+#define SETUP_TOKEN_GRAPHICS_SET 22
+#define SETUP_TOKEN_SOUNDS_SET 23
+#define SETUP_TOKEN_MUSIC_SET 24
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 25
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 26
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 27
+
+#define NUM_GLOBAL_SETUP_TOKENS 28
/* editor setup */
#define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0
{ TYPE_SWITCH, &si.soft_scrolling, "soft_scrolling" },
{ TYPE_SWITCH, &si.fading, "screen_fading" },
{ TYPE_SWITCH, &si.autorecord, "automatic_tape_recording" },
+ { TYPE_SWITCH, &si.show_titlescreen, "show_titlescreen" },
{ TYPE_SWITCH, &si.quick_doors, "quick_doors" },
{ TYPE_SWITCH, &si.team_mode, "team_mode" },
{ TYPE_SWITCH, &si.handicap, "handicap" },
si->soft_scrolling = TRUE;
si->fading = FALSE;
si->autorecord = TRUE;
+ si->show_titlescreen = TRUE;
si->quick_doors = FALSE;
si->team_mode = FALSE;
si->handicap = TRUE;
freeSetupFileHash(setup_file_hash);
}
-void LoadSpecialMenuDesignSettings_NEW()
+void LoadSpecialMenuDesignSettings()
{
char *filename_base = UNDEFINED_FILENAME, *filename_local;
int i, j;
get_auto_parameter_value(image_config_vars[i].token,
image_config[j].value);
-#if 0
+#if 1
if (!SETUP_OVERRIDE_ARTWORK(setup, ARTWORK_TYPE_GRAPHICS))
{
/* first look for special settings configured in level series config */
#endif
}
-void LoadSpecialMenuDesignSettings()
-{
- char *filename = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS);
- SetupFileHash *setup_file_hash;
- int i, j;
-
- /* always start with reliable default values from default config */
- for (i = 0; image_config_vars[i].token != NULL; i++)
- for (j = 0; image_config[j].token != NULL; j++)
- if (strEqual(image_config_vars[i].token, image_config[j].token))
- *image_config_vars[i].value =
- get_auto_parameter_value(image_config_vars[i].token,
- image_config[j].value);
-
- if ((setup_file_hash = loadSetupFileHash(filename)) == NULL)
- return;
-
- /* special case: initialize with default values that may be overwritten */
- for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
- {
- char *value_x = getHashEntry(setup_file_hash, "menu.draw_xoffset");
- char *value_y = getHashEntry(setup_file_hash, "menu.draw_yoffset");
- char *list_size = getHashEntry(setup_file_hash, "menu.list_size");
-
- if (value_x != NULL)
- menu.draw_xoffset[i] = get_integer_from_string(value_x);
- if (value_y != NULL)
- menu.draw_yoffset[i] = get_integer_from_string(value_y);
- if (list_size != NULL)
- menu.list_size[i] = get_integer_from_string(list_size);
- }
-
- /* read (and overwrite with) values that may be specified in config file */
- for (i = 0; image_config_vars[i].token != NULL; i++)
- {
- char *value = getHashEntry(setup_file_hash, image_config_vars[i].token);
-
- if (value != NULL)
- *image_config_vars[i].value =
- get_auto_parameter_value(image_config_vars[i].token, value);
- }
-
- freeSetupFileHash(setup_file_hash);
-}
-
void LoadUserDefinedEditorElementList(int **elements, int *num_elements)
{
char *filename = getEditorSetupFilename();
void *checked_realloc(void *, unsigned long);
void checked_free(void *);
-inline void swap_numbers(int *, int *);
-inline void swap_number_pairs(int *, int *, int *, int *);
+void swap_numbers(int *, int *);
+void swap_number_pairs(int *, int *, int *, int *);
int getFile8BitInteger(FILE *);
int putFile8BitInteger(FILE *, int);
Pixmap XCreatePixmap(Display *, Drawable, unsigned int, unsigned int,
unsigned int);
void XSync(Display *, Bool);
-inline void XCopyArea(Display *, Drawable, Drawable, GC, int, int,
- unsigned int, unsigned int, int, int);
+void XCopyArea(Display *, Drawable, Drawable, GC, int, int,
+ unsigned int, unsigned int, int, int);
int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *);
int XReadBitmapFile(Display *, Drawable, char *,
unsigned int *, unsigned int *, Pixmap *, int *, int *);
/* ========================================================================= */
/* functions from SGE library */
-inline void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
+void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
/* #ifdef PLATFORM_WIN32 */
#define FULLSCREEN_BUG
static int video_xoffset;
static int video_yoffset;
-inline void SDLInitVideoDisplay(void)
+void SDLInitVideoDisplay(void)
{
putenv("SDL_VIDEO_CENTERED=1");
video.default_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
}
-inline void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
- boolean fullscreen)
+void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
+ boolean fullscreen)
{
#ifdef FULLSCREEN_BUG
int i;
*window = CreateBitmap(video.width, video.height, video.depth);
}
-inline boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
+boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
{
boolean success = TRUE;
int surface_flags_fullscreen = SURFACE_FLAGS | SDL_FULLSCREEN;
return success;
}
-inline void SDLCreateBitmapContent(Bitmap *new_bitmap,
- int width, int height, int depth)
+void SDLCreateBitmapContent(Bitmap *new_bitmap, int width, int height,
+ int depth)
{
SDL_Surface *surface_tmp, *surface_native;
new_bitmap->surface = surface_native;
}
-inline void SDLFreeBitmapPointers(Bitmap *bitmap)
+void SDLFreeBitmapPointers(Bitmap *bitmap)
{
if (bitmap->surface)
SDL_FreeSurface(bitmap->surface);
bitmap->surface_masked = NULL;
}
-inline void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
- int src_x, int src_y,
- int width, int height,
- int dst_x, int dst_y, int mask_mode)
+void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y, int mask_mode)
{
Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
SDL_Rect src_rect, dst_rect;
SDL_UpdateRect(backbuffer->surface, dst_x, dst_y, width, height);
}
-inline void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y,
- int width, int height, Uint32 color)
+void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y,
+ int width, int height, Uint32 color)
{
Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
SDL_Rect rect;
SDL_UpdateRect(backbuffer->surface, x, y, width, height);
}
-inline void SDLDrawSimpleLine(Bitmap *dst_bitmap, int from_x, int from_y,
- int to_x, int to_y, Uint32 color)
+void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
+ int post_delay)
+{
+ static boolean initialization_needed = TRUE;
+ static SDL_Surface *surface_screen_copy = NULL;
+ static SDL_Surface *surface_black = NULL;
+ SDL_Surface *surface_screen = backbuffer->surface;
+ SDL_Surface *surface_cross; /* initialized later */
+ boolean fade_reverse; /* initialized later */
+ unsigned int time_last, time_current;
+ float alpha;
+ int alpha_final;
+
+ if (initialization_needed)
+ {
+ unsigned int flags = SDL_SRCALPHA;
+
+ /* use same surface type as screen surface */
+ if ((surface_screen->flags & SDL_HWSURFACE))
+ flags |= SDL_HWSURFACE;
+ else
+ flags |= SDL_SWSURFACE;
+
+ /* create surface for temporary 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());
+
+ /* 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());
+
+ /* completely fill the surface with black color pixels */
+ SDL_FillRect(surface_black, NULL,
+ SDL_MapRGB(surface_screen->format, 0, 0, 0));
+
+ initialization_needed = FALSE;
+ }
+
+ /* copy the current screen backbuffer to the temporary screen copy buffer */
+ SDL_BlitSurface(surface_screen, NULL, surface_screen_copy, NULL);
+
+ 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_delay);
+ 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);
+ }
+
+ Delay(post_delay);
+}
+
+void SDLDrawSimpleLine(Bitmap *dst_bitmap, int from_x, int from_y,
+ int to_x, int to_y, Uint32 color)
{
SDL_Surface *surface = dst_bitmap->surface;
SDL_Rect rect;
SDL_FillRect(surface, &rect, color);
}
-inline void SDLDrawLine(Bitmap *dst_bitmap, int from_x, int from_y,
- int to_x, int to_y, Uint32 color)
+void SDLDrawLine(Bitmap *dst_bitmap, int from_x, int from_y,
+ int to_x, int to_y, Uint32 color)
{
#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
}
#if 0
-inline void SDLDrawLines(SDL_Surface *surface, struct XY *points,
- int num_points, Uint32 color)
+void SDLDrawLines(SDL_Surface *surface, struct XY *points,
+ int num_points, Uint32 color)
{
int i, x, y;
int line_width = 4;
}
#endif
-inline Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y)
+Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y)
{
SDL_Surface *surface = src_bitmap->surface;
sge_Line(Surface, x1, y1, x2, y2, SDL_MapRGB(Surface->format, R, G, B));
}
-inline void SDLPutPixel(Bitmap *dst_bitmap, int x, int y, Pixel pixel)
+void SDLPutPixel(Bitmap *dst_bitmap, int x, int y, Pixel pixel)
{
#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
-----------------------------------------------------------------------------
*/
-inline void SDLInvertArea(Bitmap *bitmap, int src_x, int src_y,
- int width, int height, Uint32 color)
+void SDLInvertArea(Bitmap *bitmap, int src_x, int src_y,
+ int width, int height, Uint32 color)
{
int x, y;
}
}
-inline void SDLCopyInverseMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
- int src_x, int src_y, int width, int height,
- int dst_x, int dst_y)
+void SDLCopyInverseMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y)
{
int x, y;
/* audio functions */
/* ========================================================================= */
-inline void SDLOpenAudio(void)
+void SDLOpenAudio(void)
{
if (!strEqual(setup.system.sdl_audiodriver, ARG_DEFAULT))
putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver));
Mixer_InitChannels();
}
-inline void SDLCloseAudio(void)
+void SDLCloseAudio(void)
{
Mix_HaltMusic();
Mix_HaltChannel(-1);
/* event functions */
/* ========================================================================= */
-inline void SDLNextEvent(Event *event)
+void SDLNextEvent(Event *event)
{
SDL_WaitEvent(event);
/* SDL function definitions */
-inline void SDLInitVideoDisplay(void);
-inline void SDLInitVideoBuffer(DrawBuffer **, DrawWindow **, boolean);
-inline boolean SDLSetVideoMode(DrawBuffer **, boolean);
-inline void SDLCreateBitmapContent(Bitmap *, int, int, int);
-inline void SDLFreeBitmapPointers(Bitmap *);
-inline void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
-inline void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32);
-inline void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32);
-inline void SDLDrawLine(Bitmap *, int, int, int, int, Uint32);
-inline Pixel SDLGetPixel(Bitmap *, int, int);
-inline void SDLPutPixel(Bitmap *, int, int, Pixel);
-
-inline void SDLInvertArea(Bitmap *, int, int, int, int, Uint32);
-inline void SDLCopyInverseMasked(Bitmap *, Bitmap *, int, int, int, int,
- int, int);
+void SDLInitVideoDisplay(void);
+void SDLInitVideoBuffer(DrawBuffer **, DrawWindow **, boolean);
+boolean SDLSetVideoMode(DrawBuffer **, boolean);
+void SDLCreateBitmapContent(Bitmap *, int, int, int);
+void SDLFreeBitmapPointers(Bitmap *);
+void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
+void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32);
+void SDLFadeScreen(Bitmap *, int, int, int);
+void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32);
+void SDLDrawLine(Bitmap *, int, int, int, int, Uint32);
+Pixel SDLGetPixel(Bitmap *, int, int);
+void SDLPutPixel(Bitmap *, int, int, Pixel);
+
+void SDLInvertArea(Bitmap *, int, int, int, int, Uint32);
+void SDLCopyInverseMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
void SDLZoomBitmap(Bitmap *, Bitmap *);
void SDLSetMouseCursor(struct MouseCursorInfo *);
-inline void SDLOpenAudio(void);
-inline void SDLCloseAudio(void);
+void SDLOpenAudio(void);
+void SDLCloseAudio(void);
-inline void SDLNextEvent(Event *);
+void SDLNextEvent(Event *);
void HandleJoystickEvent(Event *);
void SDLInitJoysticks(void);
#endif
}
-inline void InitVideoDisplay(void)
+void InitVideoDisplay(void)
{
#if defined(TARGET_SDL)
SDLInitVideoDisplay();
#endif
}
-inline void CloseVideoDisplay(void)
+void CloseVideoDisplay(void)
{
KeyboardAutoRepeatOn();
#endif
}
-inline void InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
- int width, int height, int depth,
- boolean fullscreen)
+void InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
+ int width, int height, int depth, boolean fullscreen)
{
video.width = width;
video.height = height;
#endif
}
-inline Bitmap *CreateBitmapStruct(void)
+Bitmap *CreateBitmapStruct(void)
{
#if defined(TARGET_SDL)
return checked_calloc(sizeof(struct SDLSurfaceInfo));
#endif
}
-inline Bitmap *CreateBitmap(int width, int height, int depth)
+Bitmap *CreateBitmap(int width, int height, int depth)
{
Bitmap *new_bitmap = CreateBitmapStruct();
int real_depth = GetRealDepth(depth);
*dst_bitmap = *src_bitmap;
}
-inline void FreeBitmap(Bitmap *bitmap)
+void FreeBitmap(Bitmap *bitmap)
{
if (bitmap == NULL)
return;
free(bitmap);
}
-inline void CloseWindow(DrawWindow *window)
+void CloseWindow(DrawWindow *window)
{
#if defined(TARGET_X11)
if (window->drawable)
#endif
}
-static inline boolean CheckDrawingArea(int x, int y, int width, int height,
+inline static boolean CheckDrawingArea(int x, int y, int width, int height,
int draw_mask)
{
if (draw_mask == REDRAW_NONE)
return FALSE;
}
-inline boolean DrawingDeactivated(int x, int y, int width, int height)
+boolean DrawingDeactivated(int x, int y, int width, int height)
{
return CheckDrawingArea(x, y, width, height, gfx.draw_deactivation_mask);
}
-inline boolean DrawingOnBackground(int x, int y)
+boolean DrawingOnBackground(int x, int y)
{
return (CheckDrawingArea(x, y, 1, 1, gfx.background_bitmap_mask) &&
CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask));
}
-inline void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap,
- int src_x, int src_y, int width, int height,
- int dst_x, int dst_y)
+void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y)
{
if (DrawingDeactivated(dst_x, dst_y, width, height))
return;
dst_x, dst_y, BLIT_OPAQUE);
}
-inline void FillRectangle(Bitmap *bitmap, int x, int y, int width, int height,
- Pixel color)
+void FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
+ int post_delay)
+{
+#if defined(TARGET_SDL)
+ SDLFadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay);
+#else
+ X11FadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay);
+#endif
+}
+
+void FillRectangle(Bitmap *bitmap, int x, int y, int width, int height,
+ Pixel color)
{
if (DrawingDeactivated(x, y, width, height))
return;
sysFillRectangle(bitmap, x, y, width, height, color);
}
-inline void ClearRectangle(Bitmap *bitmap, int x, int y, int width, int height)
+void ClearRectangle(Bitmap *bitmap, int x, int y, int width, int height)
{
FillRectangle(bitmap, x, y, width, height, BLACK_PIXEL);
}
-inline void ClearRectangleOnBackground(Bitmap *bitmap, int x, int y,
- int width, int height)
+void ClearRectangleOnBackground(Bitmap *bitmap, int x, int y,
+ int width, int height)
{
if (DrawingOnBackground(x, y))
BlitBitmap(gfx.background_bitmap, bitmap, x, y, width, height, x, y);
ClearRectangle(bitmap, x, y, width, height);
}
-inline void SetClipMask(Bitmap *bitmap, GC clip_gc, Pixmap clip_pixmap)
+void SetClipMask(Bitmap *bitmap, GC clip_gc, Pixmap clip_pixmap)
{
#if defined(TARGET_X11)
if (clip_gc)
#endif
}
-inline void SetClipOrigin(Bitmap *bitmap, GC clip_gc, int clip_x, int clip_y)
+void SetClipOrigin(Bitmap *bitmap, GC clip_gc, int clip_x, int clip_y)
{
#if defined(TARGET_X11)
if (clip_gc)
#endif
}
-inline void BlitBitmapMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
- int src_x, int src_y,
- int width, int height,
- int dst_x, int dst_y)
+void BlitBitmapMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y)
{
if (DrawingDeactivated(dst_x, dst_y, width, height))
return;
dst_x, dst_y, BLIT_MASKED);
}
-inline void BlitBitmapOnBackground(Bitmap *src_bitmap, Bitmap *dst_bitmap,
- int src_x, int src_y,
- int width, int height,
- int dst_x, int dst_y)
+void BlitBitmapOnBackground(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y)
{
if (DrawingOnBackground(dst_x, dst_y))
{
dst_x, dst_y);
}
-inline void DrawSimpleBlackLine(Bitmap *bitmap, int from_x, int from_y,
- int to_x, int to_y)
+void DrawSimpleBlackLine(Bitmap *bitmap, int from_x, int from_y,
+ int to_x, int to_y)
{
#if defined(TARGET_SDL)
SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, BLACK_PIXEL);
#endif
}
-inline void DrawSimpleWhiteLine(Bitmap *bitmap, int from_x, int from_y,
- int to_x, int to_y)
+void DrawSimpleWhiteLine(Bitmap *bitmap, int from_x, int from_y,
+ int to_x, int to_y)
{
#if defined(TARGET_SDL)
SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, WHITE_PIXEL);
}
#if !defined(TARGET_X11_NATIVE)
-inline void DrawLine(Bitmap *bitmap, int from_x, int from_y,
- int to_x, int to_y, Pixel pixel, int line_width)
+void DrawLine(Bitmap *bitmap, int from_x, int from_y,
+ int to_x, int to_y, Pixel pixel, int line_width)
{
int x, y;
}
#endif
-inline void DrawLines(Bitmap *bitmap, struct XY *points, int num_points,
- Pixel pixel)
+void DrawLines(Bitmap *bitmap, struct XY *points, int num_points, Pixel pixel)
{
#if !defined(TARGET_X11_NATIVE)
int line_width = 4;
#endif
}
-inline Pixel GetPixel(Bitmap *bitmap, int x, int y)
+Pixel GetPixel(Bitmap *bitmap, int x, int y)
{
if (x < 0 || x >= bitmap->width ||
y < 0 || y >= bitmap->height)
#endif
}
-inline Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r,
- unsigned int color_g, unsigned int color_b)
+Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r,
+ unsigned int color_g, unsigned int color_b)
{
#if defined(TARGET_SDL)
return SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b);
#endif
}
-inline Pixel GetPixelFromRGBcompact(Bitmap *bitmap, unsigned int color)
+Pixel GetPixelFromRGBcompact(Bitmap *bitmap, unsigned int color)
{
unsigned int color_r = (color >> 16) & 0xff;
unsigned int color_g = (color >> 8) & 0xff;
}
/* execute all pending screen drawing operations */
-inline void FlushDisplay(void)
+void FlushDisplay(void)
{
#ifndef TARGET_SDL
XFlush(display);
}
/* execute and wait for all pending screen drawing operations */
-inline void SyncDisplay(void)
+void SyncDisplay(void)
{
#ifndef TARGET_SDL
XSync(display, FALSE);
#endif
}
-inline void KeyboardAutoRepeatOn(void)
+void KeyboardAutoRepeatOn(void)
{
#if defined(TARGET_SDL)
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY / 2,
#endif
}
-inline void KeyboardAutoRepeatOff(void)
+void KeyboardAutoRepeatOff(void)
{
#if defined(TARGET_SDL)
SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
#endif
}
-inline boolean PointerInWindow(DrawWindow *window)
+boolean PointerInWindow(DrawWindow *window)
{
#if defined(TARGET_SDL)
return TRUE;
#endif
}
-inline boolean SetVideoMode(boolean fullscreen)
+boolean SetVideoMode(boolean fullscreen)
{
#if defined(TARGET_SDL)
return SDLSetVideoMode(&backbuffer, fullscreen);
#endif
}
-inline boolean ChangeVideoModeIfNeeded(boolean fullscreen)
+boolean ChangeVideoModeIfNeeded(boolean fullscreen)
{
#if defined(TARGET_SDL)
if ((fullscreen && !video.fullscreen_enabled && video.fullscreen_available)||
/* audio functions */
/* ========================================================================= */
-inline void OpenAudio(void)
+void OpenAudio(void)
{
/* always start with reliable default values */
audio.sound_available = FALSE;
#endif
}
-inline void CloseAudio(void)
+void CloseAudio(void)
{
#if defined(TARGET_SDL)
SDLCloseAudio();
audio.sound_enabled = FALSE;
}
-inline void SetAudioMode(boolean enabled)
+void SetAudioMode(boolean enabled)
{
if (!audio.sound_available)
return;
/* event functions */
/* ========================================================================= */
-inline void InitEventFilter(EventFilter filter_function)
+void InitEventFilter(EventFilter filter_function)
{
#if defined(TARGET_SDL)
/* set event filter to filter out certain events */
#endif
}
-inline boolean PendingEvent(void)
+boolean PendingEvent(void)
{
#if defined(TARGET_SDL)
return (SDL_PollEvent(NULL) ? TRUE : FALSE);
#endif
}
-inline void NextEvent(Event *event)
+void NextEvent(Event *event)
{
#if defined(TARGET_SDL)
SDLNextEvent(event);
#endif
}
-inline void PeekEvent(Event *event)
+void PeekEvent(Event *event)
{
#if defined(TARGET_SDL)
SDL_PeepEvents(event, 1, SDL_PEEKEVENT, SDL_ALLEVENTS);
#endif
}
-inline Key GetEventKey(KeyEvent *event, boolean with_modifiers)
+Key GetEventKey(KeyEvent *event, boolean with_modifiers)
{
#if defined(TARGET_SDL)
#endif
}
-inline KeyMod HandleKeyModState(Key key, int key_status)
+KeyMod HandleKeyModState(Key key, int key_status)
{
static KeyMod current_modifiers = KMOD_None;
return current_modifiers;
}
-inline KeyMod GetKeyModState()
+KeyMod GetKeyModState()
{
#if defined(TARGET_SDL)
return (KeyMod)SDL_GetModState();
#endif
}
-inline boolean CheckCloseWindowEvent(ClientMessageEvent *event)
+boolean CheckCloseWindowEvent(ClientMessageEvent *event)
{
if (event->type != EVENT_CLIENTMESSAGE)
return FALSE;
/* joystick functions */
/* ========================================================================= */
-inline void InitJoysticks()
+void InitJoysticks()
{
int i;
#endif
}
-inline boolean ReadJoystick(int nr, int *x, int *y, boolean *b1, boolean *b2)
+boolean ReadJoystick(int nr, int *x, int *y, boolean *b1, boolean *b2)
{
#if defined(TARGET_SDL)
return SDLReadJoystick(nr, x, y, b1, b2);
#define REDRAW_FPS (1 << 11)
#define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
+#define FADE_MODE_FADE_IN 0
+#define FADE_MODE_FADE_OUT 1
+#define FADE_MODE_CROSSFADE 2
+
#define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
y >= gfx.sy && y < gfx.sy + gfx.sysize)
#define IN_GFX_DOOR(x, y) (x >= gfx.dx && x < gfx.dx + gfx.dxsize && \
boolean soft_scrolling;
boolean fading;
boolean autorecord;
+ boolean show_titlescreen;
boolean quick_doors;
boolean team_mode;
boolean handicap;
void SetMainBackgroundBitmap(Bitmap *);
void SetDoorBackgroundBitmap(Bitmap *);
-inline void InitVideoDisplay(void);
-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 FreeBitmap(Bitmap *);
-inline void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
-inline void FillRectangle(Bitmap *, int, int, int, int, Pixel);
-inline void ClearRectangle(Bitmap *, int, int, int, int);
-inline void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
-inline void SetClipMask(Bitmap *, GC, Pixmap);
-inline void SetClipOrigin(Bitmap *, GC, int, int);
-inline void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
-inline boolean DrawingOnBackground(int, int);
-inline void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int,
- int);
-inline void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
-inline void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
-inline void DrawLines(Bitmap *, struct XY *, int, Pixel);
-inline Pixel GetPixel(Bitmap *, int, int);
-inline Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
-inline Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
-
-inline void FlushDisplay(void);
-inline void SyncDisplay(void);
-inline void KeyboardAutoRepeatOn(void);
-inline void KeyboardAutoRepeatOff(void);
-inline boolean PointerInWindow(DrawWindow *);
-inline boolean SetVideoMode(boolean);
-inline boolean ChangeVideoModeIfNeeded(boolean);
+void InitVideoDisplay(void);
+void CloseVideoDisplay(void);
+void InitVideoBuffer(DrawBuffer **,DrawWindow **, int,int,int, boolean);
+Bitmap *CreateBitmapStruct(void);
+Bitmap *CreateBitmap(int, int, int);
+void FreeBitmap(Bitmap *);
+void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
+void FadeScreen(Bitmap *bitmap, int, int, int);
+void FillRectangle(Bitmap *, int, int, int, int, Pixel);
+void ClearRectangle(Bitmap *, int, int, int, int);
+void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
+void SetClipMask(Bitmap *, GC, Pixmap);
+void SetClipOrigin(Bitmap *, GC, int, int);
+void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
+boolean DrawingOnBackground(int, int);
+void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int, int);
+void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
+void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
+void DrawLines(Bitmap *, struct XY *, int, Pixel);
+Pixel GetPixel(Bitmap *, int, int);
+Pixel GetPixelFromRGB(Bitmap *, unsigned int,unsigned int,unsigned int);
+Pixel GetPixelFromRGBcompact(Bitmap *, unsigned int);
+
+void FlushDisplay(void);
+void SyncDisplay(void);
+void KeyboardAutoRepeatOn(void);
+void KeyboardAutoRepeatOff(void);
+boolean PointerInWindow(DrawWindow *);
+boolean SetVideoMode(boolean);
+boolean ChangeVideoModeIfNeeded(boolean);
Bitmap *LoadImage(char *);
Bitmap *LoadCustomImage(char *);
void SetMouseCursor(int);
-inline void OpenAudio(void);
-inline void CloseAudio(void);
-inline void SetAudioMode(boolean);
-
-inline void InitEventFilter(EventFilter);
-inline boolean PendingEvent(void);
-inline void NextEvent(Event *event);
-inline void PeekEvent(Event *event);
-inline Key GetEventKey(KeyEvent *, boolean);
-inline KeyMod HandleKeyModState(Key, int);
-inline KeyMod GetKeyModState();
-inline boolean CheckCloseWindowEvent(ClientMessageEvent *);
-
-inline void InitJoysticks();
-inline boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
+void OpenAudio(void);
+void CloseAudio(void);
+void SetAudioMode(boolean);
+
+void InitEventFilter(EventFilter);
+boolean PendingEvent(void);
+void NextEvent(Event *event);
+void PeekEvent(Event *event);
+Key GetEventKey(KeyEvent *, boolean);
+KeyMod HandleKeyModState(Key, int);
+KeyMod GetKeyModState();
+boolean CheckCloseWindowEvent(ClientMessageEvent *);
+
+void InitJoysticks();
+boolean ReadJoystick(int, int *, int *, boolean *, boolean *);
#endif /* SYSTEM_H */
static void X11InitDisplay();
static DrawWindow *X11InitWindow();
-inline void X11InitVideoDisplay(void)
+void X11InitVideoDisplay(void)
{
/* initialize X11 video */
X11InitDisplay();
video.default_depth = XDefaultDepth(display, screen);
}
-inline void X11InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window)
+void X11InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window)
{
*window = X11InitWindow();
return new_bitmap;
}
-inline void X11CreateBitmapContent(Bitmap *new_bitmap,
- int width, int height, int depth)
+void X11CreateBitmapContent(Bitmap *new_bitmap,
+ int width, int height, int depth)
{
Pixmap pixmap;
new_bitmap->line_gc[1] = window->line_gc[1];
}
-inline void X11FreeBitmapPointers(Bitmap *bitmap)
+void X11FreeBitmapPointers(Bitmap *bitmap)
{
/* The X11 version seems to have a memory leak here -- although
"XFreePixmap()" is called, the corresponding memory seems not
bitmap->stored_clip_gc = None;
}
-inline void X11CopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
- int src_x, int src_y, int width, int height,
- int dst_x, int dst_y, int mask_mode)
+void X11CopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y, int mask_mode)
{
XCopyArea(display, src_bitmap->drawable, dst_bitmap->drawable,
(mask_mode == BLIT_MASKED ? src_bitmap->clip_gc : dst_bitmap->gc),
src_x, src_y, width, height, dst_x, dst_y);
}
-inline void X11FillRectangle(Bitmap *bitmap, int x, int y,
- int width, int height, Pixel color)
+void X11FillRectangle(Bitmap *bitmap, int x, int y,
+ int width, int height, Pixel color)
{
XSetForeground(display, bitmap->gc, color);
XFillRectangle(display, bitmap->drawable, bitmap->gc, x, y, width, height);
}
-inline void X11DrawSimpleLine(Bitmap *bitmap, int from_x, int from_y,
- int to_x, int to_y, Pixel color)
+void X11FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
+ int post_delay)
+{
+ /* fading currently not supported -- simply copy target image to screen */
+
+ if (fade_mode == FADE_MODE_FADE_OUT)
+ X11FillRectangle(window, 0, 0, video.width, video.height, BLACK_PIXEL);
+ else
+ X11CopyArea(bitmap_cross != NULL ? bitmap_cross : backbuffer, window,
+ 0, 0, video.width, video.height, 0, 0, BLIT_OPAQUE);
+
+ /* as we currently cannot use the fade delay, also do not use post delay */
+}
+
+void X11DrawSimpleLine(Bitmap *bitmap, int from_x, int from_y,
+ int to_x, int to_y, Pixel color)
{
XSetForeground(display, bitmap->gc, color);
XDrawLine(display, bitmap->drawable, bitmap->gc, from_x, from_y, to_x, to_y);
}
-inline Pixel X11GetPixel(Bitmap *bitmap, int x, int y)
+Pixel X11GetPixel(Bitmap *bitmap, int x, int y)
{
XImage *pixel_image;
Pixel pixel_value;
}
#if defined(TARGET_X11_NATIVE)
-inline Pixel X11GetPixelFromRGB(unsigned int color_r, unsigned int color_g,
- unsigned int color_b)
+Pixel X11GetPixelFromRGB(unsigned int color_r, unsigned int color_g,
+ unsigned int color_b)
{
XColor xcolor;
Pixel pixel;
}
#endif /* TARGET_X11_NATIVE */
-inline void X11DestroyImage(XImage *ximage)
+void X11DestroyImage(XImage *ximage)
{
#if defined(TARGET_X11_NATIVE)
/* this seems to be needed for OS/2, but does not hurt on other platforms */
/* X11 function definitions */
-inline void X11InitVideoDisplay(void);
-inline void X11InitVideoBuffer(DrawBuffer **, DrawWindow **);
+void X11InitVideoDisplay(void);
+void X11InitVideoBuffer(DrawBuffer **, DrawWindow **);
void X11ZoomBitmap(Bitmap *, Bitmap *);
Bitmap *X11LoadImage(char *);
-inline void X11CreateBitmapContent(Bitmap *, int, int, int);
-inline void X11FreeBitmapPointers(Bitmap *);
-inline void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
-inline void X11FillRectangle(Bitmap *, int, int, int, int, Pixel);
-inline void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel);
-inline Pixel X11GetPixel(Bitmap *, int, int);
-inline Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int);
-inline void X11DestroyImage(XImage *);
+void X11CreateBitmapContent(Bitmap *, int, int, int);
+void X11FreeBitmapPointers(Bitmap *);
+void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
+void X11FillRectangle(Bitmap *, int, int, int, int, Pixel);
+void X11FadeScreen(Bitmap *, int, int, int);
+void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel);
+Pixel X11GetPixel(Bitmap *, int, int);
+Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int);
+void X11DestroyImage(XImage *);
#if defined(TARGET_X11_NATIVE)
void X11SetMouseCursor(struct MouseCursorInfo *);
struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
{
{ ".[DEFAULT]", GAME_MODE_DEFAULT, },
+ { ".TITLE", GAME_MODE_TITLE, },
{ ".MAIN", GAME_MODE_MAIN, },
{ ".LEVELS", GAME_MODE_LEVELS },
{ ".SCORES", GAME_MODE_SCORES, },
CloseDoor(DOOR_CLOSE_1);
#endif
- HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
-
PlayMenuSound();
PlayMenuMusic();
+ HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
+
+#if 0
#if 1
FadeIn(1000);
#else
FadeToFront();
#endif
+#endif
+
StopAnimation();
}
-void DrawMainMenu()
+static void DrawMainMenuExt(int fade_delay)
{
static LevelDirTree *leveldir_last_valid = NULL;
boolean levelset_has_changed = FALSE;
SetDrawtoField(DRAW_BACKBUFFER);
#endif
- if (levelset_has_changed && graphic_info[IMG_TITLESCREEN_1].bitmap != NULL)
+ if (setup.show_titlescreen &&
+ levelset_has_changed &&
+ graphic_info[IMG_TITLESCREEN_1].bitmap != NULL)
{
game_status = GAME_MODE_TITLE;
DrawTitleScreen();
DrawTextSCentered(326, FONT_TITLE_2, "A Game by Artsoft Entertainment");
+#if 0
FadeToFront();
InitAnimation();
+#endif
HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE);
PlayMenuSound();
PlayMenuMusic();
+#if 1
OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
+#else
+ if (fade_delay > 0)
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+ else
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
+#endif
#if 1
/* map gadgets for main menu screen */
MapTapeButtons();
#endif
+
+#if 1
+ if (fade_delay > 0)
+ FadeIn(fade_delay);
+ else
+ BackToFront();
+
+ InitAnimation();
+#endif
+}
+
+void DrawMainMenu()
+{
+ DrawMainMenuExt(FALSE);
}
#if 0
{
static int title_nr = 0;
boolean return_to_main_menu = FALSE;
+ boolean use_fading_main_menu = TRUE;
boolean use_cross_fading = TRUE;
int fade_delay = 1000;
int post_delay = 500;
DrawTitleScreenImage(title_nr);
+ FadeIn(fade_delay);
+
return;
}
else if (button == MB_MENU_LEAVE)
{
return_to_main_menu = TRUE;
+ use_fading_main_menu = FALSE;
}
else if (button == MB_MENU_CHOICE)
{
title_nr++;
if (!use_cross_fading)
- {
- FadeOut(fade_delay);
- Delay(post_delay);
- }
+ FadeOut(fade_delay, post_delay);
if (title_nr < MAX_NUM_TITLE_SCREENS &&
graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL)
}
else
{
- FadeOut(fade_delay);
- Delay(post_delay);
+ FadeOut(fade_delay, post_delay);
return_to_main_menu = TRUE;
}
{
RedrawBackground();
+#if 1
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+#endif
+
game_status = GAME_MODE_MAIN;
- DrawMainMenu();
+ DrawMainMenuExt(use_fading_main_menu ? fade_delay : 0);
}
}
#endif
{ TYPE_SWITCH, &setup.quick_switch, "Quick Player Focus Switch:" },
{ TYPE_SWITCH, &setup.quick_doors, "Quick Menu Doors:" },
- { TYPE_SWITCH, &setup.toons, "Toons:" },
+ { TYPE_SWITCH, &setup.show_titlescreen,"Show Title Screens:" },
+ { TYPE_SWITCH, &setup.toons, "Show Toons:" },
{ TYPE_ECS_AGA, &setup.prefer_aga_graphics,"EMC graphics preference:" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
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)
+void FadeIn(int fade_delay)
{
- static boolean initialization_needed = TRUE;
- static SDL_Surface *surface_screen_copy = NULL;
- static SDL_Surface *surface_black = NULL;
- SDL_Surface *surface_screen = backbuffer->surface;
- SDL_Surface *surface_cross; /* initialized later */
- boolean fade_reverse; /* initialized later */
- unsigned int time_last, time_current;
- float alpha;
- int alpha_final;
-
- if (initialization_needed)
- {
- unsigned int flags = SDL_SRCALPHA;
-
- /* use same surface type as screen surface */
- if ((surface_screen->flags & SDL_HWSURFACE))
- flags |= SDL_HWSURFACE;
- else
- flags |= SDL_SWSURFACE;
-
- /* create surface for temporary 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());
-
- /* 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());
-
- /* completely fill the surface with black color pixels */
- SDL_FillRect(surface_black, NULL,
- SDL_MapRGB(surface_screen->format, 0, 0, 0));
-
- initialization_needed = FALSE;
- }
-
- /* copy the current screen backbuffer to the temporary screen copy buffer */
- SDL_BlitSurface(surface_screen, NULL, surface_screen_copy, NULL);
-
- 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);
- }
+ FadeScreen(NULL, FADE_MODE_FADE_IN, fade_delay, 0);
redraw_mask = REDRAW_NONE;
}
-void FadeIn(int fade_ms)
+void FadeOut(int fade_delay, int post_delay)
{
-#ifdef TARGET_SDL
- FadeExt(NULL, fade_ms, FADE_MODE_FADE_IN);
-#else
- BackToFront();
-#endif
-}
+ FadeScreen(NULL, FADE_MODE_FADE_OUT, fade_delay, post_delay);
-void FadeOut(int fade_ms)
-{
-#ifdef TARGET_SDL
- FadeExt(NULL, fade_ms, FADE_MODE_FADE_OUT);
-#else
- BackToFront();
-#endif
+ redraw_mask = REDRAW_NONE;
}
-void FadeCross(Bitmap *bitmap, int fade_ms)
+void FadeCross(Bitmap *bitmap, int fade_delay)
{
-#ifdef TARGET_SDL
- FadeExt(bitmap, fade_ms, FADE_MODE_CROSSFADE);
-#else
- BackToFront();
-#endif
+ FadeScreen(bitmap, FADE_MODE_CROSSFADE, fade_delay, 0);
+
+ redraw_mask = REDRAW_NONE;
}
void SetMainBackgroundImageIfDefined(int graphic)
return (door1 | door2);
}
- if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
- door_state &= ~DOOR_OPEN_1;
- else if (door1 == DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1)
- door_state &= ~DOOR_CLOSE_1;
- if (door2 == DOOR_OPEN_2 && door_state & DOOR_OPEN_2)
- door_state &= ~DOOR_OPEN_2;
- else if (door2 == DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
- door_state &= ~DOOR_CLOSE_2;
+ if (!(door_state & DOOR_FORCE_REDRAW))
+ {
+ if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
+ door_state &= ~DOOR_OPEN_1;
+ else if (door1 == DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1)
+ door_state &= ~DOOR_CLOSE_1;
+ if (door2 == DOOR_OPEN_2 && door_state & DOOR_OPEN_2)
+ door_state &= ~DOOR_OPEN_2;
+ else if (door2 == DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
+ door_state &= ~DOOR_CLOSE_2;
+ }
door_delay_value = (door_state & DOOR_ACTION_1 ? door_1.step_delay :
door_2.step_delay);
#define DOOR_COPY_BACK (1 << 4)
#define DOOR_NO_COPY_BACK (1 << 5)
#define DOOR_NO_DELAY (1 << 6)
-#define DOOR_GET_STATE (1 << 7)
-#define DOOR_SET_STATE (1 << 8)
+#define DOOR_FORCE_REDRAW (1 << 7)
+#define DOOR_GET_STATE (1 << 8)
+#define DOOR_SET_STATE (1 << 9)
/* for Request */
#define REQ_ASK (1 << 0)
void FadeToFront();
void FadeIn(int);
-void FadeOut(int);
+void FadeOut(int, int);
void FadeCross(Bitmap *, int);
void ClearWindow();