示例#1
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;
}
示例#2
0
bool plAnimStage::ITryRegress(plArmatureMod *avMod)
{
    bool stageDone = false;

    // 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(kNotifyRegress, proEventData::kRegressPrevStage, avMod, fBrain);

    // hsStatusMessageF("Sending regress message for stage <%s>\n", fAnimName);
    if(fRegressType == kRegressAuto) {
        stageDone = true;
    }
    return stageDone;
}
示例#3
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;
}
示例#4
0
// TRIGGER
bool plNPCSpawnMod::Trigger()
{
    bool result = false;

    // you can ONLY spawn if you are local. the spawn message
    // will netpropagate
    if(this->IsLocallyOwned())
    {
        if (!fModelName.is_empty())
        {
            // spawn the NPC
            plKey spawnPoint = GetTarget(0)->GetKey();

            // Note: we will be unloaded by the NetApp's NPC magick
            fSpawnedKey = plAvatarMgr::GetInstance()->LoadAvatar(fModelName, fAccountName, false, spawnPoint, nil);

            ISendNotify(fSpawnedKey);
        }
    }

    return result;
}