Пример #1
0
void plLeafController::IReadUruController(hsStream* S) {
    switch (ClassIndex()) {
    case kEaseController:
        if (S->readInt() != 0) {
            AllocKeys(S->readInt(), hsKeyFrame::kScalarKeyFrame);
            for (size_t i=0; i<fKeys.getSize(); i++)
                fKeys[i]->read(S, fType);
        } else {
            AllocKeys(0, 0);
        }
        break;
    case kMatrix33Controller:
        AllocKeys(S->readInt(), hsKeyFrame::kMatrix33KeyFrame);
        for (size_t i=0; i<fKeys.getSize(); i++)
            fKeys[i]->read(S, fType);
        break;
    case kMatrix44Controller:
        AllocKeys(S->readInt(), hsKeyFrame::kMatrix44KeyFrame);
        for (size_t i=0; i<fKeys.getSize(); i++)
            fKeys[i]->read(S, fType);
        break;
    case kPoint3Controller:
        if (S->readInt() != 0) {
            AllocKeys(S->readInt(), hsKeyFrame::kPoint3KeyFrame);
            for (size_t i=0; i<fKeys.getSize(); i++)
                fKeys[i]->read(S, fType);
        } else {
            AllocKeys(0, 0);
        }
        break;
    case kQuatController:
        AllocKeys(S->readInt(), hsKeyFrame::kQuatKeyFrame);
        for (size_t i=0; i<fKeys.getSize(); i++)
            fKeys[i]->read(S, fType);
        break;
    case kScalarController:
        if (S->readInt() != 0) {
            AllocKeys(S->readInt(), hsKeyFrame::kScalarKeyFrame);
            for (size_t i=0; i<fKeys.getSize(); i++)
                fKeys[i]->read(S, fType);
        } else {
            AllocKeys(0, 0);
        }
        break;
    case kScaleValueController:
        AllocKeys(S->readInt(), hsKeyFrame::kScaleKeyFrame);
        for (size_t i=0; i<fKeys.getSize(); i++)
            fKeys[i]->read(S, fType);
        break;
    default:
        plString err = plString::Format("Unexpected class type [%04X]", ClassIndex());
        throw hsBadParamException(__FILE__, __LINE__, err);
    }

    if (fKeys.getSize() > 0)
        fType = fKeys[0]->getType();
}
Пример #2
0
void plLeafController::IPrcParse(const pfPrcTag* tag, plResManager* mgr) {
    if (tag->getName() == "Parameters") {
        plString typeStr = tag->getParam("Type", "");
        fType = hsKeyFrame::kUnknownKeyFrame;
        for (size_t i=0; i<=hsKeyFrame::kMatrix44KeyFrame; i++) {
            if (typeStr == hsKeyFrame::TypeNames[i])
                fType = i;
        }
        fUruUnknown = tag->getParam("UruUnknown", "0").toUint();
    } else if (tag->getName() == "Keys") {
        AllocKeys(tag->countChildren(), fType);
        const pfPrcTag* child = tag->getFirstChild();
        for (size_t i=0; i<fKeys.getSize(); i++) {
            fKeys[i]->prcParse(child);
            child = child->getNextSibling();
        }
    } else if (tag->getName() == "EaseControllers") {
        AllocControllers(tag->countChildren());
        const pfPrcTag* child = tag->getFirstChild();
        for (size_t i=0; i<fEaseControllers.getSize(); i++) {
            fEaseControllers[i]->prcParse(child, mgr);
            child = child->getNextSibling();
        }
    } else {
        plCreatable::IPrcParse(tag, mgr);
    }
}
Пример #3
0
void plLeafController::read(hsStream* S, plResManager* mgr) {
    if (S->getVer().isUniversal()) {
        if (ClassIndex() == kLeafController) {
            fType = S->readByte();
            unsigned int numKeys = S->readInt();
            AllocKeys(numKeys, fType);

            for (size_t i=0; i<fKeys.getSize(); i++)
                fKeys[i]->read(S, fType);
        } else {
            unsigned int numControllers = S->readInt();
            AllocControllers(numControllers);

            for (size_t i=0; i<fEaseControllers.getSize(); i++)
                fEaseControllers[i]->read(S, mgr);
            IReadUruController(S);
        }
    } else if (S->getVer().isUruSP()) {
        fUruUnknown = S->readInt();
        if (fUruUnknown != 0)
            plDebug::Debug("Found an UruUnknown of %d", fUruUnknown);
        unsigned int numControllers = S->readInt();
        AllocControllers(numControllers);

        for (size_t i=0; i<fEaseControllers.getSize(); i++)
            fEaseControllers[i]->read(S, mgr);

        S->readInt();
        IReadUruController(S);
    } else {
        fType = S->readByte();
        if ((S->getVer().isNewPlasma()) && fType >= hsKeyFrame::kCompressedQuatKeyFrame64)
            fType++;    // Myst V doesn't have hsCompressedQuatKeyFrame64
        unsigned int numKeys = S->readInt();
        AllocKeys(numKeys, fType);

        for (size_t i=0; i<fKeys.getSize(); i++)
            fKeys[i]->read(S, fType);
    }
}
Пример #4
0
void plLeafController::setKeys(const hsTArray<hsKeyFrame*>& keys, unsigned int type) {
    DeallocKeys();
    AllocKeys(keys.getSize(), type);
    for (size_t i=0; i<keys.getSize(); i++)
        fKeys[i] = keys[i];
}
Пример #5
0
void plLeafController::setKeys(const std::vector<hsKeyFrame*>& keys, unsigned int type) {
    DeallocKeys();
    AllocKeys(keys.size(), type);
    for (size_t i=0; i<keys.size(); i++)
        *fKeys[i] = *keys[i];
}