X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=76e2444709815029e88dd31fcad6bbe6d4510ca1;hb=5c717898f717007b885f86e0d02f10d2a0306237;hp=90b987f3bfa4884ba1ab9e94388407326414550e;hpb=24134e1e4ef7e3d582ac4827eb8740261bf5d1b6;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 90b987f3..76e24447 100644 --- a/src/screens.c +++ b/src/screens.c @@ -29,15 +29,16 @@ #define SETUP_MODE_GAME 1 #define SETUP_MODE_EDITOR 2 #define SETUP_MODE_INPUT 3 -#define SETUP_MODE_SHORTCUT 4 -#define SETUP_MODE_GRAPHICS 5 -#define SETUP_MODE_SOUND 6 -#define SETUP_MODE_ARTWORK 7 -#define SETUP_MODE_CHOOSE_GRAPHICS 8 -#define SETUP_MODE_CHOOSE_SOUNDS 9 -#define SETUP_MODE_CHOOSE_MUSIC 10 +#define SETUP_MODE_SHORTCUT_1 4 +#define SETUP_MODE_SHORTCUT_2 5 +#define SETUP_MODE_GRAPHICS 6 +#define SETUP_MODE_SOUND 7 +#define SETUP_MODE_ARTWORK 8 +#define SETUP_MODE_CHOOSE_GRAPHICS 9 +#define SETUP_MODE_CHOOSE_SOUNDS 10 +#define SETUP_MODE_CHOOSE_MUSIC 11 -#define MAX_SETUP_MODES 11 +#define MAX_SETUP_MODES 12 /* for input setup functions */ #define SETUPINPUT_SCREEN_POS_START 0 @@ -60,6 +61,7 @@ #define MAX_MENU_ENTRIES_ON_SCREEN (SCR_FIELDY - 2) #define MENU_SCREEN_START_YPOS 2 #define MENU_SCREEN_VALUE_XPOS 14 +#define MENU_SCREEN_MAX_XPOS (SCR_FIELDX - 1) #define MENU_TITLE1_YPOS 8 #define MENU_TITLE2_YPOS 46 @@ -826,12 +828,15 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init) action = helpanim_info[j].action; direction = helpanim_info[j].direction; + if (element < 0) + element = EL_UNKNOWN; + if (action != -1 && direction != -1) graphic = el_act_dir2img(element, action, direction); else if (action != -1) graphic = el_act2img(element, action); else if (direction != -1) - graphic = el_act2img(element, direction); + graphic = el_dir2img(element, direction); else graphic = el2img(element); @@ -1000,7 +1005,7 @@ void HandleInfoScreen_Elements(int button) } else { - if (DelayReached(&info_delay, GAME_FRAME_DELAY)) + if (DelayReached(&info_delay, GameFrameDelay)) if (page < num_pages) DrawInfoScreen_HelpAnim(page * anims_per_page, num_anims, FALSE); @@ -2003,9 +2008,15 @@ static void execSetupInput() DrawSetupScreen(); } -static void execSetupShortcut() +static void execSetupShortcut1() +{ + setup_mode = SETUP_MODE_SHORTCUT_1; + DrawSetupScreen(); +} + +static void execSetupShortcut2() { - setup_mode = SETUP_MODE_SHORTCUT; + setup_mode = SETUP_MODE_SHORTCUT_2; DrawSetupScreen(); } @@ -2023,13 +2034,14 @@ static void execSaveAndExitSetup() static struct TokenInfo setup_info_main[] = { - { TYPE_ENTER_MENU, execSetupGame, "Game Settings" }, - { TYPE_ENTER_MENU, execSetupEditor, "Editor Settings" }, + { TYPE_ENTER_MENU, execSetupGame, "Game & Menu" }, + { TYPE_ENTER_MENU, execSetupEditor, "Editor" }, { TYPE_ENTER_MENU, execSetupGraphics, "Graphics" }, { TYPE_ENTER_MENU, execSetupSound, "Sound & Music" }, { TYPE_ENTER_MENU, execSetupArtwork, "Custom Artwork" }, { TYPE_ENTER_MENU, execSetupInput, "Input Devices" }, - { TYPE_ENTER_MENU, execSetupShortcut, "Key Shortcuts" }, + { TYPE_ENTER_MENU, execSetupShortcut1, "Key Shortcuts 1" }, + { TYPE_ENTER_MENU, execSetupShortcut2, "Key Shortcuts 2" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execExitSetup, "Exit" }, { TYPE_LEAVE_MENU, execSaveAndExitSetup, "Save and Exit" }, @@ -2039,11 +2051,11 @@ static struct TokenInfo setup_info_main[] = static struct TokenInfo setup_info_game[] = { - { TYPE_SWITCH, &setup.team_mode, "Team-Mode:" }, + { TYPE_SWITCH, &setup.team_mode, "Team-Mode (Multi-Player):" }, { TYPE_SWITCH, &setup.handicap, "Handicap:" }, - { TYPE_SWITCH, &setup.skip_levels, "Skip Levels:" }, - { TYPE_SWITCH, &setup.time_limit, "Timelimit:" }, - { TYPE_SWITCH, &setup.autorecord, "Auto-Record:" }, + { TYPE_SWITCH, &setup.skip_levels, "Skip Unsolved Levels:" }, + { TYPE_SWITCH, &setup.time_limit, "Time Limit:" }, + { TYPE_SWITCH, &setup.autorecord, "Auto-Record Tapes:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2052,26 +2064,19 @@ static struct TokenInfo setup_info_game[] = static struct TokenInfo setup_info_editor[] = { -#if 0 - { TYPE_STRING, NULL, "Offer Special Elements:"}, -#endif - -#if 0 -#else - { TYPE_SWITCH, &setup.editor.el_boulderdash, "BoulderDash:" }, + { TYPE_SWITCH, &setup.editor.el_boulderdash, "Boulder Dash:" }, { TYPE_SWITCH, &setup.editor.el_emerald_mine, "Emerald Mine:" }, - { TYPE_SWITCH, &setup.editor.el_emerald_mine_club,"E.M.C.:" }, - { TYPE_SWITCH, &setup.editor.el_more, "R'n'D:" }, + { TYPE_SWITCH, &setup.editor.el_emerald_mine_club, "Emerald Mine Club:" }, + { TYPE_SWITCH, &setup.editor.el_more, "Rocks'n'Diamonds:" }, { TYPE_SWITCH, &setup.editor.el_sokoban, "Sokoban:" }, { TYPE_SWITCH, &setup.editor.el_supaplex, "Supaplex:" }, - { TYPE_SWITCH, &setup.editor.el_diamond_caves, "DC II:" }, - { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX BD:" }, -#endif - { TYPE_SWITCH, &setup.editor.el_chars, "Characters:" }, - { TYPE_SWITCH, &setup.editor.el_custom, "Custom:" }, + { TYPE_SWITCH, &setup.editor.el_diamond_caves, "Diamond Caves II:" }, + { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX-Boulderdash:" }, + { TYPE_SWITCH, &setup.editor.el_chars, "Text Characters:" }, + { TYPE_SWITCH, &setup.editor.el_custom, "Custom & Group Elements:" }, { TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" }, - { TYPE_SWITCH, &setup.editor.el_user_defined, "User defined:" }, - { TYPE_SWITCH, &setup.editor.el_dynamic, "Dynamic:" }, + { TYPE_SWITCH, &setup.editor.el_user_defined, "User defined element list:" }, + { TYPE_SWITCH, &setup.editor.el_dynamic, "Dynamic level elements:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2080,14 +2085,15 @@ static struct TokenInfo setup_info_editor[] = static struct TokenInfo setup_info_graphics[] = { - { TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" }, - { TYPE_SWITCH, &setup.scroll_delay, "Scroll Delay:" }, - { TYPE_SWITCH, &setup.soft_scrolling, "Soft Scroll.:" }, + { TYPE_SWITCH, &setup.fullscreen, "Fullscreen Mode:" }, + { TYPE_SWITCH, &setup.scroll_delay, "Delayed Scrolling:" }, + { TYPE_SWITCH, &setup.soft_scrolling, "Soft Scrolling:" }, #if 0 - { TYPE_SWITCH, &setup.double_buffering,"Buffered gfx:" }, + { TYPE_SWITCH, &setup.double_buffering,"Double-Buffering:" }, { TYPE_SWITCH, &setup.fading, "Fading:" }, #endif - { TYPE_SWITCH, &setup.quick_doors, "Quick Doors:" }, + { TYPE_SWITCH, &setup.quick_switch, "Quick Player Focus Switch:" }, + { TYPE_SWITCH, &setup.quick_doors, "Quick Menu Doors:" }, { TYPE_SWITCH, &setup.toons, "Toons:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2097,9 +2103,9 @@ static struct TokenInfo setup_info_graphics[] = static struct TokenInfo setup_info_sound[] = { - { TYPE_SWITCH, &setup.sound_simple, "Simple Sound:" }, - { TYPE_SWITCH, &setup.sound_loops, "Sound Loops:" }, - { TYPE_SWITCH, &setup.sound_music, "Game Music:" }, + { TYPE_SWITCH, &setup.sound_simple, "Sound Effects (Normal):" }, + { TYPE_SWITCH, &setup.sound_loops, "Sound Effects (Looping):" }, + { TYPE_SWITCH, &setup.sound_music, "Music:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2115,26 +2121,51 @@ static struct TokenInfo setup_info_artwork[] = { TYPE_ENTER_MENU, execSetupChooseMusic, "Custom Music" }, { TYPE_STRING, &music_set_name, "" }, { TYPE_EMPTY, NULL, "" }, +#if 1 + { TYPE_YES_NO, &setup.override_level_graphics,"Override Level Graphics:" }, + { TYPE_YES_NO, &setup.override_level_sounds, "Override Level Sounds:" }, + { TYPE_YES_NO, &setup.override_level_music, "Override Level Music:" }, +#else { TYPE_STRING, NULL, "Override Level Artwork:"}, { TYPE_YES_NO, &setup.override_level_graphics, "Graphics:" }, { TYPE_YES_NO, &setup.override_level_sounds, "Sounds:" }, { TYPE_YES_NO, &setup.override_level_music, "Music:" }, +#endif { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, { 0, NULL, NULL } }; -static struct TokenInfo setup_info_shortcut[] = +static struct TokenInfo setup_info_shortcut_1[] = { - { TYPE_KEYTEXT, NULL, "Quick Save Game:", }, - { TYPE_KEY, &setup.shortcut.save_game, "" }, - { TYPE_KEYTEXT, NULL, "Quick Load Game:", }, - { TYPE_KEY, &setup.shortcut.load_game, "" }, - { TYPE_KEYTEXT, NULL, "Toggle Pause:", }, - { TYPE_KEY, &setup.shortcut.toggle_pause, "" }, + { TYPE_KEYTEXT, NULL, "Quick Save Game to Tape:", }, + { TYPE_KEY, &setup.shortcut.save_game, "" }, + { TYPE_KEYTEXT, NULL, "Quick Load Game from Tape:", }, + { TYPE_KEY, &setup.shortcut.load_game, "" }, + { TYPE_KEYTEXT, NULL, "Start Game & Toggle Pause:", }, + { TYPE_KEY, &setup.shortcut.toggle_pause, "" }, { TYPE_EMPTY, NULL, "" }, - { TYPE_YES_NO, &setup.ask_on_escape, "Ask on Esc:" }, + { TYPE_YES_NO, &setup.ask_on_escape, "Ask on 'Esc' Key:" }, + { TYPE_YES_NO, &setup.ask_on_escape_editor, "Ask on 'Esc' Key (Editor):" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_LEAVE_MENU, execSetupMain, "Back" }, + + { 0, NULL, NULL } +}; + +static struct TokenInfo setup_info_shortcut_2[] = +{ + { TYPE_KEYTEXT, NULL, "Set Focus to Player 1:", }, + { TYPE_KEY, &setup.shortcut.focus_player[0], "" }, + { TYPE_KEYTEXT, NULL, "Set Focus to Player 2:", }, + { TYPE_KEY, &setup.shortcut.focus_player[1], "" }, + { TYPE_KEYTEXT, NULL, "Set Focus to Player 3:", }, + { TYPE_KEY, &setup.shortcut.focus_player[2], "" }, + { TYPE_KEYTEXT, NULL, "Set Focus to Player 4:", }, + { TYPE_KEY, &setup.shortcut.focus_player[3], "" }, + { TYPE_KEYTEXT, NULL, "Set Focus to All Players:", }, + { TYPE_KEY, &setup.shortcut.focus_player_all, "" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2195,15 +2226,19 @@ static void drawSetupValue(int pos) int font_nr = FONT_VALUE_1; int type = setup_info[pos].type; void *value = setup_info[pos].value; - char *value_string = (!(type & TYPE_GHOSTED) ? getSetupValue(type, value) : - "n/a"); + char *value_string = getSetupValue(type, value); + int i; if (value_string == NULL) return; if (type & TYPE_KEY) { +#if 1 + xpos = 1; +#else xpos = 3; +#endif if (type & TYPE_QUERY) { @@ -2226,8 +2261,14 @@ static void drawSetupValue(int pos) font_nr = (*(boolean *)value ? FONT_OPTION_ON : FONT_OPTION_OFF); } +#if 1 + for (i = xpos; i <= MENU_SCREEN_MAX_XPOS; i++) + DrawText(mSX + i * 32, mSY + ypos * 32, " ", font_nr); +#else DrawText(mSX + xpos * 32, mSY + ypos * 32, (xpos == 3 ? " " : " "), font_nr); +#endif + DrawText(mSX + xpos * 32, mSY + ypos * 32, value_string, font_nr); } @@ -2293,9 +2334,14 @@ static void DrawSetupScreen_Generic() setup_info = setup_info_artwork; title_string = "Custom Artwork"; } - else if (setup_mode == SETUP_MODE_SHORTCUT) + else if (setup_mode == SETUP_MODE_SHORTCUT_1) + { + setup_info = setup_info_shortcut_1; + title_string = "Setup Shortcuts"; + } + else if (setup_mode == SETUP_MODE_SHORTCUT_2) { - setup_info = setup_info_shortcut; + setup_info = setup_info_shortcut_2; title_string = "Setup Shortcuts"; } @@ -2319,8 +2365,16 @@ static void DrawSetupScreen_Generic() (value_ptr == &setup.fullscreen && !video.fullscreen_available)) setup_info[i].type |= TYPE_GHOSTED; +#if 1 + if (setup_info[i].type & (TYPE_SWITCH | + TYPE_YES_NO | + TYPE_STRING | + TYPE_KEYTEXT)) + font_nr = FONT_MENU_2; +#else if (setup_info[i].type & TYPE_STRING) font_nr = FONT_MENU_2; +#endif DrawText(mSX + 32, mSY + ypos * 32, setup_info[i].text, font_nr); @@ -3085,16 +3139,36 @@ void HandleGameActions() byte tape_action[MAX_PLAYERS]; int i; +#if 1 if (level.native_em_level->lev->home == 0) /* all players at home */ { + local_player->LevelSolved = TRUE; + AllPlayersGone = TRUE; + + level.native_em_level->lev->home = -1; + } + + if (local_player->LevelSolved) GameWon(); - if (!TAPE_IS_STOPPED(tape)) + if (AllPlayersGone && !TAPE_IS_STOPPED(tape)) + TapeStop(); + + if (game_status != GAME_MODE_PLAYING) + return; +#else + if (level.native_em_level->lev->home == 0) /* all players at home */ + { + if (local_player->LevelSolved) + GameWon(); + + if (AllPlayersGone && !TAPE_IS_STOPPED(tape)) TapeStop(); if (game_status != GAME_MODE_PLAYING) return; } +#endif if (level.native_em_level->ply[0]->alive == 0 && level.native_em_level->ply[1]->alive == 0 && @@ -3160,6 +3234,27 @@ void HandleGameActions() for (i = 0; i < MAX_PLAYERS; i++) effective_action[i] = stored_player[i].effective_action; + +#if 0 + printf("::: %s: ", + tape.playing ? "PLAYING" : + tape.recording ? "RECORDING" : + "STOPPED"); + + for (i = 1; i < MAX_PLAYERS; i++) + if ((recorded_player_action && recorded_player_action[i] != 0) || + tape_action[i] != 0 || + effective_action[i] != 0) + printf("::: -----------------> WARNING!\n"); + + printf("::: %08d: %08x [%08x] [%08x]\n", + FrameCounter, + (recorded_player_action ? recorded_player_action[0] : -1), + tape_action[0], + effective_action[0]); +#endif + + GameActions_EM(effective_action); } #else @@ -3225,8 +3320,15 @@ void HandleGameActions() void StartGameActions(boolean init_network_game, boolean record_tape, long random_seed) { +#if 1 + unsigned long new_random_seed = InitRND(random_seed); + + if (record_tape) + TapeStartRecording(new_random_seed); +#else if (record_tape) TapeStartRecording(random_seed); +#endif #if defined(NETWORK_AVALIABLE) if (init_network_game) @@ -3241,7 +3343,9 @@ void StartGameActions(boolean init_network_game, boolean record_tape, game_status = GAME_MODE_PLAYING; +#if 0 InitRND(random_seed); +#endif InitGame(); }