示例#1
0
// DumpToDebugDisplay --------------------------------------------------------------------------------------
// ------------------
void plAvBrainClimb::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugText &debugTxt)
{
    debugTxt.DrawString(x, y, "Brain type: Climb");
    y += lineHeight;
    const char * worldDir = WorldDirStr(fDesiredDirection);
    const char * modeStr = ModeStr(fCurMode);

    char buffy[256];
    sprintf(buffy, "direction: %s mode: %s controlDir: %f", worldDir, modeStr, fControlDir);
    debugTxt.DrawString(x,y, buffy);
    y += lineHeight;
    
    IDumpClimbDirections(x, y, lineHeight, debugTxt);
    IDumpDismountDirections(x, y, lineHeight, debugTxt);
    IDumpBlockedDirections(x, y, lineHeight, debugTxt);

    fUp->DumpDebug(fUp == fCurStage, x, y, lineHeight, debugTxt);
    fDown->DumpDebug(fDown == fCurStage, x, y, lineHeight, debugTxt);
    fLeft->DumpDebug(fLeft == fCurStage, x, y, lineHeight, debugTxt);
    fRight->DumpDebug(fRight == fCurStage, x, y, lineHeight, debugTxt);
    fMountUp->DumpDebug(fMountUp == fCurStage, x, y, lineHeight, debugTxt);
    fMountDown->DumpDebug(fMountDown == fCurStage, x, y, lineHeight, debugTxt);
    fMountLeft->DumpDebug(fMountLeft == fCurStage, x, y, lineHeight, debugTxt);
    fMountRight->DumpDebug(fMountRight == fCurStage, x, y, lineHeight, debugTxt);
    fDismountUp->DumpDebug(fDismountUp == fCurStage, x, y, lineHeight, debugTxt);
    fDismountDown->DumpDebug(fDismountDown == fCurStage, x, y, lineHeight, debugTxt);
    fDismountLeft->DumpDebug(fDismountLeft == fCurStage, x, y, lineHeight, debugTxt);
    fDismountRight->DumpDebug(fDismountRight == fCurStage, x, y, lineHeight, debugTxt);
    fIdle->DumpDebug(fIdle == fCurStage, x, y, lineHeight, debugTxt);
    fRelease->DumpDebug(fRelease == fCurStage, x, y, lineHeight, debugTxt);
    fFallOff->DumpDebug(fFallOff == fCurStage, x, y, lineHeight, debugTxt);

}
// DumpDebug ------------------------------------------------------------------------------------------------------
// ----------
void plAvTaskBrain::DumpDebug(const char *name, int &x, int&y, int lineHeight, char *strBuf, plDebugText &debugTxt)
{
    if(fBrain)
    {
        debugTxt.DrawString(x, y, "Brain task -- Push New Brain.");
    } else {
        debugTxt.DrawString(x, y, "Brain task -- Pop Current Brain.");
    }
    y += lineHeight;
}
示例#3
0
void plAvBrainCritter::DumpToDebugDisplay(int& x, int& y, int lineHeight, plDebugText& debugTxt)
{
    debugTxt.DrawString(x, y, "Brain type: Critter", 0, 255, 255);
    y += lineHeight;

    // extract the name from the behavior running
    plString mode = "Mode: Unknown";
    if (fBehaviors[fCurMode])
        mode = plString::Format("Mode: %s", ((CritterBehavior*)(fBehaviors[fCurMode]))->Name().c_str());
    
    // draw it
    debugTxt.DrawString(x, y, mode);
    y += lineHeight;
    for (int i = 0; i < fBehaviors.GetCount(); ++i)
        fBehaviors[i]->DumpDebug(x, y, lineHeight, debugTxt);
}
示例#4
0
void plAvBrainSwim::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugText &debugTxt)
{
    debugTxt.DrawString(x, y, "Brain type: Swim", 0, 255, 255);
    y += lineHeight;
    
    switch(fMode) {
        case kWading:
            debugTxt.DrawString(x, y, "Mode: Wading");
            break;
        case kSwimming2D:
            debugTxt.DrawString(x, y, "Mode: Swimming2D");
            break;
        case kSwimming3D:
            debugTxt.DrawString(x, y, "Mode: Swimming3D");
            break;
        case kAbort:
            debugTxt.DrawString(x, y, "Mode: Abort (you should never see this)");
            break;
        default:
            break;
    }
    y += lineHeight;

    float buoy = fSwimStrategy ? fSwimStrategy->GetBuoyancy() : 0.0f;
    debugTxt.DrawString(x, y, plFormat("Distance to surface: {f} Buoyancy: {f}", fSurfaceDistance, buoy));
    y += lineHeight;

    hsVector3 linV = fAvMod->GetController()->GetAchievedLinearVelocity();
    debugTxt.DrawString(x, y, plFormat("Linear Velocity: ({5.2f}, {5.2f}, {5.2f})", linV.fX, linV.fY, linV.fZ));
    y += lineHeight;
    
    int i;
    for (i = 0; i < fBehaviors.GetCount(); i++)
        fBehaviors[i]->DumpDebug(x, y, lineHeight, debugTxt);
}
// DumpDebug -----------------------------------------------------------------------------------------------------
// ----------
void plAvTaskSeek::DumpDebug(const char *name, int &x, int&y, int lineHeight, char *strBuf, plDebugText &debugTxt)
{
    sprintf(strBuf, "duration: %.2f pos: (%.3f, %.3f, %.3f) goalPos: (%.3f, %.3f, %.3f) ",
            hsTimer::GetSysSeconds() - fStartTime,
            fPosition.fX, fPosition.fY, fPosition.fZ, fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ);
    debugTxt.DrawString(x, y, strBuf);
    y += lineHeight;

    sprintf(strBuf, "positioning: %d rotating %d goalVec: (%.3f, %.3f, %.3f) dist: %.3f angFwd: %.3f angRt: %.3f",
            fStillPositioning, fStillRotating, fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ, fDistance, fAngForward, fAngRight);
    debugTxt.DrawString(x, y, strBuf);
    y += lineHeight;
    
    sprintf(strBuf, " distFwd: %.3f distRt: %.3f shufRange: %.3f sidAngle: %.3f sidRange: %.3f, fMinWalk: %.3f",
            fDistForward, fDistRight, fShuffleRange, fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle);
    debugTxt.DrawString(x, y, strBuf);
    y += lineHeight;
}
示例#6
0
void plAvBrainCritter::DumpToDebugDisplay(int& x, int& y, int lineHeight, char* strBuf, plDebugText& debugTxt)
{
    sprintf(strBuf, "Brain type: Critter");
    debugTxt.DrawString(x, y, strBuf, 0, 255, 255);
    y += lineHeight;

    // extract the name from the behavior running
    if (fBehaviors[fCurMode])
        sprintf(strBuf, "Mode: %s", ((CritterBehavior*)(fBehaviors[fCurMode]))->Name().c_str());
    else
        sprintf(strBuf, "Mode: Unknown");
    
    // draw it
    debugTxt.DrawString(x, y, strBuf);
    y += lineHeight;
    for (int i = 0; i < fBehaviors.GetCount(); ++i)
        fBehaviors[i]->DumpDebug(x, y, lineHeight, strBuf, debugTxt);
}
示例#7
0
// DUMPDEBUG
void plAnimStage::DumpDebug(bool active, int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt)
{
    std::string str;

    str += fAnimName;
    str += " ";

    if(fLoops) {
        sprintf(strBuf, "loop(%d/%d)", fCurLoop, fLoops);
        str += strBuf;
    }

    sprintf(strBuf, "time: (%f/%f)", fLocalTime, fLength);
    str += strBuf;

    if(active)
        debugTxt.DrawString(x, y, str.c_str(), 0, 255, 0);
    else if(fAnimInstance)
        debugTxt.DrawString(x, y, str.c_str());
    else
        debugTxt.DrawString(x, y, str.c_str(), 255, 255, 0);

    y += lineHeight;
}
示例#8
0
void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, plDebugText &debugTxt)
{
    float strength = GetStrength();
    const char *onOff = strength > 0 ? "on" : "off";
    char blendBar[] = "||||||||||";
    int bars = (int)min(10 * strength, 10);
    blendBar[bars] = '\0';

    plString details;
    if (fAnim)
    {
        float time = fAnim->GetTimeConvert()->CurrentAnimTime();
        details = plFormat("{>20} {>3} time: {5.2f} {}", fAnim->GetName(), onOff, time, blendBar);
    }
    else
        details = plFormat("         Behavior {2} {>3} {}", fIndex, onOff, blendBar);

    debugTxt.DrawString(x, y, details);
    y += lineHeight; 
}
示例#9
0
void plAvBrainClimb::IDumpBlockedDirections(int &x, int &y, int lineHeight, plDebugText &debugTxt)
{
    static const char prolog[] = "Physically blocked: ";
    plStringStream str;

    str << prolog;
    if(fOldPhysicallyBlockedDirections & plClimbMsg::kUp)
        str << "UP ";
    if(fOldPhysicallyBlockedDirections & plClimbMsg::kDown)
        str << "DOWN ";
    if(fOldPhysicallyBlockedDirections & plClimbMsg::kLeft)
        str << "LEFT ";
    if(fOldPhysicallyBlockedDirections & plClimbMsg::kRight)
        str << "RIGHT ";
    
    if(str.GetLength() == strlen(prolog))
        str << "- NONE -";

    debugTxt.DrawString(x, y, str.GetString());
    y += lineHeight;
}
示例#10
0
// DUMPDEBUG
void plAvTask::DumpDebug(const char *name, int &x, int&y, int lineHeight, plDebugText &debugTxt)
{
    debugTxt.DrawString(x, y, "<anonymous task>");
    y += lineHeight;
}