Various fixes

This commit is contained in:
gugus 2012-05-29 16:45:43 +02:00
parent f83ffecae5
commit a711a3ebe1
5 changed files with 31 additions and 12 deletions

View file

@ -147,5 +147,7 @@ op 0x2000150: ForceGreeting, explicit reference
op 0x2000151: ToggleFullHelp
op 0x2000152: Goodbye
op 0x2000153: SetScale
op 0x2000154: SetAngle
op 0x2000154: SetScale, explicit reference
op 0x2000155: SetAngle
op 0x2000156: SetAngle, explicit reference
opcodes 0x2000155-0x3ffffff unused

View file

@ -592,7 +592,9 @@ namespace MWScript
const int opcodeModDispositionExplicit = 0x200014e;
const int opcodeSetScale = 0x2000153;
const int opcodeSetAngle = 0x2000154;
const int opcodeSetScaleExplicit = 0x2000154;
const int opcodeSetAngle = 0x2000155;
const int opcodeSetAngleExplicit = 0x2000156;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -677,8 +679,8 @@ namespace MWScript
opcodeModDispositionExplicit);
extensions.registerFunction("getpcrank",'l',"/S",opcodeGetPCRank,opcodeGetPCRankExplicit);
extensions.registerInstruction("setscale","/l",opcodeSetScale);
extensions.registerInstruction("setangle","/Sl",opcodeSetAngle);
extensions.registerInstruction("setscale","l",opcodeSetScale,opcodeSetScaleExplicit);
extensions.registerInstruction("setangle","Sl",opcodeSetAngle,opcodeSetAngleExplicit);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -752,7 +754,9 @@ namespace MWScript
interpreter.installSegment3(opcodeGetPCRankExplicit,new OpGetPCRank<ExplicitRef>);
interpreter.installSegment5(opcodeSetScale,new OpSetScale<ImplicitRef>);
interpreter.installSegment5(opcodeSetScaleExplicit,new OpSetScale<ExplicitRef>);
interpreter.installSegment5(opcodeSetAngle,new OpSetAngle<ImplicitRef>);
interpreter.installSegment5(opcodeSetAngleExplicit,new OpSetAngle<ExplicitRef>);
}
}
}

View file

@ -290,8 +290,6 @@ namespace MWWorld
{
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
{
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
// start positions others than 0, 0, 0
act->setRotation(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w));
}
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle))
@ -304,8 +302,6 @@ namespace MWWorld
{
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle))
{
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
// start positions others than 0, 0, 0
//body->setWorldTransform(btTransform().se
}
}

View file

@ -668,6 +668,7 @@ namespace MWWorld
Ogre::Quaternion rotz(Ogre::Degree(z),Ogre::Vector3::UNIT_Z);
ptr.getRefData().getBaseNode()->setOrientation(rotx*roty*rotz);
mPhysics->rotateObject(Class::get(ptr).getId(ptr),ptr.getRefData().getBaseNode()->getOrientation());
std::cout << Class::get(ptr).getId(ptr);
}
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const

View file

@ -392,8 +392,16 @@ namespace Physic
RigidBody* PhysicEngine::getRigidBody(std::string name)
{
RigidBody* body = RigidBodyMap[name];
return body;
RigidBodyContainer::iterator it = RigidBodyMap.find(name);
if (it != RigidBodyMap.end() )
{
RigidBody* body = RigidBodyMap[name];
return body;
}
else
{
return 0;
}
}
void PhysicEngine::stepSimulation(double deltaT)
@ -450,8 +458,16 @@ namespace Physic
PhysicActor* PhysicEngine::getCharacter(std::string name)
{
PhysicActor* act = PhysicActorMap[name];
return act;
PhysicActorContainer::iterator it = PhysicActorMap.find(name);
if (it != PhysicActorMap.end() )
{
PhysicActor* act = PhysicActorMap[name];
return act;
}
else
{
return 0;
}
}
void PhysicEngine::emptyEventLists(void)