def new_map():
    ir = pygame.Rect(0, 550, 800, 50)
    mw = int( core.getInput("Map width:", ir, default="10") )
    mh = int( core.getInput("Map height:", ir, default="10") )
    pn = int( core.getInput("Portal number:", ir, default="0") )
    filename = core.getInput("Map filename:", ir, default="new_map.rmap")
    data = [ None for i in range(mw*mh) ]
    return map.oMap(width=mw, height=mh, portal=pn, mapData=data), filename
def edit_map(mapa):
    ir = pygame.Rect(0, 550, 800, 50)
    mw = int( core.getInput("Map width:", ir, default=str(mapa.width)) )
    mh = int( core.getInput("Map height:", ir, default=str(mapa.height)) )
    pn = int( core.getInput("Portal number:", ir, default=str(mapa.portalN)) )
    mapa.portalN = pn
    data = []
    for y in range(mapa.height):
        if y >= mh:
            break
        for x in range(mapa.width):
            if x >= mw:
                break
            data.append(mapa.mapData[y*mapa.width+x])
        for x in range(mw - mapa.width):
            data.append(None)
    for y in range(mh-mapa.height):
        for x in range(mw):
            data.append(None)
    
    mapa.width = mw
    mapa.height = mh
    mapa.mapData = data
    return mapa
def load_map():
    ir = pygame.Rect(0, 550, 800, 50)
    filename = core.getInput("Map filename:", ir, default="new_map.rmap")
    mapa = map.oMap()
    mapa.load(filename)
    return mapa, filename