void steny()
{
    int f, x, x1, y, y1, px30, py30, lim;
    stena_closed_vol = 0;
    stena_moving_vol = 0;
    stena_blocked_vol = 0;

    for (f = gamedata.pocet.hlimit_kvadru; f < gamedata.pocet.hlimit_nonstatic; f++) if (obj[f].type == STENA)
    {
        if (obj[f].clip && obj[f].status == VYSOUVASE && obj[f].status_old == ZASUNUTA)
        {
            obj[f].clip = false;
            obj[f].status = obj[f].status_old;
        }
        if ((obj[f].status == VYSUNUTA) && (obj[f].clip))
        {
            obj[f].clip = false;
            obj[f].status = ZASOUVASE;
            obj[f].status_old = VYSUNUTA;
        }
        else if ((obj[f].status == ZASUNUTA) && (obj[f].clip))
        {
            obj[f].clip = false;
            obj[f].status = VYSOUVASE;
            obj[f].status_old = ZASUNUTA;
        }
        switch (obj[f].subtype)
        {
            case ZAS_VLEVO:
                if (obj[f].status == ZASOUVASE)
                {
                    if (obj[f].anim.frame_rect.left%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30.x <= obj[f].pozice.x/30) obj[f].b1 = true;
                        else
                        {
                            if (je_tam_misto_pro_stenu(obj[f].index30.x - 1, obj[f].index30.y, obj[f].index30.x - 1, obj[f].index30_old.y)) obj[f].b1 = true;
                            else 
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, ((lim = obj[f].pozice.x - obj[f].anim.frame_rect.left + obj[f].flag2 * 30) > obj[f].pozice.x)?lim:obj[f].pozice.x, obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.left - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        if (obj[f].anim.frame_rect.left < obj[f].anim.frame_rect.right - obj[f].flag1*30)
                        {
                            if ((obj[f].anim.frame_rect.left++)%30 == 0)
                            {
                                x  = --obj[f].index30.x;
                                x1 = --obj[f].index30_old.x + 1;
                                if (x < (px30 = obj[f].pozice.x/30)) x = px30;
                                if (x1 < x) del_stena_indexes(f);
                                else set_stena_indexes(f, x, obj[f].index30.y, x1, obj[f].index30_old.y);
                            }
                            set_rect(obj[f].stena, ((lim = obj[f].pozice.x - obj[f].anim.frame_rect.left + obj[f].flag2 * 30) > obj[f].pozice.x)?lim:obj[f].pozice.x, obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.left - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                        else
                        {
                            obj[f].status = ZASUNUTA;
                            x  = obj[f].index30.x;
                            x1 = obj[f].index30_old.x;
                            if (x < (px30 = obj[f].pozice.x/30)) x = px30;
                            if (x1 < x) del_stena_indexes(f);
                            else set_stena_indexes(f, x, obj[f].index30.y, x1, obj[f].index30_old.y);
                            obj[f].b2 = true;
                            set_rect(obj[f].stena, ((lim = obj[f].pozice.x - obj[f].anim.frame_rect.left + obj[f].flag2 * 30) > obj[f].pozice.x)?lim:obj[f].pozice.x, obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.left - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                    }
                }
                else if (obj[f].status == VYSOUVASE)
                {
                    if (obj[f].anim.frame_rect.left%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30_old.x == (obj[f].pozice.x + obj[f].dimension.x)/30-1) obj[f].b1 = true;
                        else
                        {
                            if (je_tam_misto_pro_stenu(obj[f].index30_old.x + 1, obj[f].index30.y, obj[f].index30_old.x + 1, obj[f].index30_old.y)) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, ((lim = obj[f].pozice.x - obj[f].anim.frame_rect.left + obj[f].flag2 * 30) > obj[f].pozice.x)?lim:obj[f].pozice.x, obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.left - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        obj[f].status_old = VYSOUVASE;
                        if (obj[f].anim.frame_rect.left > obj[f].anim.frame_rect.right - obj[f].dimension.x)
                        {
                            if ((obj[f].anim.frame_rect.left--)%30 == 0)
                            {
                                x  = ++obj[f].index30.x - 1;
                                x1 = ++obj[f].index30_old.x;
                                if (x < (px30 = obj[f].pozice.x/30)) x = px30;
                                if (!(x1 < x)) set_stena_indexes(f, x, obj[f].index30.y, x1, obj[f].index30_old.y);
                            }
                            set_rect(obj[f].stena, ((lim = obj[f].pozice.x - obj[f].anim.frame_rect.left + obj[f].flag2 * 30) > obj[f].pozice.x)?lim:obj[f].pozice.x, obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.left - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                        else
                        {
                            obj[f].status = VYSUNUTA;
                            set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                            obj[f].b2 = true;
                            if ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_closed_vol) stena_closed_vol = g_volume_vzd;
                            set_rect(obj[f].stena, ((lim = obj[f].pozice.x - obj[f].anim.frame_rect.left + obj[f].flag2 * 30) > obj[f].pozice.x)?lim:obj[f].pozice.x, obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.left - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                    }
                }
                break;
            case ZAS_VPRAVO:
                if (obj[f].status == ZASOUVASE)
                {
                    if (obj[f].anim.frame_rect.right%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30_old.x >= (obj[f].pozice.x + obj[f].dimension.x)/30-1) obj[f].b1 = true;
                        else
                        {
                            if (je_tam_misto_pro_stenu(obj[f].index30_old.x + 1, obj[f].index30.y, obj[f].index30_old.x + 1, obj[f].index30_old.y)) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.right, obj[f].pozice.y, ((lim = obj[f].pozice.x + obj[f].dimension.x*2 - obj[f].anim.frame_rect.right - obj[f].flag2 * 30 - 1) < obj[f].pozice.x + obj[f].dimension.x)?lim:obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        if (obj[f].anim.frame_rect.right > obj[f].anim.frame_rect.left + obj[f].flag1*30)
                        {
                            if ((obj[f].anim.frame_rect.right--)%30 == 0)
                            {
                                x  = ++obj[f].index30.x - 1;
                                x1 = ++obj[f].index30_old.x;
                                if (x1 > (px30 = (obj[f].pozice.x + obj[f].dimension.x)/30-1)) x1 = px30;
                                if (x > x1) del_stena_indexes(f);
                                else set_stena_indexes(f, x, obj[f].index30.y, x1, obj[f].index30_old.y);
                            }
                            set_rect(obj[f].stena, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.right, obj[f].pozice.y, ((lim = obj[f].pozice.x + obj[f].dimension.x*2 - obj[f].anim.frame_rect.right - obj[f].flag2 * 30 - 1) < obj[f].pozice.x + obj[f].dimension.x)?lim:obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                        else
                        {
                            obj[f].status = ZASUNUTA;
                            x  = obj[f].index30.x;
                            x1 = obj[f].index30_old.x;
                            if (x1 > (px30 = (obj[f].pozice.x + obj[f].dimension.x)/30-1)) x1 = px30;
                            if (x > x1) del_stena_indexes(f);
                            else set_stena_indexes(f, x, obj[f].index30.y, x1, obj[f].index30_old.y);
                            obj[f].b2 = true;
                            set_rect(obj[f].stena, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.right, obj[f].pozice.y, ((lim = obj[f].pozice.x + obj[f].dimension.x*2 - obj[f].anim.frame_rect.right - obj[f].flag2 * 30 - 1) < obj[f].pozice.x + obj[f].dimension.x)?lim:obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                    }
                }
                else if (obj[f].status == VYSOUVASE)
                {
                    if (obj[f].anim.frame_rect.right%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30.x == obj[f].pozice.x/30) obj[f].b1 = true;
                        else
                        {
                            if (je_tam_misto_pro_stenu(obj[f].index30.x - 1, obj[f].index30.y, obj[f].index30.x - 1, obj[f].index30_old.y)) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.right, obj[f].pozice.y, ((lim = obj[f].pozice.x + obj[f].dimension.x*2 - obj[f].anim.frame_rect.right - obj[f].flag2 * 30 - 1) < obj[f].pozice.x + obj[f].dimension.x)?lim:obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        obj[f].status_old = VYSOUVASE;
                        if (obj[f].anim.frame_rect.right < obj[f].anim.frame_rect.left + obj[f].dimension.x)
                        {
                            if ((obj[f].anim.frame_rect.right++)%30 == 0)
                            {
                                x  = --obj[f].index30.x;
                                x1 = --obj[f].index30_old.x + 1;
                                if (x1 > (px30 = (obj[f].pozice.x + obj[f].dimension.x)/30-1)) x1 = px30;
                                if (x > x1) del_stena_indexes(f);
                                else set_stena_indexes(f, x, obj[f].index30.y, x1, obj[f].index30_old.y);
                            }
                            set_rect(obj[f].stena, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.right, obj[f].pozice.y, ((lim = obj[f].pozice.x + obj[f].dimension.x*2 - obj[f].anim.frame_rect.right - obj[f].flag2 * 30 - 1) < obj[f].pozice.x + obj[f].dimension.x)?lim:obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                        else
                        {
                            obj[f].status = VYSUNUTA;
                            set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                            obj[f].b2 = true;
                            if ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_closed_vol) stena_closed_vol = g_volume_vzd;
                            set_rect(obj[f].stena, obj[f].pozice.x + obj[f].dimension.x - obj[f].anim.frame_rect.right, obj[f].pozice.y, ((lim = obj[f].pozice.x + obj[f].dimension.x*2 - obj[f].anim.frame_rect.right - obj[f].flag2 * 30 - 1) < obj[f].pozice.x + obj[f].dimension.x)?lim:obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                    }
                }
                break;
            case ZAS_NAHORU:
                if (obj[f].status == ZASOUVASE)
                {
                    if (obj[f].anim.frame_rect.top%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30.y <= obj[f].pozice.y/30) obj[f].b1 = true;
                        else
                        {
                            if (je_tam_misto_pro_stenu(obj[f].index30.x, obj[f].index30.y - 1, obj[f].index30_old.x, obj[f].index30.y - 1)) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x, ((lim = obj[f].pozice.y - obj[f].anim.frame_rect.top + obj[f].flag2 * 30) > obj[f].pozice.y)?lim:obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.top - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        if (obj[f].anim.frame_rect.top < obj[f].anim.frame_rect.bottom - obj[f].flag1*30)
                        {
                            if ((obj[f].anim.frame_rect.top++)%30 == 0)
                            {
                                y  = --obj[f].index30.y;
                                y1 = --obj[f].index30_old.y + 1;
                                if (y < (py30 = obj[f].pozice.y/30)) y = py30;
                                if (y1 < y) del_stena_indexes(f);
                                else set_stena_indexes(f, obj[f].index30.x, y, obj[f].index30_old.x, y1);
                            }
                            set_rect(obj[f].stena, obj[f].pozice.x, ((lim = obj[f].pozice.y - obj[f].anim.frame_rect.top + obj[f].flag2 * 30) > obj[f].pozice.y)?lim:obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.top - 1);
                        }
                        else
                        {
                            obj[f].status = ZASUNUTA;
                            y  = obj[f].index30.y;
                            y1 = obj[f].index30_old.y;
                            if (y < (py30 = obj[f].pozice.y/30)) y = py30;
                            if (y1 < y) del_stena_indexes(f);
                            else set_stena_indexes(f, obj[f].index30.x, y, obj[f].index30_old.x, y1);
                            obj[f].b2 = true;
                            set_rect(obj[f].stena, obj[f].pozice.x, ((lim = obj[f].pozice.y - obj[f].anim.frame_rect.top + obj[f].flag2 * 30) > obj[f].pozice.y)?lim:obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.top - 1);
                        }
                    }
                }
                else if (obj[f].status == VYSOUVASE)
                {
                    if (obj[f].anim.frame_rect.top%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30_old.y == (obj[f].pozice.y + obj[f].dimension.y)/30-1) obj[f].b1 = true;
                        else
                        {
                            if ((je_tam_misto_pro_stenu(obj[f].index30.x, obj[f].index30_old.y + 1, obj[f].index30_old.x, obj[f].index30_old.y + 1)) 
                                && (je_svisla_stena_nezatizena(obj[f].index30.x, (obj[f].index30.y <= obj[f].pozice.y/30)?obj[f].pozice.y/30:obj[f].index30.y - 1, obj[f].index30_old.x, obj[f].index30.y - 1, f))) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x, ((lim = obj[f].pozice.y - obj[f].anim.frame_rect.top + obj[f].flag2 * 30) > obj[f].pozice.y)?lim:obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.top - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        obj[f].status_old = VYSOUVASE;
                        if (obj[f].anim.frame_rect.top > obj[f].anim.frame_rect.bottom - obj[f].dimension.y)
                        {
                            if ((obj[f].anim.frame_rect.top--)%30 == 0)
                            {
                                y  = ++obj[f].index30.y - 1;
                                y1 = ++obj[f].index30_old.y;
                                if (y < (py30 = obj[f].pozice.y/30)) y = py30;
                                if (!(y1 < y)) set_stena_indexes(f, obj[f].index30.x, y, obj[f].index30_old.x, y1);
                            }
                            set_rect(obj[f].stena, obj[f].pozice.x, ((lim = obj[f].pozice.y - obj[f].anim.frame_rect.top + obj[f].flag2 * 30) > obj[f].pozice.y)?lim:obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.top - 1);
                        }
                        else
                        {
                            obj[f].status = VYSUNUTA;
                            set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                            obj[f].b2 = true;
                            if ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_closed_vol) stena_closed_vol = g_volume_vzd;
                            set_rect(obj[f].stena, obj[f].pozice.x, ((lim = obj[f].pozice.y - obj[f].anim.frame_rect.top + obj[f].flag2 * 30) > obj[f].pozice.y)?lim:obj[f].pozice.y, obj[f].pozice.x + obj[f].dimension.x - 1, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.top - 1);
                        }
                    }
                }
                break;
            case ZAS_DOLU:
                if (obj[f].status == ZASOUVASE)
                {
                    if (obj[f].anim.frame_rect.bottom%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30_old.y >= (obj[f].pozice.y + obj[f].dimension.y)/30-1)
                        {
                            if (je_svisla_stena_nezatizena(obj[f].index30.x, obj[f].index30.y - 1, obj[f].index30_old.x, obj[f].index30.y - 1, f)) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        else
                        {
                            if ((je_tam_misto_pro_stenu(obj[f].index30.x, obj[f].index30_old.y + 1, obj[f].index30_old.x, obj[f].index30_old.y + 1)) 
                                && (je_svisla_stena_nezatizena(obj[f].index30.x, obj[f].index30.y - 1, obj[f].index30_old.x, obj[f].index30.y - 1, f))) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        if (obj[f].anim.frame_rect.bottom > obj[f].anim.frame_rect.top + obj[f].flag1*30)
                        {
                            if ((obj[f].anim.frame_rect.bottom--)%30 == 0)
                            {
                                y  = ++obj[f].index30.y - 1;
                                y1 = ++obj[f].index30_old.y;
                                if (y1 > (py30 = (obj[f].pozice.y + obj[f].dimension.y)/30-1)) y1 = py30;
                                if (y > y1) del_stena_indexes(f);
                                else set_stena_indexes(f, obj[f].index30.x, y, obj[f].index30_old.x, y1);
                            }
                            set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                        else
                        {
                            obj[f].status = ZASUNUTA;
                            y  = obj[f].index30.y;
                            y1 = obj[f].index30_old.y;
                            if (y1 > (py30 = (obj[f].pozice.y + obj[f].dimension.y)/30-1)) y1 = py30;
                            if (y > y1) del_stena_indexes(f);
                            else set_stena_indexes(f, obj[f].index30.x, y, obj[f].index30_old.x, y1);
                            obj[f].b2 = true;
                            set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                    }
                }
                else if (obj[f].status == VYSOUVASE)
                {
                    if (obj[f].anim.frame_rect.bottom%30 == 0)
                    {
                        obj[f].b1 = false;
                        if (obj[f].index30.y == obj[f].pozice.y/30) obj[f].b1 = true;
                        else
                        {
                            if (je_tam_misto_pro_stenu(obj[f].index30.x, obj[f].index30.y - 1, obj[f].index30_old.x, obj[f].index30.y - 1)) obj[f].b1 = true;
                            else
                            {
                                set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                                if ((!obj[f].b2) && ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_blocked_vol)) stena_blocked_vol = g_volume_vzd;
                                set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                            }
                        }
                        obj[f].b2 = !obj[f].b1;
                    }
                    if (obj[f].b1)
                    {
                        obj[f].status_old = VYSOUVASE;
                        if (obj[f].anim.frame_rect.bottom < obj[f].anim.frame_rect.top + obj[f].dimension.y)
                        {
                            if ((obj[f].anim.frame_rect.bottom++)%30 == 0)
                            {
                                y  = --obj[f].index30.y;
                                y1 = --obj[f].index30_old.y + 1;
                                if (y1 > (py30 = (obj[f].pozice.y + obj[f].dimension.y)/30-1)) y1 = py30;
                                if (y > y1) del_stena_indexes(f);
                                else set_stena_indexes(f, obj[f].index30.x, y, obj[f].index30_old.x, y1);
                            }
                            set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                        else
                        {
                            obj[f].status = VYSUNUTA;
                            set_stena_indexes(f, obj[f].index30.x, obj[f].index30.y, obj[f].index30_old.x, obj[f].index30_old.y);
                            obj[f].b2 = true;
                            if ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_closed_vol) stena_closed_vol = g_volume_vzd;
                            set_rect(obj[f].stena, obj[f].pozice.x, obj[f].pozice.y + obj[f].dimension.y - obj[f].anim.frame_rect.bottom, obj[f].pozice.x + obj[f].dimension.x - 1, ((lim = obj[f].pozice.y + obj[f].dimension.y*2 - obj[f].anim.frame_rect.bottom - obj[f].flag2 * 30 - 1) < obj[f].pozice.y + obj[f].dimension.y)?lim:obj[f].pozice.y + obj[f].dimension.y - 1);
                        }
                    }
                }
                break;
        }
        if ((obj[f].status == VYSOUVASE || obj[f].status == ZASOUVASE) && obj[f].b1)
        {
            if ((g_volume_vzd = sam_vol_vzdalenostni(obj[f].index30.x, obj[f].index30.y, 1.3f)) > stena_moving_vol) stena_moving_vol = g_volume_vzd;
        }
    }
    if (stena_closed_vol  > 0) play_sample(2, stena_closed_vol);
    if (stena_blocked_vol > 0) play_sample(2, stena_blocked_vol);
    if (stena_moving_vol  > 0) set_playing_stena_moving_sound(stena_moving_vol);
    else
    {
        if (!stena_moving_sound_fade_out) stena_moving_sound_fade_out = true;
        mute_stena_moving_sound();
    }
}