-void DrawGameValue_Keys(int key[MAX_NUM_KEYS])
-{
-#if 0
- struct TextPosInfo *pos = &game.panel.keys;
-#endif
-#if 0
- int base_key_graphic = EL_KEY_1;
-#endif
- int i;
-
-#if 1
- return; /* !!! USE NEW STUFF !!! */
-#endif
-
-#if 0
- if (PANEL_DEACTIVATED(pos))
- return;
-#endif
-
-#if 0
- if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
- base_key_graphic = EL_EM_KEY_1;
-#endif
-
-#if 0
- pos->width = 4 * MINI_TILEX;
-#endif
-
-#if 1
- for (i = 0; i < MAX_NUM_KEYS; i++)
-#else
- /* currently only 4 of 8 possible keys are displayed */
- for (i = 0; i < STD_NUM_KEYS; i++)
-#endif
- {
-#if 1
- struct TextPosInfo *pos = &game.panel.key[i];
-#endif
- int src_x = DOOR_GFX_PAGEX5 + 18 + (i % 4) * MINI_TILEX;
- int src_y = DOOR_GFX_PAGEY1 + 123;
-#if 1
- int dst_x = PANEL_XPOS(pos);
- int dst_y = PANEL_YPOS(pos);
-#else
- int dst_x = PANEL_XPOS(pos) + i * MINI_TILEX;
- int dst_y = PANEL_YPOS(pos);
-#endif
-
-#if 1
- int element = (i >= STD_NUM_KEYS ? EL_EMC_KEY_5 - 4 :
- level.game_engine_type == GAME_ENGINE_TYPE_EM ? EL_EM_KEY_1 :
- EL_KEY_1) + i;
- int graphic = el2edimg(element);
-#endif
-
-#if 1
- if (PANEL_DEACTIVATED(pos))
- continue;
-#endif
-
-#if 0
- /* masked blit with tiles from half-size scaled bitmap does not work yet
- (no mask bitmap created for these sizes after loading and scaling) --
- solution: load without creating mask, scale, then create final mask */
-
- BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y,
- MINI_TILEX, MINI_TILEY, dst_x, dst_y);
-
- if (key[i])
- {
-#if 0
- int graphic = el2edimg(base_key_graphic + i);
-#endif
- Bitmap *src_bitmap;
- int src_x, src_y;
-
- getMiniGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
-
- SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
- dst_x - src_x, dst_y - src_y);
- BlitBitmapMasked(src_bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY,
- dst_x, dst_y);
- }
-#else
-#if 1
- if (key[i])
- DrawMiniGraphicExt(drawto, dst_x, dst_y, graphic);
- else
- BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y,
- MINI_TILEX, MINI_TILEY, dst_x, dst_y);
-#else
- if (key[i])
- DrawMiniGraphicExt(drawto, dst_x, dst_y, el2edimg(base_key_graphic + i));
- else
- BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y,
- MINI_TILEX, MINI_TILEY, dst_x, dst_y);
-#endif
-#endif
- }
-}
-
-#else
-
-void DrawGameValue_Emeralds(int value)
-{
- int font_nr = FONT_TEXT_2;
- int xpos = (3 * 14 - 3 * getFontWidth(font_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.gems))
- return;
-
- DrawText(DX_EMERALDS + xpos, DY_EMERALDS, int2str(value, 3), font_nr);
-}
-
-void DrawGameValue_Dynamite(int value)
-{
- int font_nr = FONT_TEXT_2;
- int xpos = (3 * 14 - 3 * getFontWidth(font_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.inventory_count))
- return;
-
- DrawText(DX_DYNAMITE + xpos, DY_DYNAMITE, int2str(value, 3), font_nr);
-}
-
-void DrawGameValue_Score(int value)
-{
- int font_nr = FONT_TEXT_2;
- int xpos = (5 * 14 - 5 * getFontWidth(font_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.score))
- return;
-
- DrawText(DX_SCORE + xpos, DY_SCORE, int2str(value, 5), font_nr);
-}
-
-void DrawGameValue_Time(int value)
-{
- int font1_nr = FONT_TEXT_2;
-#if 1
- int font2_nr = FONT_TEXT_1;
-#else
- int font2_nr = FONT_LEVEL_NUMBER;
-#endif
- int xpos3 = (3 * 14 - 3 * getFontWidth(font1_nr)) / 2;
- int xpos4 = (4 * 10 - 4 * getFontWidth(font2_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.time))
- return;
-
- /* clear background if value just changed its size */
- if (value == 999 || value == 1000)
- ClearRectangleOnBackground(drawto, DX_TIME1, DY_TIME, 14 * 3, 14);
-
- if (value < 1000)
- DrawText(DX_TIME1 + xpos3, DY_TIME, int2str(value, 3), font1_nr);
- else
- DrawText(DX_TIME2 + xpos4, DY_TIME, int2str(value, 4), font2_nr);
-}
-
-void DrawGameValue_Level(int value)
-{
- int font1_nr = FONT_TEXT_2;
-#if 1
- int font2_nr = FONT_TEXT_1;
-#else
- int font2_nr = FONT_LEVEL_NUMBER;
-#endif
-
- if (PANEL_DEACTIVATED(game.panel.level))
- return;
-
- if (level_nr < 100)
- DrawText(DX_LEVEL1, DY_LEVEL, int2str(value, 2), font1_nr);
- else
- DrawText(DX_LEVEL2, DY_LEVEL, int2str(value, 3), font2_nr);
-}
-
-void DrawGameValue_Keys(int key[MAX_NUM_KEYS])
-{
- int base_key_graphic = EL_KEY_1;
- int i;
-
- if (PANEL_DEACTIVATED(game.panel.keys))
- return;
-
- if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
- base_key_graphic = EL_EM_KEY_1;
-
- /* currently only 4 of 8 possible keys are displayed */
- for (i = 0; i < STD_NUM_KEYS; i++)
- {
- int x = XX_KEYS + i * MINI_TILEX;
- int y = YY_KEYS;
-
- if (key[i])
- DrawMiniGraphicExt(drawto, DX + x,DY + y, el2edimg(base_key_graphic + i));
- else
- BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
- DOOR_GFX_PAGEX5 + x, y, MINI_TILEX, MINI_TILEY, DX + x,DY + y);
- }
-}
-
-#endif
-
-void DrawAllGameValues(int emeralds, int dynamite, int score, int time,
- int key_bits)
-{
- int key[MAX_NUM_KEYS];
- int i;
-
- /* prevent EM engine from updating time/score values parallel to GameWon() */
- if (level.game_engine_type == GAME_ENGINE_TYPE_EM &&
- local_player->LevelSolved)
- return;
-
- for (i = 0; i < MAX_NUM_KEYS; i++)
- key[i] = key_bits & (1 << i);
-
- DrawGameValue_Level(level_nr);
-
- DrawGameValue_Emeralds(emeralds);
- DrawGameValue_Dynamite(dynamite);
- DrawGameValue_Score(score);
- DrawGameValue_Time(time);
-
- DrawGameValue_Keys(key);
-}
-
-void UpdateGameDoorValues()
-{
- UpdateGameControlValues();
-}
-
-void DrawGameDoorValues()
-{
- DisplayGameControlValues();
-}
-
-void DrawGameDoorValues_OLD()
-{
- int time_value = (level.time == 0 ? TimePlayed : TimeLeft);
- int dynamite_value = 0;
- int score_value = (local_player->LevelSolved ? local_player->score_final :
- local_player->score);
- int gems_value = local_player->gems_still_needed;
- int key_bits = 0;
- int i, j;
-
- if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
- {
- DrawGameDoorValues_EM();
-
- return;
- }
-
- if (game.centered_player_nr == -1)
- {
- for (i = 0; i < MAX_PLAYERS; i++)
- {
- for (j = 0; j < MAX_NUM_KEYS; j++)
- if (stored_player[i].key[j])
- key_bits |= (1 << j);
-
- dynamite_value += stored_player[i].inventory_size;
- }
- }
- else
- {
- int player_nr = game.centered_player_nr;
-
- for (i = 0; i < MAX_NUM_KEYS; i++)
- if (stored_player[player_nr].key[i])
- key_bits |= (1 << i);
-
- dynamite_value = stored_player[player_nr].inventory_size;
- }
-
- DrawAllGameValues(gems_value, dynamite_value, score_value, time_value,
- key_bits);
-}
-
-
-/*
- =============================================================================
- InitGameEngine()
- -----------------------------------------------------------------------------
- initialize game engine due to level / tape version number
- =============================================================================
-*/
-
-static void InitGameEngine()
-{
- int i, j, k, l, x, y;
-
- /* set game engine from tape file when re-playing, else from level file */
- game.engine_version = (tape.playing ? tape.engine_version :
- level.game_version);
-
- /* ---------------------------------------------------------------------- */
- /* set flags for bugs and changes according to active game engine version */
- /* ---------------------------------------------------------------------- */
-
- /*
- Summary of bugfix/change:
- Fixed handling for custom elements that change when pushed by the player.
-
- Fixed/changed in version:
- 3.1.0
-
- Description:
- Before 3.1.0, custom elements that "change when pushing" changed directly
- after the player started pushing them (until then handled in "DigField()").
- Since 3.1.0, these custom elements are not changed until the "pushing"
- move of the element is finished (now handled in "ContinueMoving()").
-
- Affected levels/tapes:
- The first condition is generally needed for all levels/tapes before version
- 3.1.0, which might use the old behaviour before it was changed; known tapes
- that are affected are some tapes from the level set "Walpurgis Gardens" by
- Jamie Cullen.
- The second condition is an exception from the above case and is needed for
- the special case of tapes recorded with game (not engine!) version 3.1.0 or
- above (including some development versions of 3.1.0), but before it was
- known that this change would break tapes like the above and was fixed in
- 3.1.1, so that the changed behaviour was active although the engine version
- while recording maybe was before 3.1.0. There is at least one tape that is
- affected by this exception, which is the tape for the one-level set "Bug
- Machine" by Juergen Bonhagen.
- */
-
- game.use_change_when_pushing_bug =
- (game.engine_version < VERSION_IDENT(3,1,0,0) &&
- !(tape.playing &&
- tape.game_version >= VERSION_IDENT(3,1,0,0) &&
- tape.game_version < VERSION_IDENT(3,1,1,0)));
-
- /*
- Summary of bugfix/change:
- Fixed handling for blocking the field the player leaves when moving.
-
- Fixed/changed in version:
- 3.1.1
-
- Description:
- Before 3.1.1, when "block last field when moving" was enabled, the field
- the player is leaving when moving was blocked for the time of the move,
- and was directly unblocked afterwards. This resulted in the last field
- being blocked for exactly one less than the number of frames of one player
- move. Additionally, even when blocking was disabled, the last field was
- blocked for exactly one frame.
- Since 3.1.1, due to changes in player movement handling, the last field
- is not blocked at all when blocking is disabled. When blocking is enabled,
- the last field is blocked for exactly the number of frames of one player
- move. Additionally, if the player is Murphy, the hero of Supaplex, the
- last field is blocked for exactly one more than the number of frames of
- one player move.
-
- Affected levels/tapes:
- (!!! yet to be determined -- probably many !!!)
- */