예제 #1
0
    bool makeRoomSilentlyFail( Level & level, uint32_t & gen, OcclusionBuffer& occ ) {
        uint32_t x( nextRandomGenerator_( gen ) % TILE_DIM );
        uint32_t y( nextRandomGenerator_( gen ) % TILE_DIM );
        uint32_t w( (nextRandomGenerator_( gen ) % RESTWIDMAX) + WIDMIN );
        uint32_t h( (nextRandomGenerator_( gen ) % RESTWIDMAX) + WIDMIN );

        if( (x+w) < TILE_DIM-1 && (y+h) < TILE_DIM-1 && x != 0 && y != 0 &&
            !isCollision( x, y, w, h, occ ) ) {
                occ.Occlude(x, y, x+w, y+h);
                level.rooms.emplace_back(x, y, w, h, (uint32_t)(level.rooms.size() + 1));
                return true;
        }
        return false;
    }
예제 #2
0
    void makeRoomSilentlyFail( Level & level )
    {
        uint32_t r1 = nextRandomGenerator_();
        uint32_t r2 = nextRandomGenerator_();
        uint32_t x( r1 % TILE_DIM );
        uint32_t y( r2 % TILE_DIM );
        uint32_t w( (r1 % MAXWID) + MIW );
        uint32_t h( (r2 % MAXWID) + MIW );

        if( (x+w) >= TILE_DIM || (y+h) >= TILE_DIM || x == 0 || y == 0 ) return;

        if( !isCollision( level.rooms, x, y, w, h ) )
        {
            Room r( x, y, w, h, level.rooms.size() + 1 );
            level.rooms.push_back( r );
        }
    }