X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame.c;h=28905e562b1ef07e942ca56e23be27b128cfade2;hp=8b9d1132f23e7588ac0c6bb68ebabf0bc4ed58d2;hb=abe44529b439ad39b4d8dbf19cbd67c9b9844279;hpb=2486a7a849210371bb59e733e37b0271a4332d8b diff --git a/src/game.c b/src/game.c index 8b9d1132..28905e56 100644 --- a/src/game.c +++ b/src/game.c @@ -1,15 +1,13 @@ -/*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * -*----------------------------------------------------------* -* (c) 1995-2006 Artsoft Entertainment * -* Holger Schemel * -* Detmolder Strasse 189 * -* 33604 Bielefeld * -* Germany * -* e-mail: info@artsoft.org * -*----------------------------------------------------------* -* game.c * -***********************************************************/ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2014 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// http://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// game.c +// ============================================================================ #include "libgame/libgame.h" @@ -4338,10 +4336,10 @@ void InitGame() SBY_Upper--; #endif - /* +#if 0 printf("::: START-3: %d, %d\n", SBX_Left, SBX_Right); printf("\n"); - */ +#endif #else @@ -4507,35 +4505,49 @@ 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 { - DrawLevel(); + DrawLevel(REDRAW_FIELD); DrawAllPlayers(); /* after drawing the level, correct some elements */ 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 +16740,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 +16757,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 +16787,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 +16883,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() @@ -17005,6 +17076,9 @@ void RedrawGameButtons() for (i = 0; i < NUM_GAME_BUTTONS; i++) RedrawGadget(game_gadget[i]); + + // RedrawGadget() may have set REDRAW_ALL if buttons are defined off-area + redraw_mask &= ~REDRAW_ALL; } static void HandleGameButtonsExt(int id)