void MapReader1700::read_platforms(CMap& map, BinaryFile& mapfile, bool fPreview)
{
    map.clearPlatforms();

    //Load moving platforms
    map.iNumPlatforms = (short)mapfile.read_i32();
    map.platforms = new MovingPlatform*[map.iNumPlatforms];

    for (short iPlatform = 0; iPlatform < map.iNumPlatforms; iPlatform++) {
        short iWidth = (short)mapfile.read_i32();
        short iHeight = (short)mapfile.read_i32();

        TilesetTile ** tiles = new TilesetTile*[iWidth];
        MapTile ** types = new MapTile*[iWidth];

        read_platform_tiles(map, mapfile, iWidth, iHeight, tiles, types);

        short iDrawLayer = 2;
        //printf("Layer: %d\n", iDrawLayer);

        short iPathType = 0;
        //printf("PathType: %d\n", iPathType);

        MovingPlatformPath* path = NULL;
        path = read_platform_path_details(mapfile, iPathType, fPreview);
        if (!path)
            continue;

        MovingPlatform * platform = new MovingPlatform(tiles, types, iWidth, iHeight, iDrawLayer, path, fPreview);
        map.platforms[iPlatform] = platform;
        map.platformdrawlayer[iDrawLayer].push_back(platform);
    }
}
bool MapReader1500::load(CMap& map, BinaryFile& mapfile, ReadType readtype)
{
    read_autofilters(map, mapfile);

    if (readtype == read_type_summary)
        return true;

    map.clearPlatforms();

    //Reset position of read cursor
    mapfile.rewind();

    //clear map (we won't be reading in all the layers so it needs to be cleared)
    map.clearMap();

    read_tiles(map, mapfile);
    read_background(map, mapfile);
    read_music_category(map, mapfile);

    //All 1.5 maps will use cloud eyecandy
    map.eyecandy[2] = 1;

    for (short iSwitch = 0; iSwitch < 4; iSwitch++)
        map.iSwitches[iSwitch] = 0;

    return true;
}
bool MapReader1800::load(CMap& map, BinaryFile& mapfile/*, const char* filename*/, ReadType readtype)
{
    read_autofilters(map, mapfile);

    if (readtype == read_type_summary)
        return true;

    map.clearPlatforms();

    // FIXME
    /*cout << "loading map " << filename;

    if (readtype == read_type_preview)
        cout << " (preview)";

    cout << " [Version " << version[0] << '.' << version[1] << '.'
         << version[2] << '.' << version[3] << " Map Detected]\n";*/

    read_tileset(mapfile);

    read_tiles(map, mapfile);
    read_background(map, mapfile);
    read_switches(map, mapfile);
    read_platforms(map, mapfile, readtype == read_type_preview);

    //All tiles have been loaded so the translation is no longer needed
    delete [] translationid;
    delete [] tilesetwidths;
    delete [] tilesetheights;

    read_items(map, mapfile);
    read_hazards(map, mapfile);
    read_eyecandy(map, mapfile);
    read_music_category(map, mapfile);
    read_warp_locations(map, mapfile);
    read_switchable_blocks(map, mapfile);

    if (readtype == read_type_preview)
        return true;

    read_warp_exits(map, mapfile);
    if (!read_spawn_areas(map, mapfile))
        return false;

    if (!read_draw_areas(map, mapfile))
        return false;

    read_extra_tiledata(map, mapfile);
    read_gamemode_settings(map, mapfile);

    return true;
}
Example #4
0
bool MapReader1700::load(CMap& map, FILE* mapfile, ReadType readtype)
{
    read_autofilters(map, mapfile);

    if (readtype == read_type_summary)
        return true;

    map.clearPlatforms();

    read_tiles(map, mapfile);
    read_background(map, mapfile);

    // TODO: refactor CMap::loadPlatform to not need this
    int mapversion[4] = {1, 7, 0, patch_version};

    if (patch_version >= 1)
        read_switches(map, mapfile);
    else if (readtype != read_type_preview)
        set_preview_switches(map, mapfile);

    if (patch_version >= 2) {
        //short translationid[1] = {g_tilesetmanager->GetIndexFromName("Classic")};
        map.loadPlatforms(mapfile, readtype == read_type_preview, mapversion);
    }

    read_eyecandy(map, mapfile);
    read_music_category(map, mapfile);
    read_warp_locations(map, mapfile);

    if (readtype == read_type_preview)
        return true;

    read_warp_exits(map, mapfile);
    read_spawn_areas(map, mapfile);
    if (!read_draw_areas(map, mapfile))
        return false;

    if (patch_version <= 1) {
        //short translationid[1] = {g_tilesetmanager->GetIndexFromName("Classic")};
        map.loadPlatforms(mapfile, readtype == read_type_preview, mapversion);
    }

    if (patch_version == 0)
        read_switches(map, mapfile);

    return true;
}