X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=74412c3a5ec8deae3770480477e17b662c853cd6;hb=000f4fbffe0d915d1ded9c981a5a2d521cdf7e5e;hp=e7670d2756048c6e5a0185160197c63f9171fe50;hpb=462bca0782be497b984922afda26b5bf12bd3d75;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index e7670d27..74412c3a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -710,6 +710,39 @@ void SetBorderElement() } } +void FloodFillLevel(int from_x, int from_y, int fill_element, + short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY], + int max_fieldx, int max_fieldy) +{ + int i,x,y; + int old_element; + static int check[4][2] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 } }; + static int safety = 0; + + /* check if starting field still has the desired content */ + if (field[from_x][from_y] == fill_element) + return; + + safety++; + + if (safety > max_fieldx * max_fieldy) + Error(ERR_EXIT, "Something went wrong in 'FloodFill()'. Please debug."); + + old_element = field[from_x][from_y]; + field[from_x][from_y] = fill_element; + + for (i = 0; i < 4; i++) + { + x = from_x + check[i][0]; + y = from_y + check[i][1]; + + if (IN_FIELD(x, y, max_fieldx, max_fieldy) && field[x][y] == old_element) + FloodFillLevel(x, y, fill_element, field, max_fieldx, max_fieldy); + } + + safety--; +} + void SetRandomAnimationValue(int x, int y) { gfx.anim_random_frame = GfxRandom[x][y]; @@ -6201,12 +6234,16 @@ void PlayMenuMusic() void PlaySoundActivating() { +#if 0 PlaySound(SND_MENU_ITEM_ACTIVATING); +#endif } void PlaySoundSelecting() { +#if 0 PlaySound(SND_MENU_ITEM_SELECTING); +#endif } void ToggleFullscreenIfNeeded()