Пример #1
0
plOperationProgress* plProgressMgr::IRegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText)
{
    if (fOperations == nil)
    {
        fCurrentStaticText = staticTextType;
        Activate();
    }

    plOperationProgress *op = new plOperationProgress( length );

    op->SetTitle( title );

    if (fOperations)
    {
        fOperations->fBack = op;
        op->fNext = fOperations;
    }
    fOperations = op;

    if (isRetry)
        hsSetBits(op->fFlags, plOperationProgress::kRetry);
    if (isOverall)
        hsSetBits(op->fFlags, plOperationProgress::kOverall);
    if (alwaysDrawText)
        hsSetBits(op->fFlags, plOperationProgress::kAlwaysDrawText);

    IUpdateCallbackProc( op );

    return op;
}
Пример #2
0
plOperationProgress::~plOperationProgress()
{
    hsSetBits(fFlags, kLastUpdate);
    if (!IsOverallProgress())
        plProgressMgr::GetInstance()->IUpdateCallbackProc(this);
    plProgressMgr::GetInstance()->IUnregisterOperation(this);
}
Пример #3
0
// MoveRelative ------------------------------
// -------------
// A true result means that the stage is done.
bool plAnimStage::MoveRelative(double time, float delta, float &overage, plArmatureMod *avMod)
{
    bool result;        // true means the stage is done

    if(fLocalTime == 0.0f && delta >= 0.0f && !hsCheckBits(fSentNotifies, kNotifyEnter))
    {
        // we send the "enter" notify if we're at the start and either moving forward
        // or standing still.
        ISendNotify(kNotifyEnter, proEventData::kEnterStage, avMod, fBrain);
        hsSetBits(fSentNotifies, kNotifyEnter);
    }

    // aborting...
    if( fAdvanceType == kAdvanceOnMove && (avMod->HasMovementFlag() || avMod->ExitModeKeyDown()))
    {   // special case: advance when any key is pressed, regardless of position in stage.
        ISendNotify(kNotifyAdvance, proEventData::kAdvanceNextStage, avMod, fBrain);
        result = true;
    } else {
        if(delta == 0.0f)
        {
            return false;
        }   
        else
        if(delta < 0.0f)
            result = IMoveBackward(time, delta, overage, avMod);
        else
            result = IMoveForward(time, delta, overage, avMod);
    }

    return result;
}
Пример #4
0
bool DumpSounds()
{
    hsTArray<plKey> soundKeys;

    plSoundBufferCollector soundCollector(soundKeys);
    gResMgr->IterateAllPages(&soundCollector);

    for (int i = 0; i < soundKeys.GetCount(); i++)
    {
        plSoundBuffer* buffer = plSoundBuffer::ConvertNoRef(soundKeys[i]->VerifyLoaded());
        if (buffer)
        {
            // Ref it...
            buffer->GetKey()->RefObject();

            // Get the filename from it and add that file if necessary
            plFileName filename = buffer->GetFileName();
            if (filename.IsValid())
            {
                uint32_t flags = 0;

                if (filename.GetFileExt().CompareI("wav") != 0)
                {
                    if (buffer->HasFlag(plSoundBuffer::kOnlyLeftChannel) ||
                        buffer->HasFlag(plSoundBuffer::kOnlyRightChannel))
                        hsSetBits(flags, plManifestFile::kSndFlagCacheSplit);
                    else if (buffer->HasFlag(plSoundBuffer::kStreamCompressed))
                        hsSetBits(flags, plManifestFile::kSndFlagStreamCompressed);
                    else
                        hsSetBits(flags, plManifestFile::kSndFlagCacheStereo);
                }

                printf("%s,%u\n", filename.AsString().c_str(), flags);
            }

            // Unref the object so it goes away
            buffer->GetKey()->UnRefObject();
        }
    }

    soundKeys.Reset();
    plIndirectUnloadIterator iter;
    gResMgr->IterateAllPages(&iter);

    return true;
}
Пример #5
0
void plProgressMgr::IUpdateFlags(plOperationProgress* progress)
{
    // Init update is done, clear it and set first update
    if (hsCheckBits(progress->fFlags, plOperationProgress::kInitUpdate))
    {
        hsClearBits(progress->fFlags, plOperationProgress::kInitUpdate);
        hsSetBits(progress->fFlags, plOperationProgress::kFirstUpdate);
    }
    // First update is done, clear it
    else if (hsCheckBits(progress->fFlags, plOperationProgress::kFirstUpdate))
        hsClearBits(progress->fFlags, plOperationProgress::kFirstUpdate);
}
Пример #6
0
bool plAnimStage::ITryAdvance(plArmatureMod *avMod)
{
    bool stageDone = false;


    // hsStatusMessageF("Sending advance message for stage <%s>\n", fAnimName);
    if(fAdvanceType == kAdvanceAuto || fAdvanceType == kAdvanceOnMove) {
        stageDone = true;
    }

    if(!hsCheckBits(fSentNotifies, kNotifyAdvance))
    {
        // we send the advance message at the point where we *would* advance, whether
        // or not we actually do. this is misleading but better suited to actual current usage.
        // we may want to rename this to "ReachedStageEnd"
        ISendNotify(kNotifyAdvance, proEventData::kAdvanceNextStage, avMod, fBrain);
        hsSetBits(fSentNotifies, kNotifyAdvance);
    }

    return stageDone;
}
Пример #7
0
void plOperationProgress::SetRetry()
{
    hsSetBits(fFlags, kRetry);
    hsSetBits(fFlags, kFirstUpdate);
}
Пример #8
0
void plOperationProgress::SetAborting()
{
    hsSetBits(fFlags, kAborting);
    plProgressMgr::GetInstance()->IUpdateCallbackProc(this);
    fMax = fValue = 0.f;
}