X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=e5f0e6da1eecaee7f7a72b41ac23dea97efab15a;hb=c74a890afba46c41f6ba6ef691bc89da0dd0135c;hp=76e2444709815029e88dd31fcad6bbe6d4510ca1;hpb=5c717898f717007b885f86e0d02f10d2a0306237;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 76e24447..e5f0e6da 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2052,6 +2052,7 @@ static struct TokenInfo setup_info_main[] = static struct TokenInfo setup_info_game[] = { { TYPE_SWITCH, &setup.team_mode, "Team-Mode (Multi-Player):" }, + { TYPE_YES_NO, &setup.input_on_focus, "Only Move Focussed Player:" }, { TYPE_SWITCH, &setup.handicap, "Handicap:" }, { TYPE_SWITCH, &setup.skip_levels, "Skip Unsolved Levels:" }, { TYPE_SWITCH, &setup.time_limit, "Time Limit:" }, @@ -3131,223 +3132,10 @@ void HandleGameActions() if (game_status != GAME_MODE_PLAYING) return; - /* !!! FIX THIS (START) !!! */ - if (level.game_engine_type == GAME_ENGINE_TYPE_EM) - { - byte *recorded_player_action; - byte summarized_player_action = 0; - 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 (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 && - 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)) - TapeStop(); - - /* --- game actions --- */ - - if (tape.pausing) - { - /* don't use 100% CPU while in pause mode -- this should better be solved - like in the R'n'D game engine! */ - - Delay(10); - - return; - } - - recorded_player_action = (tape.playing ? TapePlayAction() : NULL); - -#if 1 - /* !!! CHECK THIS (tape.pausing is always FALSE here!) !!! */ - if (recorded_player_action == NULL && tape.pausing) - return; -#endif - - for (i = 0; i < MAX_PLAYERS; i++) - { - summarized_player_action |= stored_player[i].action; - - if (!network_playing) - stored_player[i].effective_action = stored_player[i].action; - } - - if (!options.network && !setup.team_mode) - local_player->effective_action = summarized_player_action; - - if (recorded_player_action != NULL) - for (i = 0; i < MAX_PLAYERS; i++) - stored_player[i].effective_action = recorded_player_action[i]; - - for (i = 0; i < MAX_PLAYERS; i++) - { - tape_action[i] = stored_player[i].effective_action; - - /* !!! (this does not happen in the EM engine) !!! */ - if (tape.recording && tape_action[i] && !tape.player_participates[i]) - tape.player_participates[i] = TRUE; /* player just appeared from CE */ - } - - /* only save actions from input devices, but not programmed actions */ - 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) - { - TimeFrames = 0; - TapeTime++; - - if (!level.use_step_counter) - { - TimePlayed++; - - if (TimeLeft > 0) - { - TimeLeft--; - - if (TimeLeft <= 10 && setup.time_limit) - PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE); - - DrawGameValue_Time(TimeLeft); - - if (!TimeLeft && setup.time_limit) - level.native_em_level->lev->killed_out_of_time = TRUE; - } - else if (level.time == 0 && level.native_em_level->lev->home > 0) - DrawGameValue_Time(TimePlayed); - - level.native_em_level->lev->time = - (level.time == 0 ? TimePlayed : TimeLeft); - } - - if (tape.recording || tape.playing) - DrawVideoDisplay(VIDEO_STATE_TIME_ON, TapeTime); - } - - FrameCounter++; - TimeFrames++; - - BackToFront(); - } - else - { - if (game.restart_level) - StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE); - - if (local_player->LevelSolved) - GameWon(); - - if (AllPlayersGone && !TAPE_IS_STOPPED(tape)) - TapeStop(); - - GameActions(); - BackToFront(); - - if (tape.auto_play && !tape.playing) - AutoPlayTape(); /* continue automatically playing next tape */ - } -} - -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) - { - SendToServer_StartPlaying(); - - return; - } -#endif - - StopAnimation(); - - game_status = GAME_MODE_PLAYING; - -#if 0 - InitRND(random_seed); -#endif + GameActions(); /* main game loop */ - InitGame(); + if (tape.auto_play && !tape.playing) + AutoPlayTape(); /* continue automatically playing next tape */ } /* ---------- new screen button stuff -------------------------------------- */