changed debug output
This commit is contained in:
parent
22312f4762
commit
d62fcd4bb5
|
|
@ -74,7 +74,7 @@ class DevWalker(DirectObject.DirectObject):
|
|||
"""
|
||||
For debug use.
|
||||
"""
|
||||
onScreenDebug.add("controls", "DevWalker")
|
||||
onScreenDebug.add("w controls", "DevWalker")
|
||||
|
||||
def handleAvatarControls(self, task):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import math
|
|||
class PhysicsWalker(DirectObject.DirectObject):
|
||||
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("PhysicsWalker")
|
||||
wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
|
||||
wantAvatarPhysicsIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
|
||||
|
||||
useLifter = 0
|
||||
|
|
@ -64,7 +65,7 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||
"""
|
||||
def spawnTest(self):
|
||||
assert(self.debugPrint("\n\nspawnTest()\n"))
|
||||
if not self.wantAvatarPhysicsIndicator:
|
||||
if not self.wantDebugIndicator:
|
||||
return
|
||||
from pandac.PandaModules import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
|
|
@ -401,12 +402,30 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||
tempCTrav.addCollider(self.cRayNodePath, self.cRayQueue)
|
||||
tempCTrav.traverse(render)
|
||||
|
||||
def displayDebugInfo(self):
|
||||
"""
|
||||
For debug use.
|
||||
"""
|
||||
onScreenDebug.add("w controls", "PhysicsWalker")
|
||||
|
||||
onScreenDebug.add("w airborneHeight", self.lifter.getAirborneHeight())
|
||||
onScreenDebug.add("w falling", self.falling)
|
||||
onScreenDebug.add("w isOnGround", self.lifter.isOnGround())
|
||||
#onScreenDebug.add("w gravity", self.lifter.getGravity())
|
||||
#onScreenDebug.add("w jumpForce", self.avatarControlJumpForce)
|
||||
onScreenDebug.add("w contact normal", self.lifter.getContactNormal().pPrintValues())
|
||||
onScreenDebug.add("w mayJump", self.mayJump)
|
||||
onScreenDebug.add("w impact", self.lifter.getImpactVelocity())
|
||||
onScreenDebug.add("w velocity", self.lifter.getVelocity())
|
||||
onScreenDebug.add("w isAirborne", self.isAirborne)
|
||||
onScreenDebug.add("w hasContact", self.lifter.hasContact())
|
||||
|
||||
def handleAvatarControls(self, task):
|
||||
"""
|
||||
Check on the arrow keys and update the avatar.
|
||||
"""
|
||||
if __debug__:
|
||||
if self.wantAvatarPhysicsIndicator:
|
||||
if self.wantDebugIndicator:
|
||||
onScreenDebug.append("localAvatar pos = %s\n"%(base.localAvatar.getPos().pPrintValues(),))
|
||||
onScreenDebug.append("localAvatar h = % 10.4f\n"%(base.localAvatar.getH(),))
|
||||
onScreenDebug.append("localAvatar anim = %s\n"%(base.localAvatar.animFSM.getCurrentState().getName(),))
|
||||
|
|
@ -422,6 +441,9 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||
self.reset()
|
||||
self.avatarNodePath.setZ(50.0)
|
||||
messenger.send("walkerIsOutOfWorld", [self.avatarNodePath])
|
||||
|
||||
if self.wantDebugIndicator:
|
||||
self.displayDebugInfo()
|
||||
|
||||
# get the button states:
|
||||
forward = inputState.isSet("forward")
|
||||
|
|
@ -468,7 +490,7 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||
# # We must copy the vector to preserve it:
|
||||
# self.__oldPosDelta=Vec3(posDelta)
|
||||
if __debug__:
|
||||
if self.wantAvatarPhysicsIndicator:
|
||||
if self.wantDebugIndicator:
|
||||
onScreenDebug.add("posDelta1",
|
||||
self.avatarNodePath.getPosDelta(render).pPrintValues())
|
||||
|
||||
|
|
@ -678,7 +700,7 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||
assert(self.debugPrint(" velocity=%s"%(velocity,)))
|
||||
self.priorParent.setVector(Vec3(velocity))
|
||||
if __debug__:
|
||||
if self.wantAvatarPhysicsIndicator:
|
||||
if self.wantDebugIndicator:
|
||||
onScreenDebug.add("velocity", velocity.pPrintValues())
|
||||
|
||||
def reset(self):
|
||||
|
|
@ -731,7 +753,7 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||
|
||||
if __debug__:
|
||||
def setupAvatarPhysicsIndicator(self):
|
||||
if self.wantAvatarPhysicsIndicator:
|
||||
if self.wantDebugIndicator:
|
||||
indicator=loader.loadModelCopy('phase_5/models/props/dagger')
|
||||
#self.walkControls.setAvatarPhysicsIndicator(indicator)
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ read_all() {
|
|||
if (!read(filename)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cerr << "DCFile::read_all Already read " << filename << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +136,7 @@ bool DCFile::
|
|||
read(Filename filename) {
|
||||
ifstream in;
|
||||
|
||||
#ifdef WITHIN_PANDA
|
||||
#ifdef WITHIN_PANDA
|
||||
filename.set_text();
|
||||
if (use_vfs) {
|
||||
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||
|
|
@ -149,19 +151,19 @@ read(Filename filename) {
|
|||
// the in pointer does not call the appropriate global delete
|
||||
// function; instead apparently calling the system delete
|
||||
// function. So we call the delete function by hand instead.
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
in->~istream();
|
||||
(*global_operator_delete)(in);
|
||||
#else
|
||||
#else
|
||||
delete in;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return okflag;
|
||||
}
|
||||
filename.open_read(in);
|
||||
#else
|
||||
#else
|
||||
in.open(filename.c_str());
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!in) {
|
||||
cerr << "Cannot open " << filename << " for reading.\n";
|
||||
|
|
@ -189,6 +191,7 @@ read(Filename filename) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool DCFile::
|
||||
read(istream &in, const string &filename) {
|
||||
cerr << "DCFile::read of " << filename << "\n";
|
||||
dc_init_parser(in, filename, *this);
|
||||
dcyyparse();
|
||||
dc_cleanup_parser();
|
||||
|
|
|
|||
Loading…
Reference in New Issue