mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 04:09:16 +00:00
Cleanup: Don't pass a writable scratch buffer off to dozens of virtual
functions -- that's just silly!
This commit is contained in:
@ -2649,7 +2649,6 @@ void plArmatureLODMod::Write(hsStream *stream, hsResMgr *mgr)
|
||||
int plArmatureMod::RefreshDebugDisplay()
|
||||
{
|
||||
plDebugText &debugTxt = plDebugText::Instance();
|
||||
char strBuf[ 2048 ];
|
||||
int lineHeight = debugTxt.GetFontSize() + 4;
|
||||
uint32_t scrnWidth, scrnHeight;
|
||||
|
||||
@ -2657,14 +2656,13 @@ int plArmatureMod::RefreshDebugDisplay()
|
||||
int y = 10;
|
||||
int x = 10;
|
||||
|
||||
DumpToDebugDisplay(x, y, lineHeight, strBuf, debugTxt);
|
||||
DumpToDebugDisplay(x, y, lineHeight, debugTxt);
|
||||
return y;
|
||||
}
|
||||
|
||||
void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt)
|
||||
void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugText &debugTxt)
|
||||
{
|
||||
sprintf(strBuf, "Armature <%s>:", fRootName.c_str());
|
||||
debugTxt.DrawString(x, y, strBuf, 255, 128, 128);
|
||||
debugTxt.DrawString(x, y, plString::Format("Armature <%s>:", fRootName.c_str()), 255, 128, 128);
|
||||
y += lineHeight;
|
||||
|
||||
plSceneObject * SO = GetTarget(0);
|
||||
@ -2675,9 +2673,8 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
|
||||
hsPoint3 worldPos = l2w.GetTranslate();
|
||||
|
||||
const char *opaque = IsOpaque() ? "yes" : "no";
|
||||
sprintf(strBuf, "position(world): %.2f, %.2f, %.2f Opaque: %3s",
|
||||
worldPos.fX, worldPos.fY, worldPos.fZ, opaque);
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
debugTxt.DrawString(x, y, plString::Format("position(world): %.2f, %.2f, %.2f Opaque: %3s",
|
||||
worldPos.fX, worldPos.fY, worldPos.fZ, opaque));
|
||||
y += lineHeight;
|
||||
|
||||
const char* frozen = "n.a.";
|
||||
@ -2688,32 +2685,34 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
|
||||
plKey world = nil;
|
||||
if (fController)
|
||||
world = fController->GetSubworld();
|
||||
sprintf(strBuf, "In world: %s Frozen: %s", world ? world->GetName().c_str() : "nil", frozen);
|
||||
debugTxt.DrawString(x,y, strBuf);
|
||||
debugTxt.DrawString(x, y, plString::Format("In world: %s Frozen: %s",
|
||||
world ? world->GetName().c_str() : "nil", frozen));
|
||||
y+= lineHeight;
|
||||
|
||||
plString details;
|
||||
if (fController)
|
||||
{
|
||||
hsPoint3 physPos;
|
||||
GetPositionAndRotationSim(&physPos, nil);
|
||||
const hsVector3& vel = fController->GetLinearVelocity();
|
||||
sprintf(strBuf, "position(physical): <%.2f, %.2f, %.2f> velocity: <%5.2f, %5.2f, %5.2f>", physPos.fX, physPos.fY, physPos.fZ, vel.fX, vel.fY, vel.fZ);
|
||||
details = plString::Format("position(physical): <%.2f, %.2f, %.2f> velocity: <%5.2f, %5.2f, %5.2f>",
|
||||
physPos.fX, physPos.fY, physPos.fZ, vel.fX, vel.fY, vel.fZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(strBuf, "position(physical): no controller");
|
||||
details = "position(physical): no controller";
|
||||
}
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
debugTxt.DrawString(x, y, details);
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
DebugDumpMoveKeys(x, y, lineHeight, strBuf, debugTxt);
|
||||
DebugDumpMoveKeys(x, y, lineHeight, debugTxt);
|
||||
|
||||
int i;
|
||||
for(i = 0; i < fBrains.size(); i++)
|
||||
{
|
||||
plArmatureBrain *brain = fBrains[i];
|
||||
brain->DumpToDebugDisplay(x, y, lineHeight, strBuf, debugTxt);
|
||||
brain->DumpToDebugDisplay(x, y, lineHeight, debugTxt);
|
||||
}
|
||||
|
||||
if (fClothingOutfit)
|
||||
@ -2722,30 +2721,30 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
|
||||
|
||||
debugTxt.DrawString(x, y, "ItemsWorn:");
|
||||
y += lineHeight;
|
||||
strBuf[0] = '\0';
|
||||
plStringStream outfit;
|
||||
int itemCount = 0;
|
||||
for (i = 0; i < fClothingOutfit->fItems.GetCount(); i++)
|
||||
{
|
||||
if (itemCount == 0)
|
||||
strcat(strBuf, " ");
|
||||
outfit << " ";
|
||||
|
||||
strcat(strBuf, fClothingOutfit->fItems[i]->fName);
|
||||
outfit << fClothingOutfit->fItems[i]->fName;
|
||||
itemCount++;
|
||||
|
||||
if (itemCount == 4)
|
||||
{
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
debugTxt.DrawString(x, y, outfit.GetString());
|
||||
itemCount = 0;
|
||||
strBuf[0] = '\0';
|
||||
outfit.Truncate();
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
if (itemCount > 0)
|
||||
strcat(strBuf, ", ");
|
||||
outfit << ", ";
|
||||
}
|
||||
if (itemCount > 0)
|
||||
{
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
debugTxt.DrawString(x, y, outfit.GetString());
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
@ -2756,11 +2755,11 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
|
||||
|
||||
debugTxt.DrawString(x, y, "Relevance Regions:");
|
||||
y += lineHeight;
|
||||
sprintf(strBuf, " In: %s", plRelevanceMgr::Instance()->GetRegionNames(fRegionsImIn).c_str());
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
debugTxt.DrawString(x, y, plString::Format(" In: %s",
|
||||
plRelevanceMgr::Instance()->GetRegionNames(fRegionsImIn).c_str()));
|
||||
y += lineHeight;
|
||||
sprintf(strBuf, " Care about: %s", plRelevanceMgr::Instance()->GetRegionNames(fRegionsICareAbout).c_str());
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
debugTxt.DrawString(x, y, plString::Format(" Care about: %s",
|
||||
plRelevanceMgr::Instance()->GetRegionNames(fRegionsICareAbout).c_str()));
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
@ -2799,17 +2798,18 @@ void plAvBoneMap::AddBoneMapping(uint32_t boneID, const plSceneObject *SO)
|
||||
(fImp->fMap)[boneID] = SO;
|
||||
}
|
||||
|
||||
void plArmatureMod::DebugDumpMoveKeys(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt)
|
||||
void plArmatureMod::DebugDumpMoveKeys(int &x, int &y, int lineHeight, plDebugText &debugTxt)
|
||||
{
|
||||
char buff[256];
|
||||
sprintf(buff, "Mouse Input Map: %s", plAvatarInputInterface::GetInstance()->GetInputMapName());
|
||||
snprintf(buff, sizeof(buff), "Mouse Input Map: %s", plAvatarInputInterface::GetInstance()->GetInputMapName());
|
||||
debugTxt.DrawString(x, y, buff);
|
||||
y += lineHeight;
|
||||
|
||||
sprintf(buff, "Turn strength: %.2f (key: %.2f, analog: %.2f)", GetTurnStrength(), GetKeyTurnStrength(), GetAnalogTurnStrength());
|
||||
|
||||
snprintf(buff, sizeof(buff), "Turn strength: %.2f (key: %.2f, analog: %.2f)",
|
||||
GetTurnStrength(), GetKeyTurnStrength(), GetAnalogTurnStrength());
|
||||
debugTxt.DrawString(x, y, buff);
|
||||
y += lineHeight;
|
||||
|
||||
|
||||
GetMoveKeyString(buff);
|
||||
debugTxt.DrawString(x, y, buff);
|
||||
y += lineHeight;
|
||||
|
Reference in New Issue
Block a user