SBY_Upper--;
#endif
- /*
+#if 0
printf("::: START-3: %d, %d\n", SBX_Left, SBX_Right);
printf("\n");
- */
+#endif
#else
}
}
+void FreeEngineSnapshot()
+{
+ FreeEngineSnapshotBuffers();
+
+ setString(&snapshot_level_identifier, NULL);
+ snapshot_level_nr = -1;
+}
+
void SaveEngineSnapshot()
{
/* do not save snapshots from editor */
/* free previous snapshot buffers, if needed */
FreeEngineSnapshotBuffers();
+#if 1
+ /* copy some special values to a structure better suited for the snapshot */
+
+ if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
+ SaveEngineSnapshotValues_RND();
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ SaveEngineSnapshotValues_EM();
+ if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ SaveEngineSnapshotValues_SP();
+
+ /* save values stored in special snapshot structure */
+
+ if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
+ SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_rnd));
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_em));
+ if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_sp));
+#else
/* copy some special values to a structure better suited for the snapshot */
SaveEngineSnapshotValues_RND();
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_rnd));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_em));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_sp));
+#endif
/* save further RND engine values */
/* restore special values from snapshot structure */
+#if 1
+ if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
+ LoadEngineSnapshotValues_RND();
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ LoadEngineSnapshotValues_EM();
+ if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ LoadEngineSnapshotValues_SP();
+#else
LoadEngineSnapshotValues_RND();
LoadEngineSnapshotValues_EM();
LoadEngineSnapshotValues_SP();
+#endif
+
+#if 0
+ printf("::: %d, %d (LoadEngineSnapshot / 1)\n", scroll_x, scroll_y);
+#endif
+
+#if 0
+ // needed if tile size was different when saving and loading engine snapshot
+ if (local_player->present)
+ {
+ scroll_x = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left :
+ local_player->jx > SBX_Right + MIDPOSX ? SBX_Right :
+ local_player->jx - MIDPOSX);
+
+ scroll_y = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
+ local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
+ local_player->jy - MIDPOSY);
+ }
+#endif
+
+#if 0
+ printf("::: %d, %d (LoadEngineSnapshot / 1)\n", scroll_x, scroll_y);
+#endif
}
boolean CheckEngineSnapshot()
}
}
+#if 1
+
+void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height)
+{
+ if (game_status == GAME_MODE_PLAYING &&
+ level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ {
+ /* currently there is no partial redraw -- always redraw whole playfield */
+ RedrawPlayfield_EM(TRUE);
+
+ /* blit playfield from scroll buffer to normal back buffer for fading in */
+ BlitScreenToBitmap_EM(backbuffer);
+ }
+ else if (game_status == GAME_MODE_PLAYING &&
+ level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ {
+ /* currently there is no partial redraw -- always redraw whole playfield */
+ RedrawPlayfield_SP(TRUE);
+
+ /* blit playfield from scroll buffer to normal back buffer for fading in */
+ BlitScreenToBitmap_SP(backbuffer);
+ }
+ else if (game_status == GAME_MODE_PLAYING &&
+ !game.envelope_active)
+ {
+#if 0
+ DrawLevel();
+#else
+
+ SetMainBackgroundImage(IMG_BACKGROUND_PLAYING);
+ // SetDrawBackgroundMask(REDRAW_FIELD); // !!! CHECK THIS !!!
+
+ for (x = BX1; x <= BX2; x++)
+ for (y = BY1; y <= BY2; y++)
+ DrawScreenField(x, y);
+
+ redraw_mask |= REDRAW_FIELD;
+#endif
+ DrawAllPlayers();
+
+#if NEW_TILESIZE
+ BlitScreenToBitmap(backbuffer);
+#else
+ /* blit playfield from scroll buffer to normal back buffer */
+ if (setup.soft_scrolling)
+ {
+ int fx = FX, fy = FY;
+
+ fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
+ fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
+
+ BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY);
+ }
+#endif
+ }
+
+ BlitBitmap(drawto, window, gfx.sx, gfx.sy, gfx.sxsize, gfx.sysize,
+ gfx.sx, gfx.sy);
+}
+
+#else
+
void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height)
{
if (game_status == GAME_MODE_PLAYING &&
BlitBitmap(drawto, window, x, y, width, height, x, y);
}
+#endif
+
void DrawMaskedBorder_Rect(int x, int y, int width, int height)
{
Bitmap *bitmap = graphic_info[IMG_GLOBAL_BORDER].bitmap;
#if 1
if (game_status == GAME_MODE_PLAYING)
{
+#if 1
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ BlitScreenToBitmap_EM(backbuffer);
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ BlitScreenToBitmap_SP(backbuffer);
+ else
+ BlitScreenToBitmap(backbuffer);
+#else
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
BlitScreenToBitmap_EM(backbuffer);
else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
{
BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
}
+#endif
}
SetDrawtoField(DRAW_BACKBUFFER);
if (game_status == GAME_MODE_PLAYING)
{
+#if 1
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
BlitScreenToBitmap_EM(backbuffer);
else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
BlitScreenToBitmap_SP(backbuffer);
+ else
+ BlitScreenToBitmap(backbuffer);
+#else
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ BlitScreenToBitmap_EM(backbuffer);
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ BlitScreenToBitmap_SP(backbuffer);
+#endif
}
/* disable deactivated drawing when quick-loading level tape recording */
#endif
)
{
+#if 1
+ // changing tile size invalidates scroll values of engine snapshots
+ if (new_tilesize_var != TILESIZE_VAR)
+ {
+ // printf("::: new_tilesize_var != TILESIZE_VAR\n");
+
+ FreeEngineSnapshot();
+ }
+#endif
+
SX = new_sx;
SY = new_sy;
DX = new_dx;