X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=9e6ecbd9ef590fd16e8cd8eda37802a8a1bd645c;hb=12a8eb6ca28aa97f422e7cf9317f01eb0dfc9a11;hp=8b9d1132f23e7588ac0c6bb68ebabf0bc4ed58d2;hpb=2486a7a849210371bb59e733e37b0271a4332d8b;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 8b9d1132..9e6ecbd9 100644 --- a/src/game.c +++ b/src/game.c @@ -4338,10 +4338,10 @@ void InitGame() SBY_Upper--; #endif - /* +#if 0 printf("::: START-3: %d, %d\n", SBX_Left, SBX_Right); printf("\n"); - */ +#endif #else @@ -4507,15 +4507,19 @@ void InitGame() { InitGameEngine_EM(); +#if 0 /* blit playfield from scroll buffer to normal back buffer for fading in */ BlitScreenToBitmap_EM(backbuffer); +#endif } else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) { InitGameEngine_SP(); +#if 0 /* blit playfield from scroll buffer to normal back buffer for fading in */ BlitScreenToBitmap_SP(backbuffer); +#endif } else { @@ -4526,16 +4530,26 @@ void InitGame() if (game.timegate_time_left == 0) CloseAllOpenTimegates(); +#if 0 + /* blit playfield from scroll buffer to normal back buffer for fading in */ #if NEW_TILESIZE BlitScreenToBitmap(backbuffer); #else - /* blit playfield from scroll buffer to normal back buffer for fading in */ if (setup.soft_scrolling) BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); #endif +#endif +#if 0 redraw_mask |= REDRAW_FROM_BACKBUFFER; +#endif } +#if 1 + /* blit playfield from scroll buffer to normal back buffer for fading in */ + BlitScreenToBitmap(backbuffer); + + redraw_mask |= REDRAW_FROM_BACKBUFFER; +#endif /* !!! FIX THIS (END) !!! */ #if 1 @@ -16728,6 +16742,14 @@ static void LoadEngineSnapshotValues_RND() } } +void FreeEngineSnapshot() +{ + FreeEngineSnapshotBuffers(); + + setString(&snapshot_level_identifier, NULL); + snapshot_level_nr = -1; +} + void SaveEngineSnapshot() { /* do not save snapshots from editor */ @@ -16737,6 +16759,25 @@ void SaveEngineSnapshot() /* 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(); @@ -16748,6 +16789,7 @@ void SaveEngineSnapshot() 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 */ @@ -16843,9 +16885,40 @@ void LoadEngineSnapshot() /* 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()