X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=4a9e2ffbc97cb9a9a0d534f3ff57d0e2fe5d0bc0;hb=d9b86b7b2ebe0b2be3926656c3bbdcd060ee5811;hp=b3732972293429add837ad45c1b2fa1725ac9e59;hpb=652f2eebd3bac1458da0010bef1b1208c19649c7;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index b3732972..4a9e2ffb 100644 --- a/src/screens.c +++ b/src/screens.c @@ -285,8 +285,10 @@ void DrawMainMenu() SetDrawtoField(DRAW_BACKBUFFER); #endif +#if 0 /* map gadgets for main menu screen */ MapTapeButtons(); +#endif /* level_nr may have been set to value over handicap with level editor */ if (setup.handicap && level_nr > leveldir_current->handicap_level) @@ -390,6 +392,11 @@ void DrawMainMenu() PlayMenuMusic(); OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); + +#if 1 + /* map gadgets for main menu screen */ + MapTapeButtons(); +#endif } #if 0 @@ -445,6 +452,11 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { if (dx && choice == 1) x = (dx < 0 ? 10 : 14); + else if (dx > 0) + { + if (choice == 4 || choice == 6) + button = MB_MENU_CHOICE; + } else if (dy) y = choice + dy; } @@ -814,12 +826,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); @@ -880,7 +895,7 @@ static char *getHelpText(int element, int action, int direction) strcat(token, element_action_info[action].suffix); if (direction != -1) - strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix); + strcat(token, element_direction_info[MV_DIR_TO_BIT(direction)].suffix); return getHashEntry(helptext_info, token); } @@ -988,7 +1003,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); @@ -2032,6 +2047,7 @@ static struct TokenInfo setup_info_game[] = { TYPE_SWITCH, &setup.skip_levels, "Skip Levels:" }, { TYPE_SWITCH, &setup.time_limit, "Timelimit:" }, { TYPE_SWITCH, &setup.autorecord, "Auto-Record:" }, + { TYPE_SWITCH, &setup.quick_switch, "Quick Switch:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2043,14 +2059,18 @@ 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_emerald_mine, "Emerald Mine:" }, - { TYPE_SWITCH, &setup.editor.el_emerald_mine_club,"E.M. Club:" }, - { TYPE_SWITCH, &setup.editor.el_more, "More:" }, + { 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_sokoban, "Sokoban:" }, { TYPE_SWITCH, &setup.editor.el_supaplex, "Supaplex:" }, - { TYPE_SWITCH, &setup.editor.el_diamond_caves, "Diamd. Caves:" }, - { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX Boulderd.:" }, + { 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_headlines, "Headlines:" }, @@ -2503,6 +2523,8 @@ static void drawPlayerSetupInputInfo(int player_nr) "Joystick4" }; + InitJoysticks(); + custom_key = setup.input[player_nr].key; DrawText(mSX + 11 * 32, mSY + 2 * 32, int2str(player_nr + 1, 1), @@ -2516,10 +2538,10 @@ static void drawPlayerSetupInputInfo(int player_nr) if (setup.input[player_nr].use_joystick) { char *device_name = setup.input[player_nr].joy.device_name; + char *text = joystick_name[getJoystickNrFromDeviceName(device_name)]; + int font_nr = (joystick.fd[player_nr] < 0 ? FONT_VALUE_OLD : FONT_VALUE_1); - DrawText(mSX + 8 * 32, mSY + 3 * 32, - joystick_name[getJoystickNrFromDeviceName(device_name)], - FONT_VALUE_1); + DrawText(mSX + 8 * 32, mSY + 3 * 32, text, font_nr); DrawText(mSX + 32, mSY + 4 * 32, "Calibrate", FONT_MENU_1); } else @@ -2971,7 +2993,9 @@ static boolean CalibrateJoystickMain(int player_nr) StopAnimation(); +#if 0 DrawSetupScreen_Input(); +#endif /* wait until the last pressed button was released */ while (Joystick(player_nr) & JOY_BUTTON) @@ -2994,13 +3018,25 @@ void CalibrateJoystick(int player_nr) { if (!CalibrateJoystickMain(player_nr)) { + char *device_name = setup.input[player_nr].joy.device_name; + int nr = getJoystickNrFromDeviceName(device_name) + 1; + int xpos = mSX - SX; + int ypos = mSY - SY; + ClearWindow(); - DrawText(mSX + 16, mSY + 6 * 32, " JOYSTICK NOT ", FONT_TITLE_1); - DrawText(mSX, mSY + 7 * 32, " AVAILABLE ", FONT_TITLE_1); + DrawTextF(xpos + 16, ypos + 6 * 32, FONT_TITLE_1, " JOYSTICK %d ", nr); + DrawTextF(xpos + 16, ypos + 7 * 32, FONT_TITLE_1, " NOT AVAILABLE! "); BackToFront(); - Delay(2000); /* show error message for two seconds */ + + Delay(2000); /* show error message for a short time */ + + ClearEventQueue(); } + +#if 1 + DrawSetupScreen_Input(); +#endif } void DrawSetupScreen() @@ -3053,19 +3089,41 @@ 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->ply1->alive == 0 && - level.native_em_level->ply2->alive == 0) /* all dead */ + if (level.native_em_level->ply[0]->alive == 0 && + level.native_em_level->ply[1]->alive == 0 && + level.native_em_level->ply[2]->alive == 0 && + level.native_em_level->ply[3]->alive == 0) /* all dead */ AllPlayersGone = TRUE; if (AllPlayersGone && !TAPE_IS_STOPPED(tape)) @@ -3119,7 +3177,39 @@ void HandleGameActions() if (tape.recording) TapeRecordAction(tape_action); +#if 1 + { + byte effective_action[MAX_PLAYERS]; + + 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 GameActions_EM(local_player->effective_action); +#endif if (TimeFrames >= FRAMES_PER_SECOND) { @@ -3180,8 +3270,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) @@ -3196,7 +3293,9 @@ void StartGameActions(boolean init_network_game, boolean record_tape, game_status = GAME_MODE_PLAYING; +#if 0 InitRND(random_seed); +#endif InitGame(); }