From: Holger Schemel Date: Mon, 28 Jul 2003 22:46:12 +0000 (+0200) Subject: rnd-20030729-1-src X-Git-Tag: 3.0.0^2~11 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=684f9040af5b97bc73676f8f8198688d87c3ea25;p=rocksndiamonds.git rnd-20030729-1-src --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 60b7c875..2e469112 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3454,6 +3454,8 @@ struct ConfigInfo image_config[] = { "menu.draw_xoffset.SETUP", "0" }, { "menu.draw_yoffset.SETUP", "0" }, + { "menu.scrollbar_xoffset", "0" }, + { "menu.list_size", "-1" }, { "menu.list_size.LEVELS", "-1" }, { "menu.list_size.SCORES", "-1" }, diff --git a/src/conftime.h b/src/conftime.h index 0a2e5814..8fc19667 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-07-26 03:06]" +#define COMPILE_DATE_STRING "[2003-07-29 00:38]" diff --git a/src/game.c b/src/game.c index 5b22dcbd..54d67849 100644 --- a/src/game.c +++ b/src/game.c @@ -2695,7 +2695,7 @@ void Impact(int x, int y) return; } #if 1 - else if (impact && CheckElementChange(x, y, element, ACTION_IMPACT)) + else if (impact && CheckElementChange(x, y, element, CE_IMPACT)) { PlaySoundLevelElementAction(x, y, element, ACTION_IMPACT); @@ -3840,7 +3840,9 @@ void StartMoving(int x, int y) return; } +#if 0 GfxAction[x][y] = ACTION_MOVING; +#endif } /* now make next step */ @@ -5226,6 +5228,8 @@ static void ChangeElementNow(int x, int y, int element) if (!change->only_complete || complete_change) { + boolean something_has_changed = FALSE; + if (change->only_complete && change->use_random_change && RND(100) < change->random) return; @@ -5243,17 +5247,24 @@ static void ChangeElementNow(int x, int y, int element) ChangeElementNowExt(ex, ey, change->content[xx][yy]); + something_has_changed = TRUE; + /* for symmetry reasons, stop newly created border elements */ if (ex != x || ey != y) Stop[ex][ey] = TRUE; } } - return; + if (something_has_changed) + PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING); } } + else + { + ChangeElementNowExt(x, y, change->target_element); - ChangeElementNowExt(x, y, change->target_element); + PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING); + } } static void ChangeElement(int x, int y) diff --git a/src/init.c b/src/init.c index 20a84d1e..b859112c 100644 --- a/src/init.c +++ b/src/init.c @@ -998,7 +998,7 @@ static void InitSoundInfo() sound_info[i].loop = FALSE; #if 0 - printf("::: sound: '%s'\n", sound->token); + printf("::: sound %d: '%s'\n", i, sound->token); #endif /* determine all loop sounds and identify certain sound classes */ @@ -1012,9 +1012,9 @@ static void InitSoundInfo() element_action_info[j].suffix) == 0) { sound_effect_properties[i] = element_action_info[j].value; + sound_info[i].loop = element_action_info[j].is_loop_sound; - if (element_action_info[j].is_loop_sound) - sound_info[i].loop = TRUE; + break; } } diff --git a/src/libgame/image.c b/src/libgame/image.c index 4e30f4c1..3fb28c92 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -718,7 +718,7 @@ static void *Load_PCX(char *filename) { ImageInfo *img_info; -#if 0 +#if 1 printf("loading PCX file '%s'\n", filename); #endif diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 574d37e8..24e2471b 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2117,16 +2117,25 @@ void LoadArtworkInfo() /* before sorting, the first entries will be from the user directory */ artwork.gfx_current = getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set); + if (artwork.gfx_current == NULL) + artwork.gfx_current = + getTreeInfoFromIdentifier(artwork.gfx_first, GRAPHICS_SUBDIR); if (artwork.gfx_current == NULL) artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first); artwork.snd_current = getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set); + if (artwork.snd_current == NULL) + artwork.snd_current = + getTreeInfoFromIdentifier(artwork.snd_first, SOUNDS_SUBDIR); if (artwork.snd_current == NULL) artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first); artwork.mus_current = getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set); + if (artwork.mus_current == NULL) + artwork.mus_current = + getTreeInfoFromIdentifier(artwork.mus_first, MUSIC_SUBDIR); if (artwork.mus_current == NULL) artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first); @@ -2211,6 +2220,9 @@ void LoadLevelArtworkInfo() { artwork.gfx_current = getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set); + if (artwork.gfx_current == NULL) + artwork.gfx_current = + getTreeInfoFromIdentifier(artwork.gfx_first, GRAPHICS_SUBDIR); if (artwork.gfx_current == NULL) artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first); } @@ -2219,6 +2231,9 @@ void LoadLevelArtworkInfo() { artwork.snd_current = getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set); + if (artwork.snd_current == NULL) + artwork.snd_current = + getTreeInfoFromIdentifier(artwork.snd_first, SOUNDS_SUBDIR); if (artwork.snd_current == NULL) artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first); } @@ -2227,6 +2242,9 @@ void LoadLevelArtworkInfo() { artwork.mus_current = getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set); + if (artwork.mus_current == NULL) + artwork.mus_current = + getTreeInfoFromIdentifier(artwork.mus_first, MUSIC_SUBDIR); if (artwork.mus_current == NULL) artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first); } diff --git a/src/main.c b/src/main.c index 697d1b74..beec6a9b 100644 --- a/src/main.c +++ b/src/main.c @@ -2998,7 +2998,7 @@ struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] = /* element action and direction definitions */ /* ------------------------------------------------------------------------- */ -struct ElementActionInfo element_action_info[NUM_ACTIONS + 1] = +struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] = { { ".[DEFAULT]", ACTION_DEFAULT, TRUE }, { ".waiting", ACTION_WAITING, TRUE }, @@ -3077,6 +3077,8 @@ struct TokenIntPtrInfo image_config_vars[] = { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP] }, { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP] }, + { "menu.scrollbar_xoffset", &menu.scrollbar_xoffset }, + { "menu.list_size", &menu.list_size_default }, { "menu.list_size.LEVELS", &menu.list_size[GFX_SPECIAL_ARG_LEVELS] }, { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] }, diff --git a/src/main.h b/src/main.h index 8bef96cc..eb96b6d1 100644 --- a/src/main.h +++ b/src/main.h @@ -1197,6 +1197,8 @@ struct MenuInfo int draw_xoffset[NUM_SPECIAL_GFX_ARGS]; int draw_yoffset[NUM_SPECIAL_GFX_ARGS]; + int scrollbar_xoffset; + int list_size_default; int list_size[NUM_SPECIAL_GFX_ARGS]; }; diff --git a/src/screens.c b/src/screens.c index 1a239518..f2c95cec 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1193,6 +1193,10 @@ void HandleTypeName(int newxpos, Key key) static void DrawChooseTree(TreeInfo **ti_ptr) { UnmapAllGadgets(); + + FreeScreenGadgets(); + CreateScreenGadgets(); + CloseDoor(DOOR_CLOSE_2); ClearWindow(); @@ -1311,12 +1315,18 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, int step = (button == 1 ? 1 : button == 2 ? 5 : 10); int num_entries = numTreeInfoInGroup(ti); int num_page_entries; + int last_game_status = game_status; /* save current game status */ + + /* force LEVELS draw offset on choose level and artwork setup screen */ + game_status = GAME_MODE_LEVELS; if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN) num_page_entries = num_entries; else num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN; + game_status = last_game_status; /* restore current game status */ + if (button == MB_MENU_INITIALIZE) { int num_entries = numTreeInfoInGroup(ti); @@ -2839,7 +2849,7 @@ static struct #else IMG_MENU_SCROLLBAR, IMG_MENU_SCROLLBAR_ACTIVE, #endif - SX + SC_SCROLL_VERTICAL_XPOS, SY + SC_SCROLL_VERTICAL_YPOS, + SC_SCROLL_VERTICAL_XPOS, SC_SCROLL_VERTICAL_YPOS, SC_SCROLL_VERTICAL_XSIZE, SC_SCROLL_VERTICAL_YSIZE, GD_TYPE_SCROLLBAR_VERTICAL, SCREEN_CTRL_ID_SCROLL_VERTICAL, @@ -2861,16 +2871,17 @@ static void CreateScreenScrollbuttons() int gd_x1, gd_x2, gd_y1, gd_y2; int id = scrollbutton_info[i].gadget_id; - x = scrollbutton_info[i].x; - y = scrollbutton_info[i].y; - event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED; - x += SX; - y += SY; + x = mSX + scrollbutton_info[i].x + menu.scrollbar_xoffset; + y = mSY + scrollbutton_info[i].y; width = SC_SCROLLBUTTON_XSIZE; height = SC_SCROLLBUTTON_YSIZE; + if (id == SCREEN_CTRL_ID_SCROLL_DOWN) + y = mSY + (SC_SCROLL_VERTICAL_YPOS + + (NUM_MENU_ENTRIES_ON_SCREEN - 2) * SC_SCROLLBUTTON_YSIZE); + gfx_unpressed = scrollbutton_info[i].gfx_unpressed; gfx_pressed = scrollbutton_info[i].gfx_pressed; gd_bitmap_unpressed = graphic_info[gfx_unpressed].bitmap; @@ -2912,6 +2923,7 @@ static void CreateScreenScrollbars() #if !defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) int gfx_unpressed, gfx_pressed; #endif + int x, y, width, height; int gd_x1, gd_x2, gd_y1, gd_y2; struct GadgetInfo *gi; int items_max, items_visible, item_position; @@ -2919,12 +2931,20 @@ static void CreateScreenScrollbars() int num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN; int id = scrollbar_info[i].gadget_id; + event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS; + + x = mSX + scrollbar_info[i].x + menu.scrollbar_xoffset; + y = mSY + scrollbar_info[i].y; + width = scrollbar_info[i].width; + height = scrollbar_info[i].height; + + if (id == SCREEN_CTRL_ID_SCROLL_VERTICAL) + height = (NUM_MENU_ENTRIES_ON_SCREEN - 2) * SC_SCROLLBUTTON_YSIZE; + items_max = num_page_entries; items_visible = num_page_entries; item_position = 0; - event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS; - #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) gd_bitmap_unpressed = *scrollbar_info[i].gfx_unpressed; gd_bitmap_pressed = *scrollbar_info[i].gfx_pressed; @@ -2946,10 +2966,10 @@ static void CreateScreenScrollbars() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, GDI_INFO_TEXT, scrollbar_info[i].infotext, - GDI_X, scrollbar_info[i].x, - GDI_Y, scrollbar_info[i].y, - GDI_WIDTH, scrollbar_info[i].width, - GDI_HEIGHT, scrollbar_info[i].height, + GDI_X, x, + GDI_Y, y, + GDI_WIDTH, width, + GDI_HEIGHT, height, GDI_TYPE, scrollbar_info[i].type, GDI_SCROLLBAR_ITEMS_MAX, items_max, GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible, @@ -2971,6 +2991,8 @@ static void CreateScreenScrollbars() void CreateScreenGadgets() { + int last_game_status = game_status; /* save current game status */ + #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) int i; @@ -2992,8 +3014,13 @@ void CreateScreenGadgets() } #endif + /* force LEVELS draw offset for scrollbar / scrollbutton gadgets */ + game_status = GAME_MODE_LEVELS; + CreateScreenScrollbuttons(); CreateScreenScrollbars(); + + game_status = last_game_status; /* restore current game status */ } void FreeScreenGadgets()