<s> class Bakery : <EOL> """<STR_LIT>""" <EOL> def hasTile ( self , xStart , yStart , tileSize ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def getTile ( self , xStart , yStart , tileSize ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def asyncGetTile ( self , xStart , yStart , tileSize , callback , callbackParams = ( ) ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> class FixedBakery : <EOL> """<STR_LIT>""" <EOL> def hasTile ( self , x , y ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def getTile ( self , x , y ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def asyncGetTile ( self , x , y , callback , callbackParams = ( ) ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> class Wrapped ( FixedBakery ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , bakery , processTile = None ) : <EOL> self . bakery = bakery <EOL> if processTile : self . processTile = processTile <EOL> def hasTile ( self , * args , ** kargs ) : <EOL> return self . bakery . hasTile ( * args , ** kargs ) <EOL> def getTile ( self , * args , ** kargs ) : <EOL> return self . processTile ( self . bakery . getTile ( * args , ** kargs ) ) <EOL> def asyncGetTile ( self , x , y , callback , callbackParams = ( ) ) : <EOL> self . bakery . asyncGetTile ( x , y , self . _asyncTileDone , ( callback , callbackParams ) ) <EOL> def _asyncTileDone ( self , tile , callback , callbackParams ) : <EOL> callback ( self . processTile ( tile ) , * callbackParams ) <EOL> class FixWrapped ( FixedBakery ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , bakery , tileSize , orginX = <NUM_LIT:0> , orginY = <NUM_LIT:0> ) : <EOL> self . bakery = bakery <EOL> self . tileSize = tileSize <EOL> self . orginX = orginX <EOL> self . orginY = orginY <EOL> def _toBakery ( self , x , y ) : <EOL> return x * self . tileSize + self . orginX , y * self . tileSize + self . orginY , self . tileSize <EOL> def hasTile ( self , x , y ) : <EOL> return self . bakery . hasTile ( * self . _toBakery ( x , y ) ) <EOL> def getTile ( self , x , y ) : <EOL> return self . bakery . getTile ( * self . _toBakery ( x , y ) ) <EOL> def asyncGetTile ( self , x , y , callback , callbackParams = ( ) ) : <EOL> xStart , yStart , tileSize = self . _toBakery ( x , y ) <EOL> self . bakery . asyncGetTile ( xStart , yStart , tileSize , callback , callbackParams ) <EOL> class Tile : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , renderMaps , placedMesh , x , y , scale ) : <EOL> self . x = x <EOL> self . y = y <EOL> self . scale = scale <EOL> self . renderMaps = renderMaps <EOL> self . placedMesh = placedMesh <EOL> def saveMaps ( self , path ) : <EOL> for map in self . renderMaps : <EOL> m = self . renderMaps [ map ] <EOL> m . tex . write ( path + m . name + "<STR_LIT>" ) <EOL> class Map : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , tex ) : <EOL> """<STR_LIT>""" <EOL> self . name = name <EOL> self . tex = tex <EOL> class PlacedMesh : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> pass <EOL> def pathPrefix ( ) : <EOL> if base . appRunner != None : <EOL> return base . appRunner . multifileRoot + '<STR_LIT:/>' <EOL> else : <EOL> return '<STR_LIT>' <EOL> def parseFile ( path ) : <EOL> """<STR_LIT>""" <EOL> d = { } <EOL> currentList = None <EOL> f = open ( pathPrefix ( ) + path , '<STR_LIT:r>' ) <EOL> for t in f . readlines ( ) : <EOL> i = t . find ( '<STR_LIT:#>' ) <EOL> if i != - <NUM_LIT:1> : <EOL> t = t [ : i ] <EOL> t = t . strip ( ) <EOL> if len ( t ) > <NUM_LIT:0> : <EOL> if t [ <NUM_LIT:0> ] == '<STR_LIT::>' : <EOL> currentList = [ ] <EOL> d [ t [ <NUM_LIT:1> : ] ] = currentList <EOL> else : <EOL> if currentList != None : <EOL> currentList . append ( t ) <EOL> return d <EOL> class SpecifiedMap : <EOL> def __init__ ( self , name ) : <EOL> self . name = name <EOL> def loadTex ( pathx , mask = False ) : <EOL> path = pathPrefix ( ) + pathx <EOL> extensions = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> for t in extensions : <EOL> if mask : <EOL> tex = loader . loadTexture ( path + '<STR_LIT:.>' + t , path + '<STR_LIT>' + t , okMissing = True ) <EOL> else : <EOL> tex = loader . loadTexture ( path + '<STR_LIT:.>' + t , okMissing = True ) <EOL> if tex is None : <EOL> print "<STR_LIT>" , path + '<STR_LIT:.>' + t <EOL> else : <EOL> return tex <EOL> print "<STR_LIT>" , path </s>
