X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=4b4a44cfee1868d6113e12a2b17c9f947db8499d;hb=0838017832a108ba365ea0efb851fc8c4d5f3aa5;hp=840f476f3fc63d837b76f8417baaa899d5b6ec62;hpb=a14c03ea017046106c3e37e3c59910edcd0a1d73;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 840f476f..4b4a44cf 100644 --- a/src/game.c +++ b/src/game.c @@ -87,16 +87,10 @@ #define EX_TYPE_DYNA (1 << 4) #define EX_TYPE_SINGLE_TILE (EX_TYPE_CENTER | EX_TYPE_BORDER) -#if 1 #define PANEL_OFF() (local_player->LevelSolved_PanelOff) #define PANEL_DEACTIVATED(p) ((p)->x < 0 || (p)->y < 0 || PANEL_OFF()) -#define PANEL_XPOS(p) (DX + ALIGNED_MENU_XPOS(p)) -#define PANEL_YPOS(p) (DY + ALIGNED_MENU_YPOS(p)) -#else -#define PANEL_DEACTIVATED(p) ((p).x < 0 || (p).y < 0) -#define PANEL_XPOS(p) (ALIGNED_XPOS((p).x, (p).width, (p).align)) -#define PANEL_YPOS(p) ((p).y) -#endif +#define PANEL_XPOS(p) (DX + ALIGNED_TEXT_XPOS(p)) +#define PANEL_YPOS(p) (DY + ALIGNED_TEXT_YPOS(p)) /* special positions in the game control window (relative to control window) */ #define XX_LEVEL1 (PANEL_XPOS(game.panel.level)) @@ -134,237 +128,450 @@ #define DX_TIME (DX + XX_TIME) #define DY_TIME (DY + YY_TIME) -#if 0 +#if 1 /* game panel display and control definitions */ -#define GAME_CONTROL_LEVEL 0 +#define GAME_CONTROL_LEVEL_NUMBER 0 #define GAME_CONTROL_GEMS 1 #define GAME_CONTROL_INVENTORY 2 -#define GAME_CONTROL_KEYS 3 -#define GAME_CONTROL_SCORE 4 -#define GAME_CONTROL_TIME 5 - - - -#define GAME_CONTROL_LEVELS 1 -#define GAME_CONTROL_SCORES 2 -#define GAME_CONTROL_EDITOR 3 -#define GAME_CONTROL_INFO 4 -#define GAME_CONTROL_GAME 5 -#define GAME_CONTROL_SETUP 6 -#define GAME_CONTROL_QUIT 7 -#define GAME_CONTROL_PREV_LEVEL 8 -#define GAME_CONTROL_NEXT_LEVEL 9 -#define GAME_CONTROL_CURRENT_LEVEL 10 -#define GAME_CONTROL_FIRST_LEVEL 11 -#define GAME_CONTROL_LAST_LEVEL 12 -#define GAME_CONTROL_LEVEL_INFO_1 13 -#define GAME_CONTROL_LEVEL_INFO_2 14 -#define GAME_CONTROL_LEVEL_NAME 15 -#define GAME_CONTROL_LEVEL_AUTHOR 16 -#define GAME_CONTROL_LEVEL_YEAR 17 -#define GAME_CONTROL_LEVEL_IMPORTED_FROM 18 -#define GAME_CONTROL_LEVEL_IMPORTED_BY 19 -#define GAME_CONTROL_LEVEL_TESTED_BY 20 -#define GAME_CONTROL_TITLE_1 21 -#define GAME_CONTROL_TITLE_2 22 -#define GAME_CONTROL_TITLE_3 23 - -static char str_game_text_name[10]; -static char str_game_text_current_level[10]; -static char str_game_text_first_level[10]; -static char str_game_text_last_level[10]; - -static char *game_text_name = str_game_text_name; -static char *game_text_current_level = str_game_text_current_level; -static char *game_text_first_level = str_game_text_first_level; -static char *game_text_last_level = str_game_text_last_level; -static char *game_text_levels = "Levelset"; -static char *game_text_scores = "Hall Of Fame"; -static char *game_text_editor = "Level Creator"; -static char *game_text_info = "Info Screen"; -static char *game_text_game = "Start Game"; -static char *game_text_setup = "Setup"; -static char *game_text_quit = "Quit"; -static char *game_text_level_name = level.name; -static char *game_text_level_author = level.author; -static char *game_text_level_year = NULL; -static char *game_text_level_imported_from = NULL; -static char *game_text_level_imported_by = NULL; -static char *game_text_level_tested_by = NULL; -static char *game_text_title_1 = PROGRAM_TITLE_STRING; -static char *game_text_title_2 = PROGRAM_COPYRIGHT_STRING; -static char *game_text_title_3 = PROGRAM_GAME_BY_STRING; +#define GAME_CONTROL_KEY_1 3 +#define GAME_CONTROL_KEY_2 4 +#define GAME_CONTROL_KEY_3 5 +#define GAME_CONTROL_KEY_4 6 +#define GAME_CONTROL_KEY_5 7 +#define GAME_CONTROL_KEY_6 8 +#define GAME_CONTROL_KEY_7 9 +#define GAME_CONTROL_KEY_8 10 +#define GAME_CONTROL_KEY_WHITE 11 +#define GAME_CONTROL_KEY_WHITE_COUNT 12 +#define GAME_CONTROL_SCORE 13 +#define GAME_CONTROL_TIME 14 +#define GAME_CONTROL_TIME_HH 15 +#define GAME_CONTROL_TIME_MM 16 +#define GAME_CONTROL_TIME_SS 17 +#define GAME_CONTROL_DROP_NEXT_1 18 +#define GAME_CONTROL_DROP_NEXT_2 19 +#define GAME_CONTROL_DROP_NEXT_3 20 +#define GAME_CONTROL_DROP_NEXT_4 21 +#define GAME_CONTROL_DROP_NEXT_5 22 +#define GAME_CONTROL_DROP_NEXT_6 23 +#define GAME_CONTROL_DROP_NEXT_7 24 +#define GAME_CONTROL_DROP_NEXT_8 25 +#define GAME_CONTROL_SHIELD_NORMAL 26 +#define GAME_CONTROL_SHIELD_NORMAL_TIME 27 +#define GAME_CONTROL_SHIELD_DEADLY 28 +#define GAME_CONTROL_SHIELD_DEADLY_TIME 29 +#define GAME_CONTROL_EXIT 30 +#define GAME_CONTROL_EM_EXIT 31 +#define GAME_CONTROL_SP_EXIT 32 +#define GAME_CONTROL_STEEL_EXIT 33 +#define GAME_CONTROL_EM_STEEL_EXIT 34 +#define GAME_CONTROL_EMC_MAGIC_BALL 35 +#define GAME_CONTROL_EMC_MAGIC_BALL_SWITCH 36 +#define GAME_CONTROL_EMC_MAGIC_BALL_TIME 37 +#define GAME_CONTROL_LIGHT_SWITCH 38 +#define GAME_CONTROL_LIGHT_SWITCH_TIME 39 +#define GAME_CONTROL_TIMEGATE_SWITCH 40 +#define GAME_CONTROL_TIMEGATE_SWITCH_TIME 41 +#define GAME_CONTROL_SWITCHGATE_SWITCH 42 +#define GAME_CONTROL_EMC_LENSES 43 +#define GAME_CONTROL_EMC_LENSES_TIME 44 +#define GAME_CONTROL_EMC_MAGNIFIER 45 +#define GAME_CONTROL_EMC_MAGNIFIER_TIME 46 +#define GAME_CONTROL_BALLOON_SWITCH 47 +#define GAME_CONTROL_DYNABOMB_NUMBER 48 +#define GAME_CONTROL_DYNABOMB_SIZE 49 +#define GAME_CONTROL_DYNABOMB_POWER 50 +#define GAME_CONTROL_PENGUINS 51 +#define GAME_CONTROL_SOKOBAN_OBJECTS 52 +#define GAME_CONTROL_SOKOBAN_FIELDS 53 +#define GAME_CONTROL_ROBOT_WHEEL 54 +#define GAME_CONTROL_CONVEYOR_BELT_1 55 +#define GAME_CONTROL_CONVEYOR_BELT_1_SWITCH 56 +#define GAME_CONTROL_CONVEYOR_BELT_2 57 +#define GAME_CONTROL_CONVEYOR_BELT_2_SWITCH 58 +#define GAME_CONTROL_CONVEYOR_BELT_3 59 +#define GAME_CONTROL_CONVEYOR_BELT_3_SWITCH 60 +#define GAME_CONTROL_CONVEYOR_BELT_4 61 +#define GAME_CONTROL_CONVEYOR_BELT_4_SWITCH 62 +#define GAME_CONTROL_MAGIC_WALL 63 +#define GAME_CONTROL_MAGIC_WALL_TIME 64 +#define GAME_CONTROL_BD_MAGIC_WALL 65 +#define GAME_CONTROL_DC_MAGIC_WALL 66 +#define GAME_CONTROL_PLAYER_NAME 67 +#define GAME_CONTROL_LEVEL_NAME 68 +#define GAME_CONTROL_LEVEL_AUTHOR 69 + +#define NUM_GAME_CONTROLS 70 + +int game_control_value[NUM_GAME_CONTROLS]; +int last_game_control_value[NUM_GAME_CONTROLS]; struct GameControlInfo { int nr; - struct MenuPosInfo *pos_button; - int button_graphic; - - struct TextPosInfo *pos_text; - char **text; - - struct TextPosInfo *pos_input; - char **input; + struct TextPosInfo *pos; + int type; }; static struct GameControlInfo game_controls[] = { { - GAME_CONTROL_NAME, - &menu.game.button.name, IMG_MENU_BUTTON, - &menu.game.text.name, &game_text_name, - &menu.game.input.name, &setup.player_name, + GAME_CONTROL_LEVEL_NUMBER, + &game.panel.level_number, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVELS, - &menu.game.button.levels, IMG_MENU_BUTTON_ENTER_MENU, - &menu.game.text.levels, &game_text_levels, - NULL, NULL, + GAME_CONTROL_GEMS, + &game.panel.gems, + TYPE_INTEGER, }, { - GAME_CONTROL_SCORES, - &menu.game.button.scores, IMG_MENU_BUTTON, - &menu.game.text.scores, &game_text_scores, - NULL, NULL, + GAME_CONTROL_INVENTORY, + &game.panel.inventory, + TYPE_INTEGER, }, { - GAME_CONTROL_EDITOR, - &menu.game.button.editor, IMG_MENU_BUTTON, - &menu.game.text.editor, &game_text_editor, - NULL, NULL, + GAME_CONTROL_KEY_1, + &game.panel.key[0], + TYPE_ELEMENT, }, { - GAME_CONTROL_INFO, - &menu.game.button.info, IMG_MENU_BUTTON_ENTER_MENU, - &menu.game.text.info, &game_text_info, - NULL, NULL, + GAME_CONTROL_KEY_2, + &game.panel.key[1], + TYPE_ELEMENT, }, { - GAME_CONTROL_GAME, - &menu.game.button.game, IMG_MENU_BUTTON, - &menu.game.text.game, &game_text_game, - NULL, NULL, + GAME_CONTROL_KEY_3, + &game.panel.key[2], + TYPE_ELEMENT, }, { - GAME_CONTROL_SETUP, - &menu.game.button.setup, IMG_MENU_BUTTON_ENTER_MENU, - &menu.game.text.setup, &game_text_setup, - NULL, NULL, + GAME_CONTROL_KEY_4, + &game.panel.key[3], + TYPE_ELEMENT, }, { - GAME_CONTROL_QUIT, - &menu.game.button.quit, IMG_MENU_BUTTON, - &menu.game.text.quit, &game_text_quit, - NULL, NULL, + GAME_CONTROL_KEY_5, + &game.panel.key[4], + TYPE_ELEMENT, }, -#if 0 - /* (these two buttons are real gadgets) */ { - GAME_CONTROL_PREV_LEVEL, - &menu.game.button.prev_level, IMG_MENU_BUTTON_PREV_LEVEL, - NULL, NULL, - NULL, NULL, + GAME_CONTROL_KEY_6, + &game.panel.key[5], + TYPE_ELEMENT, }, { - GAME_CONTROL_NEXT_LEVEL, - &menu.game.button.next_level, IMG_MENU_BUTTON_NEXT_LEVEL, - NULL, NULL, - NULL, NULL, + GAME_CONTROL_KEY_7, + &game.panel.key[6], + TYPE_ELEMENT, }, -#endif { - GAME_CONTROL_CURRENT_LEVEL, - NULL, -1, - &menu.game.text.current_level, &game_text_current_level, - NULL, NULL, + GAME_CONTROL_KEY_8, + &game.panel.key[7], + TYPE_ELEMENT, }, { - GAME_CONTROL_FIRST_LEVEL, - NULL, -1, - &menu.game.text.first_level, &game_text_first_level, - NULL, NULL, + GAME_CONTROL_KEY_WHITE, + &game.panel.key_white, + TYPE_ELEMENT, }, { - GAME_CONTROL_LAST_LEVEL, - NULL, -1, - &menu.game.text.last_level, &game_text_last_level, - NULL, NULL, + GAME_CONTROL_KEY_WHITE_COUNT, + &game.panel.key_white_count, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVEL_INFO_1, - NULL, -1, - &menu.game.text.level_info_1, NULL, - NULL, NULL, + GAME_CONTROL_SCORE, + &game.panel.score, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVEL_INFO_2, - NULL, -1, - &menu.game.text.level_info_2, NULL, - NULL, NULL, + GAME_CONTROL_TIME, + &game.panel.time, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVEL_NAME, - NULL, -1, - &menu.game.text.level_name, &game_text_level_name, - NULL, NULL, + GAME_CONTROL_TIME_HH, + &game.panel.time_hh, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVEL_AUTHOR, - NULL, -1, - &menu.game.text.level_author, &game_text_level_author, - NULL, NULL, + GAME_CONTROL_TIME_MM, + &game.panel.time_mm, + TYPE_INTEGER, + }, + { + GAME_CONTROL_TIME_SS, + &game.panel.time_ss, + TYPE_INTEGER, + }, + { + GAME_CONTROL_DROP_NEXT_1, + &game.panel.drop_next_1, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_2, + &game.panel.drop_next_2, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_3, + &game.panel.drop_next_3, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_4, + &game.panel.drop_next_4, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_5, + &game.panel.drop_next_5, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_6, + &game.panel.drop_next_6, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_7, + &game.panel.drop_next_7, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DROP_NEXT_8, + &game.panel.drop_next_8, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_SHIELD_NORMAL, + &game.panel.shield_normal, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_SHIELD_NORMAL_TIME, + &game.panel.shield_normal_time, + TYPE_INTEGER, + }, + { + GAME_CONTROL_SHIELD_DEADLY, + &game.panel.shield_deadly, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_SHIELD_DEADLY_TIME, + &game.panel.shield_deadly_time, + TYPE_INTEGER, + }, + { + GAME_CONTROL_EXIT, + &game.panel.exit, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_EM_EXIT, + &game.panel.em_exit, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_SP_EXIT, + &game.panel.sp_exit, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_STEEL_EXIT, + &game.panel.steel_exit, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_EM_STEEL_EXIT, + &game.panel.em_steel_exit, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_EMC_MAGIC_BALL, + &game.panel.emc_magic_ball, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_EMC_MAGIC_BALL_SWITCH, + &game.panel.emc_magic_ball_switch, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_EMC_MAGIC_BALL_TIME, + &game.panel.emc_magic_ball_time, + TYPE_INTEGER, + }, + { + GAME_CONTROL_LIGHT_SWITCH, + &game.panel.light_switch, + TYPE_ELEMENT, }, { - GAME_CONTROL_LEVEL_YEAR, - NULL, -1, - &menu.game.text.level_year, &game_text_level_year, - NULL, NULL, + GAME_CONTROL_LIGHT_SWITCH_TIME, + &game.panel.light_switch_time, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVEL_IMPORTED_FROM, - NULL, -1, - &menu.game.text.level_imported_from, &game_text_level_imported_from, - NULL, NULL, + GAME_CONTROL_TIMEGATE_SWITCH, + &game.panel.timegate_switch, + TYPE_ELEMENT, }, { - GAME_CONTROL_LEVEL_IMPORTED_BY, - NULL, -1, - &menu.game.text.level_imported_by, &game_text_level_imported_by, - NULL, NULL, + GAME_CONTROL_TIMEGATE_SWITCH_TIME, + &game.panel.timegate_switch_time, + TYPE_INTEGER, }, { - GAME_CONTROL_LEVEL_TESTED_BY, - NULL, -1, - &menu.game.text.level_tested_by, &game_text_level_tested_by, - NULL, NULL, + GAME_CONTROL_SWITCHGATE_SWITCH, + &game.panel.switchgate_switch, + TYPE_ELEMENT, }, { - GAME_CONTROL_TITLE_1, - NULL, -1, - &menu.game.text.title_1, &game_text_title_1, - NULL, NULL, + GAME_CONTROL_EMC_LENSES, + &game.panel.emc_lenses, + TYPE_ELEMENT, }, { - GAME_CONTROL_TITLE_2, - NULL, -1, - &menu.game.text.title_2, &game_text_title_2, - NULL, NULL, + GAME_CONTROL_EMC_LENSES_TIME, + &game.panel.emc_lenses_time, + TYPE_INTEGER, }, { - GAME_CONTROL_TITLE_3, - NULL, -1, - &menu.game.text.title_3, &game_text_title_3, - NULL, NULL, + GAME_CONTROL_EMC_MAGNIFIER, + &game.panel.emc_magnifier, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_EMC_MAGNIFIER_TIME, + &game.panel.emc_magnifier_time, + TYPE_INTEGER, + }, + { + GAME_CONTROL_BALLOON_SWITCH, + &game.panel.balloon_switch, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DYNABOMB_NUMBER, + &game.panel.dynabomb_number, + TYPE_INTEGER, + }, + { + GAME_CONTROL_DYNABOMB_SIZE, + &game.panel.dynabomb_size, + TYPE_INTEGER, + }, + { + GAME_CONTROL_DYNABOMB_POWER, + &game.panel.dynabomb_power, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_PENGUINS, + &game.panel.penguins, + TYPE_INTEGER, + }, + { + GAME_CONTROL_SOKOBAN_OBJECTS, + &game.panel.sokoban_objects, + TYPE_INTEGER, + }, + { + GAME_CONTROL_SOKOBAN_FIELDS, + &game.panel.sokoban_fields, + TYPE_INTEGER, + }, + { + GAME_CONTROL_ROBOT_WHEEL, + &game.panel.robot_wheel, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_1, + &game.panel.conveyor_belt_1, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_1_SWITCH, + &game.panel.conveyor_belt_1_switch, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_2, + &game.panel.conveyor_belt_2, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_2_SWITCH, + &game.panel.conveyor_belt_2_switch, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_3, + &game.panel.conveyor_belt_3, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_3_SWITCH, + &game.panel.conveyor_belt_3_switch, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_4, + &game.panel.conveyor_belt_4, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_CONVEYOR_BELT_4_SWITCH, + &game.panel.conveyor_belt_4_switch, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_MAGIC_WALL, + &game.panel.magic_wall, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_MAGIC_WALL_TIME, + &game.panel.magic_wall_time, + TYPE_INTEGER, + }, + { + GAME_CONTROL_BD_MAGIC_WALL, + &game.panel.bd_magic_wall, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_DC_MAGIC_WALL, + &game.panel.dc_magic_wall, + TYPE_ELEMENT, + }, + { + GAME_CONTROL_PLAYER_NAME, + &game.panel.player_name, + TYPE_STRING, + }, + { + GAME_CONTROL_LEVEL_NAME, + &game.panel.level_name, + TYPE_STRING, + }, + { + GAME_CONTROL_LEVEL_AUTHOR, + &game.panel.level_author, + TYPE_STRING, }, { -1, - NULL, -1, - NULL, NULL, - NULL, NULL, + NULL, + -1, } }; #endif @@ -1521,6 +1728,266 @@ static inline void InitField_WithBug2(int x, int y, boolean init_game) #if 1 +void InitGameControlValues() +{ + int i; + + for (i = 0; i < NUM_GAME_CONTROLS; i++) + game_control_value[i] = last_game_control_value[i] = -1; + + for (i = 0; game_controls[i].nr != -1; i++) + { + int nr = game_controls[i].nr; + int type = game_controls[i].type; + struct TextPosInfo *pos = game_controls[i].pos; + + game_control_value[nr] = last_game_control_value[nr] = -1; + + /* determine panel value width for later calculation of alignment */ + if (type == TYPE_INTEGER || type == TYPE_STRING) + pos->width = pos->chars * getFontWidth(pos->font); + } +} + +void UpdateGameControlValues() +{ + int i, j; + + game_control_value[GAME_CONTROL_LEVEL_NUMBER] = level_nr; + game_control_value[GAME_CONTROL_GEMS] = local_player->gems_still_needed; + + game_control_value[GAME_CONTROL_INVENTORY] = 0; + for (i = 0; i < MAX_NUM_KEYS; i++) + game_control_value[GAME_CONTROL_KEY_1 + i] = 0; + game_control_value[GAME_CONTROL_KEY_WHITE] = 0; + game_control_value[GAME_CONTROL_KEY_WHITE_COUNT] = 0; + + 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]) + game_control_value[GAME_CONTROL_KEY_1 + j] = 1; + + game_control_value[GAME_CONTROL_INVENTORY] += + stored_player[i].inventory_size; + + if (stored_player[i].num_white_keys > 0) + game_control_value[GAME_CONTROL_KEY_WHITE] = 1; + + game_control_value[GAME_CONTROL_KEY_WHITE_COUNT] += + stored_player[i].num_white_keys; + } + } + else + { + int player_nr = game.centered_player_nr; + + for (i = 0; i < MAX_NUM_KEYS; i++) + if (stored_player[player_nr].key[i]) + game_control_value[GAME_CONTROL_KEY_1 + i] = 1; + + game_control_value[GAME_CONTROL_INVENTORY] += + stored_player[player_nr].inventory_size; + + if (stored_player[player_nr].num_white_keys > 0) + game_control_value[GAME_CONTROL_KEY_WHITE] = 1; + + game_control_value[GAME_CONTROL_KEY_WHITE_COUNT] += + stored_player[player_nr].num_white_keys; + } + + game_control_value[GAME_CONTROL_SCORE] = (local_player->LevelSolved ? + local_player->score_final : + local_player->score); + + game_control_value[GAME_CONTROL_TIME] = (level.time == 0 ? + TimePlayed : + TimeLeft); + + game_control_value[GAME_CONTROL_TIME_HH] = TapeTime / 3600; + game_control_value[GAME_CONTROL_TIME_MM] = (TapeTime / 60) % 60; + game_control_value[GAME_CONTROL_TIME_SS] = TapeTime % 60; + + for (i = 0; i < 8; i++) + game_control_value[GAME_CONTROL_DROP_NEXT_1 + i] = 0; + + game_control_value[GAME_CONTROL_SHIELD_NORMAL] = + (local_player->shield_normal_time_left > 0 ? 1 : 0); + game_control_value[GAME_CONTROL_SHIELD_NORMAL_TIME] = + local_player->shield_normal_time_left; + game_control_value[GAME_CONTROL_SHIELD_DEADLY] = + (local_player->shield_deadly_time_left > 0 ? 1 : 0); + game_control_value[GAME_CONTROL_SHIELD_DEADLY_TIME] = + local_player->shield_deadly_time_left; + + game_control_value[GAME_CONTROL_EXIT] = 0; + game_control_value[GAME_CONTROL_EM_EXIT] = 0; + game_control_value[GAME_CONTROL_SP_EXIT] = 0; + game_control_value[GAME_CONTROL_STEEL_EXIT] = 0; + game_control_value[GAME_CONTROL_EM_STEEL_EXIT] = 0; + + game_control_value[GAME_CONTROL_EMC_MAGIC_BALL] = 0; + game_control_value[GAME_CONTROL_EMC_MAGIC_BALL_SWITCH] = 0; + game_control_value[GAME_CONTROL_EMC_MAGIC_BALL_TIME] = 0; + + game_control_value[GAME_CONTROL_LIGHT_SWITCH] = 0; + game_control_value[GAME_CONTROL_LIGHT_SWITCH_TIME] = game.light_time_left; + + game_control_value[GAME_CONTROL_TIMEGATE_SWITCH] = 0; + game_control_value[GAME_CONTROL_TIMEGATE_SWITCH_TIME] = + game.timegate_time_left; + + game_control_value[GAME_CONTROL_SWITCHGATE_SWITCH] = 0; + + game_control_value[GAME_CONTROL_EMC_LENSES] = 0; + game_control_value[GAME_CONTROL_EMC_LENSES_TIME] = game.lenses_time_left; + + game_control_value[GAME_CONTROL_EMC_MAGNIFIER] = 0; + game_control_value[GAME_CONTROL_EMC_MAGNIFIER_TIME] = game.magnify_time_left; + + game_control_value[GAME_CONTROL_BALLOON_SWITCH] = 0; + + game_control_value[GAME_CONTROL_DYNABOMB_NUMBER] = + local_player->dynabomb_count; + game_control_value[GAME_CONTROL_DYNABOMB_SIZE] = + local_player->dynabomb_size; + game_control_value[GAME_CONTROL_DYNABOMB_POWER] = + local_player->dynabomb_xl; + + game_control_value[GAME_CONTROL_PENGUINS] = + local_player->friends_still_needed; + + game_control_value[GAME_CONTROL_SOKOBAN_OBJECTS] = + local_player->sokobanfields_still_needed; + game_control_value[GAME_CONTROL_SOKOBAN_FIELDS] = + local_player->sokobanfields_still_needed; + + game_control_value[GAME_CONTROL_ROBOT_WHEEL] = 0; + + game_control_value[GAME_CONTROL_CONVEYOR_BELT_1] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_1_SWITCH] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_2] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_2_SWITCH] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_3] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_3_SWITCH] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_4] = 0; + game_control_value[GAME_CONTROL_CONVEYOR_BELT_4_SWITCH] = 0; + + game_control_value[GAME_CONTROL_MAGIC_WALL] = 0; + game_control_value[GAME_CONTROL_MAGIC_WALL_TIME] = + game.magic_wall_time_left; + game_control_value[GAME_CONTROL_BD_MAGIC_WALL] = 0; + game_control_value[GAME_CONTROL_DC_MAGIC_WALL] = 0; + + game_control_value[GAME_CONTROL_PLAYER_NAME] = 0; + game_control_value[GAME_CONTROL_LEVEL_NAME] = 0; + game_control_value[GAME_CONTROL_LEVEL_AUTHOR] = 0; +} + +void DisplayGameControlValues() +{ + int i; + + for (i = 0; game_controls[i].nr != -1; i++) + { + int nr = game_controls[i].nr; + int type = game_controls[i].type; + struct TextPosInfo *pos = game_controls[i].pos; + int value = game_control_value[nr]; + int last_value = last_game_control_value[nr]; + int chars = pos->chars; + int font = pos->font; + + if (value == last_value) + continue; + + last_game_control_value[nr] = value; + +#if 0 + printf("::: value %d changed from %d to %d\n", nr, last_value, value); +#endif + + if (PANEL_DEACTIVATED(pos)) + continue; + + if (type == TYPE_INTEGER) + { + if (nr == GAME_CONTROL_LEVEL_NUMBER || nr == GAME_CONTROL_TIME) + { + boolean use_dynamic_chars = (pos->chars == -1 ? TRUE : FALSE); + + if (use_dynamic_chars) /* use dynamic number of chars */ + { + int value_change = (nr == GAME_CONTROL_LEVEL_NUMBER ? 100 : 1000); + int chars1 = (nr == GAME_CONTROL_LEVEL_NUMBER ? 2 : 3); + int chars2 = chars1 + 1; + int font1 = pos->font; + int font2 = pos->font_alt; + + chars = (value < value_change ? chars1 : chars2); + font = (value < value_change ? font1 : font2); + + /* clear background if value just changed its size (dynamic chars) */ + if ((last_value < value_change) != (value < value_change)) + { + int width1 = chars1 * getFontWidth(font1); + int width2 = chars2 * getFontWidth(font2); + int max_width = MAX(width1, width2); + int max_height = MAX(getFontHeight(font1), getFontHeight(font2)); + + pos->width = max_width; + + ClearRectangleOnBackground(drawto, PANEL_XPOS(pos), PANEL_YPOS(pos), + max_width, max_height); + } + } + + pos->width = chars * getFontWidth(font); + } + + DrawText(PANEL_XPOS(pos), PANEL_YPOS(pos), int2str(value, chars), font); + } + else if (type == TYPE_ELEMENT) + { + if (nr >= GAME_CONTROL_KEY_1 && nr <= GAME_CONTROL_KEY_8) + { + int key_nr = nr - GAME_CONTROL_KEY_1; + int src_x = DOOR_GFX_PAGEX5 + 18 + (key_nr % STD_NUM_KEYS) * MINI_TILEX; + int src_y = DOOR_GFX_PAGEY1 + 123; + int dst_x = PANEL_XPOS(pos); + int dst_y = PANEL_YPOS(pos); + int element = (key_nr >= STD_NUM_KEYS ? EL_EMC_KEY_5 - STD_NUM_KEYS : + level.game_engine_type == GAME_ENGINE_TYPE_EM ? + EL_EM_KEY_1 : EL_KEY_1) + key_nr; + int graphic = el2edimg(element); + + if (value) + 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 (type == TYPE_STRING) + { + char *s = (nr == GAME_CONTROL_PLAYER_NAME ? setup.player_name : + nr == GAME_CONTROL_LEVEL_NAME ? level.name : + nr == GAME_CONTROL_LEVEL_AUTHOR ? level.author : NULL); + + if (s != NULL) + { + char *s_cut = getStringCopyN(s, pos->chars); + + DrawText(PANEL_XPOS(pos), PANEL_YPOS(pos), s_cut, pos->font); + + free(s_cut); + } + } + } +} + void DrawGameValue_Emeralds(int value) { struct TextPosInfo *pos = &game.panel.gems; @@ -1532,6 +1999,10 @@ void DrawGameValue_Emeralds(int value) int font_width = getFontWidth(font_nr); int chars = pos->chars; +#if 1 + return; /* !!! USE NEW STUFF !!! */ +#endif + if (PANEL_DEACTIVATED(pos)) return; @@ -1551,6 +2022,10 @@ void DrawGameValue_Dynamite(int value) int font_width = getFontWidth(font_nr); int chars = pos->chars; +#if 1 + return; /* !!! USE NEW STUFF !!! */ +#endif + if (PANEL_DEACTIVATED(pos)) return; @@ -1570,6 +2045,10 @@ void DrawGameValue_Score(int value) int font_width = getFontWidth(font_nr); int chars = pos->chars; +#if 1 + return; /* !!! USE NEW STUFF !!! */ +#endif + if (PANEL_DEACTIVATED(pos)) return; @@ -1595,6 +2074,10 @@ void DrawGameValue_Time(int value) int font_nr = font1_nr; boolean use_dynamic_chars = (chars == -1 ? TRUE : FALSE); +#if 1 + return; /* !!! USE NEW STUFF !!! */ +#endif + if (PANEL_DEACTIVATED(pos)) return; @@ -1627,7 +2110,7 @@ void DrawGameValue_Time(int value) void DrawGameValue_Level(int value) { - struct TextPosInfo *pos = &game.panel.level; + struct TextPosInfo *pos = &game.panel.level_number; int chars1 = 2; int chars2 = 3; int chars = pos->chars; @@ -1641,6 +2124,10 @@ void DrawGameValue_Level(int value) int font_nr = font1_nr; boolean use_dynamic_chars = (chars == -1 ? TRUE : FALSE); +#if 1 + return; /* !!! USE NEW STUFF !!! */ +#endif + if (PANEL_DEACTIVATED(pos)) return; @@ -1657,31 +2144,102 @@ void DrawGameValue_Level(int value) 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 { - int src_x = DOOR_GFX_PAGEX5 + 18; +#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 } } @@ -1814,6 +2372,12 @@ void DrawAllGameValues(int emeralds, int dynamite, int score, int time, } void DrawGameDoorValues() +{ + UpdateGameControlValues(); + DisplayGameControlValues(); +} + +void DrawGameDoorValues_OLD() { int time_value = (level.time == 0 ? TimePlayed : TimeLeft); int dynamite_value = 0; @@ -2321,12 +2885,15 @@ void InitGame() boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */ boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */ boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */ +#if 0 boolean do_fading = (game_status == GAME_MODE_MAIN); +#endif int i, j, x, y; game_status = GAME_MODE_PLAYING; InitGameEngine(); + InitGameControlValues(); /* don't play tapes over network */ network_playing = (options.network && !tape.playing); @@ -2880,8 +3447,24 @@ void InitGame() if (!game.restart_level) CloseDoor(DOOR_CLOSE_1); +#if 1 + if (level_editor_test_game) + FadeSkipNextFadeIn(); + else + FadeSetStartItem(); +#else + if (level_editor_test_game) + fading = fading_none; + else + fading = menu.destination; +#endif + +#if 1 + FadeOut(REDRAW_FIELD); +#else if (do_fading) FadeOut(REDRAW_FIELD); +#endif /* !!! FIX THIS (START) !!! */ if (level.game_engine_type == GAME_ENGINE_TYPE_EM) @@ -2908,10 +3491,14 @@ void InitGame() } /* !!! FIX THIS (END) !!! */ +#if 1 + FadeIn(REDRAW_FIELD); +#else if (do_fading) FadeIn(REDRAW_FIELD); BackToFront(); +#endif if (!game.restart_level) { @@ -3234,8 +3821,15 @@ void GameWon() time = time_final; score = score_final; +#if 1 + game_control_value[GAME_CONTROL_TIME] = time; + game_control_value[GAME_CONTROL_SCORE] = score; + + DisplayGameControlValues(); +#else DrawGameValue_Time(time); DrawGameValue_Score(score); +#endif } if (level.game_engine_type == GAME_ENGINE_TYPE_RND) @@ -3309,8 +3903,15 @@ void GameWon() time += time_count_steps * time_count_dir; score += time_count_steps * level.score[SC_TIME_BONUS]; +#if 1 + game_control_value[GAME_CONTROL_TIME] = time; + game_control_value[GAME_CONTROL_SCORE] = score; + + DisplayGameControlValues(); +#else DrawGameValue_Time(time); DrawGameValue_Score(score); +#endif if (time == time_final) StopSound(SND_GAME_LEVELTIME_BONUS); @@ -3362,14 +3963,20 @@ void GameEnd() { game_status = GAME_MODE_MAIN; +#if 1 + DrawAndFadeInMainMenu(REDRAW_FIELD); +#else DrawMainMenu(); +#endif return; } if (!local_player->LevelSolved_SaveScore) { +#if 1 FadeOut(REDRAW_FIELD); +#endif game_status = GAME_MODE_MAIN; @@ -3401,7 +4008,9 @@ void GameEnd() } else { +#if 1 FadeOut(REDRAW_FIELD); +#endif game_status = GAME_MODE_MAIN; @@ -3886,8 +4495,10 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, if (!IN_VIS_FIELD(SCREENX(x), SCREENY(y)) || center_screen) { - if (center_screen) + if (!level.shifted_relocation || center_screen) { + /* quick relocation (without scrolling), with centering of screen */ + scroll_x = (x < SBX_Left + MIDPOSX ? SBX_Left : x > SBX_Right + MIDPOSX ? SBX_Right : x - MIDPOSX); @@ -3922,6 +4533,8 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, } else { + /* quick relocation (without scrolling), inside visible screen area */ + if ((move_dir == MV_LEFT && scroll_x > x - MIDPOSX + offset) || (move_dir == MV_RIGHT && scroll_x < x - MIDPOSX - offset)) scroll_x = x - MIDPOSX + (scroll_x < x - MIDPOSX ? -offset : +offset); @@ -3943,6 +4556,49 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, } else { +#if 1 + int scroll_xx, scroll_yy; + + if (!level.shifted_relocation || center_screen) + { + /* visible relocation (with scrolling), with centering of screen */ + + scroll_xx = (x < SBX_Left + MIDPOSX ? SBX_Left : + x > SBX_Right + MIDPOSX ? SBX_Right : + x - MIDPOSX); + + scroll_yy = (y < SBY_Upper + MIDPOSY ? SBY_Upper : + y > SBY_Lower + MIDPOSY ? SBY_Lower : + y - MIDPOSY); + } + else + { + /* visible relocation (with scrolling), but do not center screen */ + + int center_scroll_x = (old_x < SBX_Left + MIDPOSX ? SBX_Left : + old_x > SBX_Right + MIDPOSX ? SBX_Right : + old_x - MIDPOSX); + + int center_scroll_y = (old_y < SBY_Upper + MIDPOSY ? SBY_Upper : + old_y > SBY_Lower + MIDPOSY ? SBY_Lower : + old_y - MIDPOSY); + + int offset_x = x + (scroll_x - center_scroll_x); + int offset_y = y + (scroll_y - center_scroll_y); + + scroll_xx = (offset_x < SBX_Left + MIDPOSX ? SBX_Left : + offset_x > SBX_Right + MIDPOSX ? SBX_Right : + offset_x - MIDPOSX); + + scroll_yy = (offset_y < SBY_Upper + MIDPOSY ? SBY_Upper : + offset_y > SBY_Lower + MIDPOSY ? SBY_Lower : + offset_y - MIDPOSY); + } + +#else + + /* visible relocation (with scrolling), with centering of screen */ + int scroll_xx = (x < SBX_Left + MIDPOSX ? SBX_Left : x > SBX_Right + MIDPOSX ? SBX_Right : x - MIDPOSX); @@ -3950,6 +4606,7 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, int scroll_yy = (y < SBY_Upper + MIDPOSY ? SBY_Upper : y > SBY_Lower + MIDPOSY ? SBY_Lower : y - MIDPOSY); +#endif ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */ @@ -8688,7 +9345,13 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) { TimeLeft = action_arg_number_new; +#if 1 + game_control_value[GAME_CONTROL_TIME] = TimeLeft; + + DisplayGameControlValues(); +#else DrawGameValue_Time(TimeLeft); +#endif if (!TimeLeft && setup.time_limit) for (i = 0; i < MAX_PLAYERS; i++) @@ -8702,7 +9365,13 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) { local_player->score = action_arg_number_new; +#if 1 + game_control_value[GAME_CONTROL_SCORE] = local_player->score; + + DisplayGameControlValues(); +#else DrawGameValue_Score(local_player->score); +#endif break; } @@ -8711,7 +9380,13 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) { local_player->gems_still_needed = action_arg_number_new; +#if 1 + game_control_value[GAME_CONTROL_GEMS] = local_player->gems_still_needed; + + DisplayGameControlValues(); +#else DrawGameValue_Emeralds(local_player->gems_still_needed); +#endif break; } @@ -9986,7 +10661,13 @@ static void CheckLevelTime() if (TimeLeft <= 10 && setup.time_limit) PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); +#if 1 + game_control_value[GAME_CONTROL_TIME] = TimeLeft; + + DisplayGameControlValues(); +#else DrawGameValue_Time(TimeLeft); +#endif if (!TimeLeft && setup.time_limit) { @@ -9997,8 +10678,17 @@ static void CheckLevelTime() KillPlayer(&stored_player[i]); } } +#if 1 + else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */ + { + game_control_value[GAME_CONTROL_TIME] = TimePlayed; + + DisplayGameControlValues(); + } +#else else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */ DrawGameValue_Time(TimePlayed); +#endif level.native_em_level->lev->time = (level.time == 0 ? TimePlayed : TimeLeft); @@ -10007,6 +10697,8 @@ static void CheckLevelTime() if (tape.recording || tape.playing) DrawVideoDisplay(VIDEO_STATE_TIME_ON, TapeTime); } + + DrawGameDoorValues(); } void AdvanceFrameAndPlayerCounters(int player_nr) @@ -11722,14 +12414,29 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) if (TimeLeft <= 10 && setup.time_limit) PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); +#if 1 + game_control_value[GAME_CONTROL_TIME] = TimeLeft; + + DisplayGameControlValues(); +#else DrawGameValue_Time(TimeLeft); +#endif if (!TimeLeft && setup.time_limit) for (i = 0; i < MAX_PLAYERS; i++) KillPlayer(&stored_player[i]); } +#if 1 + else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */ + { + game_control_value[GAME_CONTROL_TIME] = TimePlayed; + + DisplayGameControlValues(); + } +#else else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */ DrawGameValue_Time(TimePlayed); +#endif } if (tape.single_step && tape.recording && !tape.pausing && @@ -12778,7 +13485,14 @@ int DigField(struct PlayerInfo *player, else if (element == EL_EXTRA_TIME && level.time > 0) { TimeLeft += level.extra_time; + +#if 1 + game_control_value[GAME_CONTROL_TIME] = TimeLeft; + + DisplayGameControlValues(); +#else DrawGameValue_Time(TimeLeft); +#endif } else if (element == EL_SHIELD_NORMAL || element == EL_SHIELD_DEADLY) { @@ -12857,7 +13571,13 @@ int DigField(struct PlayerInfo *player, if (local_player->gems_still_needed < 0) local_player->gems_still_needed = 0; +#if 1 + game_control_value[GAME_CONTROL_GEMS] = local_player->gems_still_needed; + + DisplayGameControlValues(); +#else DrawGameValue_Emeralds(local_player->gems_still_needed); +#endif } RaiseScoreElement(element); @@ -13101,7 +13821,14 @@ int DigField(struct PlayerInfo *player, if (level.time > 0 || level.use_time_orb_bug) { TimeLeft += level.time_orb_time; + +#if 1 + game_control_value[GAME_CONTROL_TIME] = TimeLeft; + + DisplayGameControlValues(); +#else DrawGameValue_Time(TimeLeft); +#endif } ResetGfxAnimation(x, y); @@ -13723,7 +14450,13 @@ void RaiseScore(int value) { local_player->score += value; +#if 1 + game_control_value[GAME_CONTROL_SCORE] = local_player->score; + + DisplayGameControlValues(); +#else DrawGameValue_Score(local_player->score); +#endif } void RaiseScoreElement(int element) @@ -13818,13 +14551,31 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message) { if (quick_quit) { +#if 1 + +#if 1 + FadeSkipNextFadeIn(); +#else + fading = fading_none; +#endif + +#else + OpenDoor(DOOR_CLOSE_1); +#endif + game_status = GAME_MODE_MAIN; +#if 1 + DrawAndFadeInMainMenu(REDRAW_FIELD); +#else DrawMainMenu(); +#endif } else { +#if 0 FadeOut(REDRAW_FIELD); +#endif game_status = GAME_MODE_MAIN; @@ -14183,11 +14934,50 @@ boolean CheckEngineSnapshot() static struct { - int x, y; + int *x, *y; + int gd_x, gd_y; int gadget_id; char *infotext; } gamebutton_info[NUM_GAME_BUTTONS] = { +#if 1 + { + &game.button.stop.x, &game.button.stop.y, + GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS, + GAME_CTRL_ID_STOP, + "stop game" + }, + { + &game.button.pause.x, &game.button.pause.y, + GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS, + GAME_CTRL_ID_PAUSE, + "pause game" + }, + { + &game.button.play.x, &game.button.play.y, + GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS, + GAME_CTRL_ID_PLAY, + "play game" + }, + { + &game.button.sound_music.x, &game.button.sound_music.y, + SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS, + SOUND_CTRL_ID_MUSIC, + "background music on/off" + }, + { + &game.button.sound_loops.x, &game.button.sound_loops.y, + SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS, + SOUND_CTRL_ID_LOOPS, + "sound loops on/off" + }, + { + &game.button.sound_simple.x,&game.button.sound_simple.y, + SOUND_BUTTON_SIMPLE_XPOS, SOUND_BUTTON_YPOS, + SOUND_CTRL_ID_SIMPLE, + "normal sounds on/off" + } +#else { GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS, GAME_CTRL_ID_STOP, @@ -14218,6 +15008,7 @@ static struct SOUND_CTRL_ID_SIMPLE, "normal sounds on/off" } +#endif }; void CreateGameButtons() @@ -14231,12 +15022,15 @@ void CreateGameButtons() int button_type; boolean checked; unsigned long event_mask; + int x, y; int gd_xoffset, gd_yoffset; int gd_x1, gd_x2, gd_y1, gd_y2; int id = i; - gd_xoffset = gamebutton_info[i].x; - gd_yoffset = gamebutton_info[i].y; + x = DX + *gamebutton_info[i].x; + y = DY + *gamebutton_info[i].y; + gd_xoffset = gamebutton_info[i].gd_x; + gd_yoffset = gamebutton_info[i].gd_y; gd_x1 = DOOR_GFX_PAGEX4 + gd_xoffset; gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset; @@ -14264,8 +15058,13 @@ void CreateGameButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, gamebutton_info[i].infotext, +#if 1 + GDI_X, x, + GDI_Y, y, +#else GDI_X, DX + gd_xoffset, GDI_Y, DY + gd_yoffset, +#endif GDI_WIDTH, GAME_BUTTON_XSIZE, GDI_HEIGHT, GAME_BUTTON_YSIZE, GDI_TYPE, button_type,