Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
some work for rotation/scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
gugus committed May 28, 2012
1 parent 51b6d5c commit 77084b2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions apps/openmw/mwscript/statsextensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,22 @@ namespace MWScript
}
};

template<class R>
class OpSetScale : public Interpreter::Opcode0
{
public:

virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);

Interpreter::Type_Float scale = runtime[0].mInteger;
runtime.pop();

MWBase::Environment::get().getWorld()->scaleObject(ptr,scale);
}
};

const int numberOfAttributes = 8;

const int opcodeGetAttribute = 0x2000027;
Expand Down
10 changes: 7 additions & 3 deletions apps/openmw/mwworld/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,13 +619,17 @@ namespace MWWorld
scale = scale/ptr.getRefData().getBaseNode()->getScale().x;
ptr.getRefData().getBaseNode()->setScale(scale,scale,scale);
mPhysics->scaleObject( Class::get(ptr).getId(ptr), scale );
/// \todo cell change for non-player ref

//mRendering->moveObject (ptr, Ogre::Vector3 (x, y, z));
}

void World::rotateObject (Ptr ptr,float x,float y,float z)
{
MWWorld::Class::get(ptr).adjustRotation(ptr,x,y,z);

ptr.getRefData().getPosition().rot[0] = x;
ptr.getRefData().getPosition().rot[0] = y;
ptr.getRefData().getPosition().rot[0] = z;
//ptr.getRefData().getBaseNode()->rotate(ptr.getRefData().getBaseNode()->get
//mPhysics->scaleObject( Class::get(ptr).getId(ptr), scale );
}

void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const
Expand Down

0 comments on commit 77084b2

Please sign in to comment.