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


C++ FileStreamPtr::get32方法代码示例

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


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

示例1: unserialize


//.........这里部分代码省略.........
                    m_displacement.y = fin->getU16();
                } else {
                    m_displacement.x = 8;
                    m_displacement.y = 8;
                }
                m_attribs.set(attr, true);
                break;
            }
            case ThingAttrLight: {
                Light light;
                light.intensity = fin->getU16();
                light.color = fin->getU16();
                m_attribs.set(attr, light);
                break;
            }
            case ThingAttrMarket: {
                MarketData market;
                market.category = fin->getU16();
                market.tradeAs = fin->getU16();
                market.showAs = fin->getU16();
                market.name = fin->getString();
                market.restrictVocation = fin->getU16();
                market.requiredLevel = fin->getU16();
                m_attribs.set(attr, market);
                break;
            }
            case ThingAttrUsable:
            case ThingAttrElevation: {
                m_elevation = fin->getU16();
                m_attribs.set(attr, m_elevation);
                break;
            }
            case ThingAttrGround:
            case ThingAttrWritable:
            case ThingAttrWritableOnce:
            case ThingAttrMinimapColor:
            case ThingAttrCloth:
            case ThingAttrLensHelp:
                m_attribs.set(attr, fin->getU16());
                break;
            default:
                m_attribs.set(attr, true);
                break;
        };
    }

    if(!done)
        stdext::throw_exception(stdext::format("corrupt data (id: %d, category: %d, count: %d, lastAttr: %d)",
            m_id, m_category, count, attr));

    uint8 width = fin->getU8();
    uint8 height = fin->getU8();
    m_size = Size(width, height);
    if(width > 1 || height > 1) {
        m_realSize = fin->getU8();
        m_exactSize = std::min<int>(m_realSize, std::max<int>(width * 32, height * 32));
    }
    else
        m_exactSize = 32;

    m_layers = fin->getU8();
    m_numPatternX = fin->getU8();
    m_numPatternY = fin->getU8();
    if(g_game.getClientVersion() >= 755)
        m_numPatternZ = fin->getU8();
    else
        m_numPatternZ = 1;
    m_animationPhases = fin->getU8();

    if(g_game.getFeature(Otc::GameEnhancedAnimations)) {
        if(m_animationPhases > 1) {
            m_animation.async = fin->getU8() == 0;
            m_animation.loopCount = fin->get32();
            m_animation.startIndex = fin->getU8();

            for(int i = 0; i < m_animationPhases; i++) {
                int minDuration = fin->getU32();
                int maxDuration = fin->getU32();

                m_animation.frames.push_back(std::make_tuple(minDuration, maxDuration));
            }
        }
    }

    int totalSprites = m_size.area() * m_layers * m_numPatternX * m_numPatternY * m_numPatternZ * m_animationPhases;

    // if(totalSprites == 0)
    //     stdext::throw_exception("a thing type has no sprites");
    if(totalSprites > 4096)
        stdext::throw_exception("a thing type has more than 4096 sprites");

    m_spritesIndex.resize(totalSprites);
    for(int i = 0; i < totalSprites; i++)
        m_spritesIndex[i] = g_game.getFeature(Otc::GameSpritesU32) ? fin->getU32() : fin->getU16();

    m_textures.resize(m_animationPhases);
    m_texturesFramesRects.resize(m_animationPhases);
    m_texturesFramesOriginRects.resize(m_animationPhases);
    m_texturesFramesOffsets.resize(m_animationPhases);
}
开发者ID:Ablankzin,项目名称:otclient,代码行数:101,代码来源:thingtype.cpp


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