예제 #1
0
void MapReader1701::read_background(CMap& map, BinaryFile& mapfile)
{
    //Read in background to use
    mapfile.read_string_long(map.szBackgroundFile, 128);

    for (short iBackground = 0; iBackground < 26; iBackground++) {
        const char * szFindUnderscore = strstr(g_szBackgroundConversion[iBackground], "_");

        // All items must have an underscore in g_szBackgroundConversion
        assert(szFindUnderscore);

        szFindUnderscore++;

        if (!strcmp(szFindUnderscore, map.szBackgroundFile)) {
            assert(strlen(g_szBackgroundConversion[iBackground]) <= 128);
            strcpy(map.szBackgroundFile, g_szBackgroundConversion[iBackground]);
        }
    }
}
예제 #2
0
void MapReader1800::read_tileset(BinaryFile& mapfile)
{
    //Load tileset information

    short iNumTilesets = (short)mapfile.read_i32();

    TilesetTranslation * translation = new TilesetTranslation[iNumTilesets];

    iMaxTilesetID = 0; //Figure out how big the translation array needs to be
    for (short iTileset = 0; iTileset < iNumTilesets; iTileset++) {
        short iTilesetID = mapfile.read_i32();
        translation[iTileset].iID = iTilesetID;

        if (iTilesetID > iMaxTilesetID)
            iMaxTilesetID = iTilesetID;

        mapfile.read_string_long(translation[iTileset].szName, 128);
    }

    translationid = new short[iMaxTilesetID + 1];
    tilesetwidths = new short[iMaxTilesetID + 1];
    tilesetheights = new short[iMaxTilesetID + 1];

    for (short iTileset = 0; iTileset < iNumTilesets; iTileset++) {
        short iID = translation[iTileset].iID;
        translationid[iID] = g_tilesetmanager->GetIndexFromName(translation[iTileset].szName);

        if (translationid[iID] == TILESETUNKNOWN) {
            tilesetwidths[iID] = 1;
            tilesetheights[iID] = 1;
        } else {
            tilesetwidths[iID] = g_tilesetmanager->GetTileset(translationid[iID])->GetWidth();
            tilesetheights[iID] = g_tilesetmanager->GetTileset(translationid[iID])->GetHeight();
        }
    }

    delete [] translation;
}
예제 #3
0
void MapReader1702::read_background(CMap& map, BinaryFile& mapfile)
{
    //Read in background to use
    mapfile.read_string_long(map.szBackgroundFile, 128);
}