当前位置: 首页>>代码示例>>C++>>正文


C++ BinaryFile::read_i32方法代码示例

本文整理汇总了C++中BinaryFile::read_i32方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryFile::read_i32方法的具体用法?C++ BinaryFile::read_i32怎么用?C++ BinaryFile::read_i32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinaryFile的用法示例。


在下文中一共展示了BinaryFile::read_i32方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void MapReader1700::read_warp_locations(CMap& map, BinaryFile& mapfile)
{
    for (unsigned short j = 0; j < MAPHEIGHT; j++) {
        for (unsigned short i = 0; i < MAPWIDTH; i++) {
            TileType iType = (TileType)mapfile.read_i32();

            if (iType >= 0 && iType < NUMTILETYPES) {
                map.mapdatatop[i][j].iType = iType;
                map.mapdatatop[i][j].iFlags = g_iTileTypeConversion[iType];
            } else {
                map.mapdatatop[i][j].iType = tile_nonsolid;
                map.mapdatatop[i][j].iFlags = tile_flag_nonsolid;
            }

            map.warpdata[i][j].direction = (WarpEnterDirection)mapfile.read_i32();
            map.warpdata[i][j].connection = (short)mapfile.read_i32();
            map.warpdata[i][j].id = (short)mapfile.read_i32();

            for (short sType = 0; sType < 6; sType += 5)
                map.nospawn[sType][i][j] = mapfile.read_i32() == 0 ? false : true;

            //Copy player no spawn areas into team no spawn areas
            for (short sType = 1; sType < 5; sType++)
                map.nospawn[sType][i][j] = map.nospawn[0][i][j];

        }
    }
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:28,代码来源:MapReader17xx.cpp

示例2: MovingPlatform

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);
    }
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:33,代码来源:MapReader17xx.cpp

示例3:

void MapReader1802::read_eyecandy(CMap& map, BinaryFile& mapfile)
{
    //Read in eyecandy to use
    //For all layers if the map format supports it
    map.eyecandy[0] = (short)mapfile.read_i32();
    map.eyecandy[1] = (short)mapfile.read_i32();
    map.eyecandy[2] = (short)mapfile.read_i32();
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:8,代码来源:MapReader18xx.cpp

示例4:

void MapReader1500::read_tiles(CMap& map, BinaryFile& mapfile)
{
    unsigned short i, j;

    // 2. load map data
    for (j = 0; j < MAPHEIGHT; j++) {
        for (i = 0; i < MAPWIDTH; i++) {
            //Read everything into layer 1
            short iTileID = (short)mapfile.read_i32();

            TilesetTile * tile = &map.mapdata[i][j][1];
            tile->iID = g_tilesetmanager->GetClassicTilesetIndex();
            tile->iCol = iTileID % 32;
            tile->iRow = iTileID / 32;

            TileType iType = g_tilesetmanager->GetClassicTileset()->GetTileType(tile->iCol, tile->iRow);

            if (iType >= 0 && iType < NUMTILETYPES) {
                map.mapdatatop[i][j].iType = iType;
                map.mapdatatop[i][j].iFlags = g_iTileTypeConversion[iType];
            } else {
                map.mapdatatop[i][j].iType = tile_nonsolid;
                map.mapdatatop[i][j].iFlags = tile_flag_nonsolid;
            }

            map.mapdata[i][j][0].iID = TILESETNONE;
            map.mapdata[i][j][2].iID = TILESETNONE;
            map.mapdata[i][j][3].iID = TILESETNONE;
        }
    }

    // 3. load objects data
    for (j = 0; j < MAPHEIGHT; j++) {
        for (i = 0; i < MAPWIDTH; i++) {
            map.objectdata[i][j].iType = (short)mapfile.read_i32();
            if (map.objectdata[i][j].iType == 6)
                map.objectdata[i][j].iType = -1;

            map.objectdata[i][j].fHidden = false;

            if (map.objectdata[i][j].iType == 1) {
                for (short iSetting = 0; iSetting < NUM_BLOCK_SETTINGS; iSetting++)
                    map.objectdata[i][j].iSettings[iSetting] = g_iDefaultPowerupPresets[0][iSetting];
            }
        }
    }
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:47,代码来源:MapReader15xx.cpp

示例5: areas

bool MapReader1700::read_spawn_areas(CMap& map, BinaryFile& mapfile)
{
    //Read spawn areas
    for (unsigned short i = 0; i < 6; i += 5) {
        map.totalspawnsize[i] = 0;
        map.numspawnareas[i] = (short)mapfile.read_i32();

        if (map.numspawnareas[i] > MAXSPAWNAREAS) {
            cout << endl << " ERROR: Number of spawn areas (" << map.numspawnareas[i]
                 << ") was greater than max allowed (" << MAXSPAWNAREAS << ')'
                 << endl;
            return false;
        }

        for (int m = 0; m < map.numspawnareas[i]; m++) {
            map.spawnareas[i][m].left = (short)mapfile.read_i32();
            map.spawnareas[i][m].top = (short)mapfile.read_i32();
            map.spawnareas[i][m].width = (short)mapfile.read_i32();
            map.spawnareas[i][m].height = (short)mapfile.read_i32();
            map.spawnareas[i][m].size = (short)mapfile.read_i32();

            map.totalspawnsize[i] += map.spawnareas[i][m].size;
        }
    }

    //Copy player spawn areas to team specific spawn areas
    for (short iType = 1; iType < 5; iType++) {
        map.totalspawnsize[iType] = map.totalspawnsize[0];
        map.numspawnareas[iType] = map.numspawnareas[0];

        for (int m = 0; m < map.numspawnareas[0]; m++) {
            map.spawnareas[iType][m].left = map.spawnareas[0][m].left;
            map.spawnareas[iType][m].top = map.spawnareas[0][m].top;
            map.spawnareas[iType][m].width = map.spawnareas[0][m].width;
            map.spawnareas[iType][m].height = map.spawnareas[0][m].height;
            map.spawnareas[iType][m].size = map.spawnareas[0][m].size;
        }
    }

    return true;
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:41,代码来源:MapReader17xx.cpp

示例6: areas

bool MapReader1800::read_spawn_areas(CMap& map, BinaryFile& mapfile)
{
    for (unsigned short i = 0; i < NUMSPAWNAREATYPES; i++) {
        map.totalspawnsize[i] = 0;
        map.numspawnareas[i] = (short)mapfile.read_i32();

        if (map.numspawnareas[i] > MAXSPAWNAREAS) {
            cout << endl << " ERROR: Number of spawn areas (" << map.numspawnareas[i]
                 << ") was greater than max allowed (" << MAXSPAWNAREAS << ')'
                 << endl;
            return false;
        }

        for (int m = 0; m < map.numspawnareas[i]; m++) {
            map.spawnareas[i][m].left = (short)mapfile.read_i32();
            map.spawnareas[i][m].top = (short)mapfile.read_i32();
            map.spawnareas[i][m].width = (short)mapfile.read_i32();
            map.spawnareas[i][m].height = (short)mapfile.read_i32();
            map.spawnareas[i][m].size = (short)mapfile.read_i32();

            map.totalspawnsize[i] += map.spawnareas[i][m].size;
        }

        //If no spawn areas were identified, then create one big spawn area
        if (map.totalspawnsize[i] == 0) {
            map.numspawnareas[i] = 1;
            map.spawnareas[i][0].left = 0;
            map.spawnareas[i][0].width = 20;
            map.spawnareas[i][0].top = 1;
            map.spawnareas[i][0].height = 12;
            map.spawnareas[i][0].size = 220;
            map.totalspawnsize[i] = 220;
        }
    }

    return true;
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:37,代码来源:MapReader18xx.cpp

示例7: strcpy

void MapReader1500::read_background(CMap& map, BinaryFile& mapfile)
{
    // Read old background IDs and convert that to a background filename
    map.backgroundID = (short)mapfile.read_i32();
    strcpy(map.szBackgroundFile, g_szBackgroundConversion[map.backgroundID]);
}
开发者ID:HerbFargus,项目名称:supermariowar,代码行数:6,代码来源:MapReader15xx.cpp


注:本文中的BinaryFile::read_i32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。