X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=7a7fe1afcc03e553080458d7787057bf822890cc;hb=b640b9d7647df4cbba0e530f6f4bcece384048e4;hp=5b207805d1ee1647919aae723d91d6954660a35f;hpb=fa628a204ea4662806244b0ed994a48b40ece2ca;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 5b207805..7a7fe1af 100644 --- a/src/screens.c +++ b/src/screens.c @@ -61,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 @@ -135,6 +136,8 @@ static void drawCursorExt(int xpos, int ypos, int color, int g) g == IMG_MENU_BUTTON_RIGHT ? IMG_MENU_BUTTON_RIGHT_ACTIVE : g == IMG_MENU_BUTTON_LEAVE_MENU ? IMG_MENU_BUTTON_LEAVE_MENU_ACTIVE : g == IMG_MENU_BUTTON_ENTER_MENU ? IMG_MENU_BUTTON_ENTER_MENU_ACTIVE : + g == IMG_MENU_BUTTON_LAST_LEVEL ? IMG_MENU_BUTTON_LAST_LEVEL_ACTIVE : + g == IMG_MENU_BUTTON_NEXT_LEVEL ? IMG_MENU_BUTTON_NEXT_LEVEL_ACTIVE : IMG_MENU_BUTTON_ACTIVE); ypos += MENU_SCREEN_START_YPOS; @@ -234,6 +237,26 @@ static void ToggleFullscreenIfNeeded() } } +static int getLastLevelButtonPos() +{ + return 10; +} + +static int getCurrentLevelTextPos() +{ + return (getLastLevelButtonPos() + 1); +} + +static int getNextLevelButtonPos() +{ + return getLastLevelButtonPos() + 3 + 1; +} + +static int getLevelRangeTextPos() +{ + return getNextLevelButtonPos() + 1; +} + void DrawMainMenu() { static LevelDirTree *leveldir_last_valid = NULL; @@ -314,20 +337,30 @@ void DrawMainMenu() /* calculated after (possible) reload of custom artwork */ name_width = getTextWidth(name_text, FONT_MENU_1); +#if 1 + level_width = 9 * 32; +#else #if 1 level_width = 9 * getFontWidth(FONT_MENU_1); #else level_width = getTextWidth(level_text, FONT_MENU_1); +#endif #endif DrawText(mSX + 32 + name_width, mSY + 2 * 32, setup.player_name, FONT_INPUT_1); + +#if 1 + DrawText(mSX + getCurrentLevelTextPos() * 32, mSY + 3 * 32, + int2str(level_nr, 3), FONT_VALUE_1); +#else #if 1 DrawText(mSX + level_width + 2 * 32, mSY + 3 * 32, int2str(level_nr, 3), FONT_VALUE_1); #else DrawText(mSX + level_width + 5 * 32, mSY + 3 * 32, int2str(level_nr, 3), FONT_VALUE_1); +#endif #endif DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE); @@ -337,12 +370,17 @@ void DrawMainMenu() #if 1 { int text_height = getFontHeight(FONT_TEXT_3); +#if 1 + int xpos = getLevelRangeTextPos() * 32; +#else + int xpos = level_width + 6 * 32; +#endif int ypos2 = -SY + 3 * 32 + 16; int ypos1 = ypos2 - text_height; - DrawTextF(mSX + level_width + 6 * 32, mSY + ypos1, FONT_TEXT_3, + DrawTextF(mSX + xpos, mSY + ypos1, FONT_TEXT_3, "%03d", leveldir_current->first_level); - DrawTextF(mSX + level_width + 6 * 32, mSY + ypos2, FONT_TEXT_3, + DrawTextF(mSX + xpos, mSY + ypos2, FONT_TEXT_3, "%03d", leveldir_current->last_level); } #else @@ -369,12 +407,17 @@ void DrawMainMenu() initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_ENTER_MENU : IMG_MENU_BUTTON)); +#if 1 + drawCursorXY(getLastLevelButtonPos(), 1, IMG_MENU_BUTTON_LAST_LEVEL); + drawCursorXY(getNextLevelButtonPos(), 1, IMG_MENU_BUTTON_NEXT_LEVEL); +#else #if 1 drawCursorXY(level_width / 32 + 1, 1, IMG_MENU_BUTTON_LEFT); drawCursorXY(level_width / 32 + 5, 1, IMG_MENU_BUTTON_RIGHT); #else drawCursorXY(level_width / 32 + 4, 1, IMG_MENU_BUTTON_LEFT); drawCursorXY(level_width / 32 + 8, 1, IMG_MENU_BUTTON_RIGHT); +#endif #endif DrawTextSCentered(326, FONT_TITLE_2, "A Game by Artsoft Entertainment"); @@ -2051,6 +2094,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:" }, @@ -2063,12 +2107,6 @@ 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, "Boulder Dash:" }, { TYPE_SWITCH, &setup.editor.el_emerald_mine, "Emerald Mine:" }, { TYPE_SWITCH, &setup.editor.el_emerald_mine_club, "Emerald Mine Club:" }, @@ -2077,7 +2115,6 @@ static struct TokenInfo setup_info_editor[] = { TYPE_SWITCH, &setup.editor.el_supaplex, "Supaplex:" }, { TYPE_SWITCH, &setup.editor.el_diamond_caves, "Diamond Caves II:" }, { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX-Boulderdash:" }, -#endif { TYPE_SWITCH, &setup.editor.el_chars, "Text Characters:" }, { TYPE_SWITCH, &setup.editor.el_custom, "Custom & Group Elements:" }, { TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" }, @@ -2093,14 +2130,15 @@ static struct TokenInfo setup_info_graphics[] = { { 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.soft_scrolling, "Soft Scrolling:" }, { TYPE_SWITCH, &setup.double_buffering,"Double-Buffering:" }, { TYPE_SWITCH, &setup.fading, "Fading:" }, #endif { TYPE_SWITCH, &setup.quick_switch, "Quick Player Focus Switch:" }, { TYPE_SWITCH, &setup.quick_doors, "Quick Menu Doors:" }, { TYPE_SWITCH, &setup.toons, "Toons:" }, + { TYPE_ECS_AGA, &setup.prefer_aga_graphics,"EMC graphics preference:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -2230,10 +2268,11 @@ static void drawSetupValue(int pos) int xpos = MENU_SCREEN_VALUE_XPOS; int ypos = MENU_SCREEN_START_YPOS + pos; int font_nr = FONT_VALUE_1; + int font_width = getFontWidth(font_nr); 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; @@ -2262,13 +2301,28 @@ static void drawSetupValue(int pos) if (strlen(value_string) > max_value_len) value_string[max_value_len] = '\0'; } + else if (type & TYPE_ECS_AGA) + { + font_nr = FONT_VALUE_1; + } else if (type & TYPE_BOOLEAN_STYLE) { font_nr = (*(boolean *)value ? FONT_OPTION_ON : FONT_OPTION_OFF); } +#if 1 + for (i = 0; i <= MENU_SCREEN_MAX_XPOS - xpos; i++) + DrawText(mSX + xpos * 32 + i * font_width, mSY + ypos * 32, " ", font_nr); +#else +#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 +#endif + DrawText(mSX + xpos * 32, mSY + ypos * 32, value_string, font_nr); } @@ -2369,6 +2423,7 @@ static void DrawSetupScreen_Generic() if (setup_info[i].type & (TYPE_SWITCH | TYPE_YES_NO | TYPE_STRING | + TYPE_ECS_AGA | TYPE_KEYTEXT)) font_nr = FONT_MENU_2; #else @@ -3131,223 +3186,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 -------------------------------------- */