X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=7d783a9b21a3f672e3f5c13ce5574d63db856b8a;hb=ea6e4698905d7440a265e323d03cf13fc323c44b;hp=43d02fb4bd630d60383070fd7d15266760edc38c;hpb=678dcec784272f09249c29949dc91a146246856a;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 43d02fb4..7d783a9b 100644 --- a/src/screens.c +++ b/src/screens.c @@ -115,29 +115,28 @@ static Bitmap *scrollbar_bitmap[NUM_SCROLLBAR_BITMAPS]; #endif -static void drawCursorExt(int xpos, int ypos, int color, int g) +static void drawCursorExt(int xpos, int ypos, int color, int graphic) { static int cursor_array[SCR_FIELDY]; if (xpos == 0) { - if (g != 0) - cursor_array[ypos] = g; + if (graphic != 0) + cursor_array[ypos] = graphic; else - g = cursor_array[ypos]; + graphic = cursor_array[ypos]; } if (color == FC_RED) - g = (g == IMG_MENU_BUTTON_LEFT ? IMG_MENU_BUTTON_LEFT_ACTIVE : - 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 : - IMG_MENU_BUTTON_ACTIVE); + graphic = (graphic == IMG_MENU_BUTTON_LEFT ? IMG_MENU_BUTTON_LEFT_ACTIVE : + graphic == IMG_MENU_BUTTON_RIGHT ? IMG_MENU_BUTTON_RIGHT_ACTIVE: + IMG_MENU_BUTTON_ACTIVE); ypos += MENU_SCREEN_START_YPOS; DrawBackground(mSX + xpos * TILEX, mSY + ypos * TILEY, TILEX, TILEY); - DrawGraphicThruMaskExt(drawto, mSX + xpos * TILEX, mSY + ypos * TILEY, g, 0); + DrawGraphicThruMaskExt(drawto, mSX + xpos * TILEX, mSY + ypos * TILEY, + graphic, 0); } static void initCursor(int ypos, int graphic) @@ -324,11 +323,11 @@ void DrawMainMenu() } for (i = 0; i < 8; i++) - initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_ENTER_MENU : + initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_RIGHT : IMG_MENU_BUTTON)); - drawCursorXY(level_width / 32 + 4, 1, IMG_MENU_BUTTON_LEFT); - drawCursorXY(level_width / 32 + 8, 1, IMG_MENU_BUTTON_RIGHT); + drawCursorXY(level_width/32 + 4, 1, IMG_MENU_BUTTON_LEFT); + drawCursorXY(level_width/32 + 8, 1, IMG_MENU_BUTTON_RIGHT); DrawTextSCentered(326, FONT_TITLE_2, "A Game by Artsoft Entertainment"); @@ -419,6 +418,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) if (new_level_nr > leveldir_current->last_level) new_level_nr = leveldir_current->last_level; +#if 1 if (setup.handicap && new_level_nr > leveldir_current->handicap_level) { /* skipping levels is only allowed when trying to skip single level */ @@ -431,6 +431,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) new_level_nr = leveldir_current->handicap_level; } +#else + if (setup.handicap && new_level_nr > leveldir_current->handicap_level) + new_level_nr = leveldir_current->handicap_level; +#endif if (new_level_nr != old_level_nr) { @@ -507,20 +511,30 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } else if (y == 5) { - StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE); + if (setup.autorecord) + TapeStartRecording(); + +#if defined(NETWORK_AVALIABLE) + if (options.network) + SendToServer_StartPlaying(); + else +#endif + { + game_status = GAME_MODE_PLAYING; + StopAnimation(); + InitGame(); + } } else if (y == 6) { game_status = GAME_MODE_SETUP; setup_mode = SETUP_MODE_MAIN; - DrawSetupScreen(); } else if (y == 7) { SaveLevelSetup_LastSeries(); SaveLevelSetup_SeriesInfo(); - if (Request("Do you really want to quit ?", REQ_ASK | REQ_STAY_CLOSED)) game_status = GAME_MODE_QUIT; } @@ -613,9 +627,9 @@ static void DrawInfoScreen_Main() DrawText(mSX + 32, mSY + ypos * 32, info_info[i].text, font_nr); if (info_info[i].type & TYPE_ENTER_MENU) - initCursor(i, IMG_MENU_BUTTON_ENTER_MENU); + initCursor(i, IMG_MENU_BUTTON_RIGHT); else if (info_info[i].type & TYPE_LEAVE_MENU) - initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU); + initCursor(i, IMG_MENU_BUTTON_LEFT); else if (info_info[i].type & ~TYPE_SKIP_ENTRY) initCursor(i, IMG_MENU_BUTTON); @@ -732,6 +746,7 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init) for (i = 0; i < MAX_INFO_ELEMENTS_ON_SCREEN; i++) infoscreen_step[i] = infoscreen_frame[i] = 0; + SetMainBackgroundImage(IMG_BACKGROUND_INFO); ClearWindow(); DrawHeadline(); @@ -839,7 +854,11 @@ static char *getHelpText(int element, int action, int direction) void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) { +#if 0 + int font_nr = FONT_TEXT_2; +#else int font_nr = FONT_LEVEL_NUMBER; +#endif int font_width = getFontWidth(font_nr); int sx = mSX + MINI_TILEX + TILEX + MINI_TILEX; int sy = mSY + 65 + 2 * 32 + 1; @@ -873,8 +892,6 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) void DrawInfoScreen_Elements() { - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_ELEMENTS); - LoadHelpAnimInfo(); LoadHelpTextInfo(); @@ -950,8 +967,6 @@ void HandleInfoScreen_Elements(int button) void DrawInfoScreen_Music() { - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_MUSIC); - ClearWindow(); DrawHeadline(); @@ -1084,8 +1099,6 @@ void DrawInfoScreen_Credits() int ystart = 150, ystep = 30; int ybottom = SYSIZE - 20; - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_CREDITS); - FadeSoundsAndMusic(); ClearWindow(); @@ -1134,8 +1147,6 @@ void DrawInfoScreen_Program() int ystart = 150, ystep = 30; int ybottom = SYSIZE - 20; - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_PROGRAM); - ClearWindow(); DrawHeadline(); @@ -1199,7 +1210,11 @@ void DrawInfoScreen_LevelSet() int ystart = 150; int ybottom = SYSIZE - 20; char *filename = getLevelSetInfoFilename(); +#if 0 + int font_nr = FONT_TEXT_2; +#else int font_nr = FONT_LEVEL_NUMBER; +#endif int font_width = getFontWidth(font_nr); int font_height = getFontHeight(font_nr); int pad_x = 32; @@ -1209,8 +1224,6 @@ void DrawInfoScreen_LevelSet() int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width; int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1; - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET); - ClearWindow(); DrawHeadline(); @@ -1436,9 +1449,9 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, DrawText(mSX + 32, mSY + ypos * 32, buffer, FONT_TEXT_1 + node->color); if (node->parent_link) - initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU); + initCursor(i, IMG_MENU_BUTTON_LEFT); else if (node->level_group) - initCursor(i, IMG_MENU_BUTTON_ENTER_MENU); + initCursor(i, IMG_MENU_BUTTON_RIGHT); else initCursor(i, IMG_MENU_BUTTON); } @@ -2220,15 +2233,21 @@ static void DrawSetupScreen_Generic() (value_ptr == &setup.fullscreen && !video.fullscreen_available)) setup_info[i].type |= TYPE_GHOSTED; +#if 0 + if (setup_info[i].type & TYPE_STRING || + (setup_info[i].type & TYPE_SWITCH && setup_mode == SETUP_MODE_EDITOR)) + 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); if (setup_info[i].type & TYPE_ENTER_MENU) - initCursor(i, IMG_MENU_BUTTON_ENTER_MENU); + initCursor(i, IMG_MENU_BUTTON_RIGHT); else if (setup_info[i].type & TYPE_LEAVE_MENU) - initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU); + initCursor(i, IMG_MENU_BUTTON_LEFT); else if (setup_info[i].type & ~TYPE_SKIP_ENTRY) initCursor(i, IMG_MENU_BUTTON); @@ -2340,10 +2359,10 @@ void DrawSetupScreen_Input() DrawText(mSX+16, mSY+16, "Setup Input", FONT_TITLE_1); - initCursor(0, IMG_MENU_BUTTON); - initCursor(1, IMG_MENU_BUTTON); - initCursor(2, IMG_MENU_BUTTON_ENTER_MENU); - initCursor(13, IMG_MENU_BUTTON_LEAVE_MENU); + initCursor(0, IMG_MENU_BUTTON); + initCursor(1, IMG_MENU_BUTTON); + initCursor(2, IMG_MENU_BUTTON_RIGHT); + initCursor(13, IMG_MENU_BUTTON_LEFT); drawCursorXY(10, 0, IMG_MENU_BUTTON_LEFT); drawCursorXY(12, 0, IMG_MENU_BUTTON_RIGHT); @@ -2412,11 +2431,14 @@ static void drawPlayerSetupInputInfo(int player_nr) custom_key = setup.input[player_nr].key; DrawText(mSX+11*32, mSY+2*32, int2str(player_nr +1, 1), FONT_INPUT_1_ACTIVE); - +#if 1 ClearRectangleOnBackground(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY, TILEX, TILEY); DrawGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY, PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0); +#else + DrawGraphicThruMask(8, 2, PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0); +#endif if (setup.input[player_nr].use_joystick) { @@ -3060,9 +3082,6 @@ void HandleGameActions() } else { - if (game.restart_level) - StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE); - if (local_player->LevelSolved) GameWon(); @@ -3077,30 +3096,6 @@ void HandleGameActions() } } -void StartGameActions(boolean init_network_game, boolean record_tape, - long random_seed) -{ - if (record_tape) - TapeStartRecording(random_seed); - -#if defined(NETWORK_AVALIABLE) - if (init_network_game) - { - SendToServer_StartPlaying(); - - return; - } -#endif - - StopAnimation(); - - game_status = GAME_MODE_PLAYING; - - InitRND(random_seed); - - InitGame(); -} - /* ---------- new screen button stuff -------------------------------------- */ /* graphic position and size values for buttons and scrollbars */