int anim_delay_counter;
int post_delay_counter;
+ int drawing_stage;
+
int state;
int last_game_status;
};
InitToonControls();
}
-void DrawGlobalAnim()
+void DrawGlobalAnimExt(int drawing_stage)
{
int mode_nr;
if (!do_animations || !setup.toons)
return;
- DoAnimationExt();
+ if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_1)
+ DoAnimationExt();
for (mode_nr = 0; mode_nr < NUM_SPECIAL_GFX_ARGS; mode_nr++)
{
if (!(part->state & ANIM_STATE_RUNNING))
continue;
+ if (part->drawing_stage != drawing_stage)
+ continue;
+
if (part->x < 0)
{
dst_x = 0;
}
}
+void DrawGlobalAnim(int drawing_stage)
+{
+ if (!do_animations || !setup.toons)
+ return;
+
+ DrawGlobalAnimExt(drawing_stage);
+}
+
boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part)
{
int viewport_x;
part->last_game_status = game_status;
+ part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_1;
+
if (part->control_info.class == get_hash_from_key("window") ||
part->control_info.class == get_hash_from_key("border"))
{
viewport_y = 0;
viewport_width = WIN_XSIZE;
viewport_height = WIN_YSIZE;
+
+ part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_2;
}
else if (part->control_info.class == get_hash_from_key("door_1"))
{
void InitToons(void);
-void DrawGlobalAnim(void);
+void DrawGlobalAnim(int);
void InitAnimation(void);
void StopAnimation(void);
FreeAllImageTextures();
+ for (i = IMG_GLOBAL_BORDER_FIRST; i <= IMG_GLOBAL_BORDER_LAST; i++)
+ CreateImageTextures(i);
+
for (i = 0; i < MAX_NUM_TOONS; i++)
CreateImageTextures(IMG_TOON_1 + i);
InitGfxDrawBusyAnimFunction(DrawInitAnim);
InitGfxDrawGlobalAnimFunction(DrawGlobalAnim);
+ InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToScreen);
/* use copy of busy animation to prevent change while reloading artwork */
init_last = init;
BlitBitmap(backbuffer, gfx.final_screen_bitmap, 0, 0,
gfx.win_xsize, gfx.win_ysize, 0, 0);
- // copy global animations to render target buffer, if defined
+ // copy global animations to render target buffer, if defined (below border)
if (gfx.draw_global_anim_function != NULL)
- gfx.draw_global_anim_function();
+ gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_1);
+
+ // copy global masked border to render target buffer, if defined
+ if (gfx.draw_global_border_function != NULL)
+ gfx.draw_global_border_function(REDRAW_ALL);
+
+ // copy global animations to render target buffer, if defined (above border)
+ if (gfx.draw_global_anim_function != NULL)
+ gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_2);
screen = gfx.final_screen_bitmap->surface;
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
#if !USE_FINAL_SCREEN_BITMAP
- // copy global animations to render target buffer, if defined
+ // copy global animations to render target buffer, if defined (below border)
if (gfx.draw_global_anim_function != NULL)
- gfx.draw_global_anim_function();
+ gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_1);
+
+ // copy global masked border to render target buffer, if defined
+ if (gfx.draw_global_border_function != NULL)
+ gfx.draw_global_border_function(REDRAW_ALL);
+
+ // copy global animations to render target buffer, if defined (above border)
+ if (gfx.draw_global_anim_function != NULL)
+ gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_2);
#endif
// show render target buffer on screen
int dst_x = x, dst_y = y;
unsigned int time_last, time_current;
+ // store function for drawing global masked border
+ void (*draw_global_border_function)(int) = gfx.draw_global_border_function;
+
+ // deactivate drawing of global border while fading, if needed
+ if (draw_border_function == NULL)
+ gfx.draw_global_border_function = NULL;
+
/* check if screen size has changed */
if (surface_source != NULL && (video.width != surface_source->w ||
video.height != surface_source->h))
time_current = SDL_GetTicks();
}
}
+
+ // restore function for drawing global masked border
+ gfx.draw_global_border_function = draw_global_border_function;
}
void SDLDrawSimpleLine(Bitmap *dst_bitmap, int from_x, int from_y,
gfx.draw_busy_anim_function = draw_busy_anim_function;
}
-void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(void))
+void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int))
{
gfx.draw_global_anim_function = draw_global_anim_function;
}
+void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int))
+{
+ gfx.draw_global_border_function = draw_global_border_function;
+}
+
void InitGfxCustomArtworkInfo()
{
gfx.override_level_graphics = FALSE;
/* values for special "focus player" bitmasks */
#define BIT_SET_FOCUS 6
+/* values for drawing stages for global animations */
+#define DRAW_GLOBAL_ANIM_STAGE_1 1
+#define DRAW_GLOBAL_ANIM_STAGE_2 2
+
/* values for move directions and special "button" key bitmasks */
#define MV_NONE 0
#define MV_LEFT (1 << MV_BIT_LEFT)
int anim_random_frame;
void (*draw_busy_anim_function)(void);
- void (*draw_global_anim_function)(void);
+ void (*draw_global_anim_function)(int);
+ void (*draw_global_border_function)(int);
int cursor_mode;
};
void InitGfxScrollbufferInfo(int, int);
void InitGfxClipRegion(boolean, int, int, int, int);
void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
-void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(void));
+void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(int));
+void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int));
void InitGfxCustomArtworkInfo();
void InitGfxOtherSettings();
void SetDrawDeactivationMask(int);
#define GLOBAL_ANIM_ID_PART_LAST 7
#define GLOBAL_ANIM_ID_PART_BASE 8
+/* values for global border graphics */
+#define IMG_GLOBAL_BORDER_FIRST IMG_GLOBAL_BORDER
+#define IMG_GLOBAL_BORDER_LAST IMG_GLOBAL_BORDER_PLAYING
+
/* values for game_status (must match special image configuration suffixes) */
#define GAME_MODE_DEFAULT 0
#define GAME_MODE_LOADING 1
gfx.sx, gfx.sy);
}
-void DrawMaskedBorder_Rect(int x, int y, int width, int height)
+static void DrawMaskedBorderExt_Rect(int x, int y, int width, int height,
+ boolean blit_to_screen)
{
Bitmap *bitmap = getGlobalBorderBitmapFromGameStatus();
- BlitBitmapMasked(bitmap, backbuffer, x, y, width, height, x, y);
+ if (blit_to_screen)
+ BlitToScreenMasked(bitmap, x, y, width, height, x, y);
+ else
+ BlitBitmapMasked(bitmap, backbuffer, x, y, width, height, x, y);
}
-void DrawMaskedBorder_FIELD()
+static void DrawMaskedBorderExt_FIELD(boolean blit_to_screen)
{
if (global.border_status >= GAME_MODE_TITLE &&
global.border_status <= GAME_MODE_PLAYING &&
border.draw_masked[global.border_status])
- DrawMaskedBorder_Rect(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ DrawMaskedBorderExt_Rect(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
+ blit_to_screen);
}
-void DrawMaskedBorder_DOOR_1()
+static void DrawMaskedBorderExt_DOOR_1(boolean blit_to_screen)
{
+ // only draw border over closed doors when drawing to backbuffer
+ if (!blit_to_screen && (GetDoorState() & DOOR_OPEN_1))
+ return;
+
if (border.draw_masked[GFX_SPECIAL_ARG_DOOR] &&
(global.border_status != GAME_MODE_EDITOR ||
border.draw_masked[GFX_SPECIAL_ARG_EDITOR]))
- DrawMaskedBorder_Rect(DX, DY, DXSIZE, DYSIZE);
+ DrawMaskedBorderExt_Rect(DX, DY, DXSIZE, DYSIZE, blit_to_screen);
}
-void DrawMaskedBorder_DOOR_2()
+static void DrawMaskedBorderExt_DOOR_2(boolean blit_to_screen)
{
+ // only draw border over closed doors when drawing to backbuffer
+ if (!blit_to_screen && (GetDoorState() & DOOR_OPEN_2))
+ return;
+
if (border.draw_masked[GFX_SPECIAL_ARG_DOOR] &&
global.border_status != GAME_MODE_EDITOR)
- DrawMaskedBorder_Rect(VX, VY, VXSIZE, VYSIZE);
+ DrawMaskedBorderExt_Rect(VX, VY, VXSIZE, VYSIZE, blit_to_screen);
}
-void DrawMaskedBorder_DOOR_3()
+static void DrawMaskedBorderExt_DOOR_3(boolean blit_to_screen)
{
/* currently not available */
}
-void DrawMaskedBorder_ALL()
+static void DrawMaskedBorderExt_ALL(boolean blit_to_screen)
{
- DrawMaskedBorder_FIELD();
- DrawMaskedBorder_DOOR_1();
- DrawMaskedBorder_DOOR_2();
- DrawMaskedBorder_DOOR_3();
+ DrawMaskedBorderExt_FIELD(blit_to_screen);
+ DrawMaskedBorderExt_DOOR_1(blit_to_screen);
+ DrawMaskedBorderExt_DOOR_2(blit_to_screen);
+ DrawMaskedBorderExt_DOOR_3(blit_to_screen);
}
-void DrawMaskedBorder(int redraw_mask)
+static void DrawMaskedBorderExt(int redraw_mask, boolean blit_to_screen)
{
/* never draw masked screen borders on borderless screens */
if (game_status == GAME_MODE_LOADING ||
return;
if (redraw_mask & REDRAW_ALL)
- DrawMaskedBorder_ALL();
+ DrawMaskedBorderExt_ALL(blit_to_screen);
else
{
if (redraw_mask & REDRAW_FIELD)
- DrawMaskedBorder_FIELD();
+ DrawMaskedBorderExt_FIELD(blit_to_screen);
if (redraw_mask & REDRAW_DOOR_1)
- DrawMaskedBorder_DOOR_1();
+ DrawMaskedBorderExt_DOOR_1(blit_to_screen);
if (redraw_mask & REDRAW_DOOR_2)
- DrawMaskedBorder_DOOR_2();
+ DrawMaskedBorderExt_DOOR_2(blit_to_screen);
if (redraw_mask & REDRAW_DOOR_3)
- DrawMaskedBorder_DOOR_3();
+ DrawMaskedBorderExt_DOOR_3(blit_to_screen);
}
}
+void DrawMaskedBorder_FIELD()
+{
+ DrawMaskedBorderExt_FIELD(FALSE);
+}
+
+void DrawMaskedBorder(int redraw_mask)
+{
+ DrawMaskedBorderExt(redraw_mask, FALSE);
+}
+
+void DrawMaskedBorderToScreen(int redraw_mask)
+{
+ DrawMaskedBorderExt(redraw_mask, TRUE);
+}
+
void BlitScreenToBitmap_RND(Bitmap *target_bitmap)
{
int fx = FX, fy = FY;
if (redraw_mask == REDRAW_NONE)
return;
+#if 1
+ // masked border now drawn immediately when blitting backbuffer to window
+#else
// draw masked border to all viewports, if defined
DrawMaskedBorder(redraw_mask);
+#endif
// draw frames per second (only if debug mode is enabled)
if (redraw_mask & REDRAW_FPS)
void FadeIn(int fade_mask)
{
+#if 1
+ DrawMaskedBorder(REDRAW_ALL);
+#endif
+
if (fading.fade_mode & FADE_TYPE_TRANSFORM)
FadeExt(fade_mask, fading.fade_mode, FADE_TYPE_FADE_IN);
else
void FadeOut(int fade_mask)
{
+#if 0
+ DrawMaskedBorder(REDRAW_ALL);
+#endif
+
if (fading.fade_mode & FADE_TYPE_TRANSFORM)
FadeExt(fade_mask, fading.fade_mode, FADE_TYPE_FADE_OUT);
else
if (door_state & DOOR_ACTION_2)
door2 = door_state & DOOR_ACTION_2;
+ // draw masked border over door area
+ DrawMaskedBorder(REDRAW_DOOR_1);
+ DrawMaskedBorder(REDRAW_DOOR_2);
+
return (door1 | door2);
}
void DrawMaskedBorder_DOOR_3();
void DrawMaskedBorder_ALL();
void DrawMaskedBorder(int);
+void DrawMaskedBorderToScreen(int);
void SetDrawtoField(int);
void RedrawPlayfield();