1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-15 18:39:51 +00:00

Merge remote-tracking branch 'scrawl/master'

This commit is contained in:
Marc Zinnschlag 2013-11-30 09:45:46 +01:00
commit 016500af98
13 changed files with 49 additions and 27 deletions

View File

@ -147,6 +147,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mEncoding(ToUTF8::WINDOWS_1252)
, mEncoder(NULL)
, mActivationDistanceOverride(-1)
, mGrab(true)
{
std::srand ( std::time(NULL) );
@ -370,7 +371,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
std::string keybinderUser = (mCfgMgr.getUserPath() / "input.xml").string();
bool keybinderUserExists = boost::filesystem::exists(keybinderUser);
MWInput::InputManager* input = new MWInput::InputManager (*mOgre, *this, keybinderUser, keybinderUserExists);
MWInput::InputManager* input = new MWInput::InputManager (*mOgre, *this, keybinderUser, keybinderUserExists, mGrab);
mEnvironment.setInputManager (input);
MWGui::WindowManager* window = new MWGui::WindowManager(

View File

@ -79,6 +79,8 @@ namespace OMW
bool mScriptConsoleMode;
std::string mStartupScript;
int mActivationDistanceOverride;
// Grab mouse?
bool mGrab;
Compiler::Extensions mExtensions;
Compiler::Context *mScriptContext;
@ -152,6 +154,8 @@ namespace OMW
/// Start as a new game.
void setNewGame(bool newGame);
void setGrabMouse(bool grab) { mGrab = grab; }
/// Initialise and enter main loop.
void go();

View File

@ -154,6 +154,8 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
("fallback", bpo::value<FallbackMap>()->default_value(FallbackMap(), "")
->multitoken()->composing(), "fallback values")
("no-grab", "Don't grab mouse cursor")
("activate-dist", bpo::value <int> ()->default_value (-1), "activation distance override");
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv)
@ -184,6 +186,8 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
if (!run)
return false;
engine.setGrabMouse(!variables.count("no-grab"));
// Font encoding settings
std::string encoding(variables["encoding"].as<std::string>());
std::cout << ToUTF8::encodingUsingMessage(encoding) << std::endl;

View File

@ -110,11 +110,6 @@ namespace MWGui
else
{
const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
if (mousePos == lastPressed) // mouseclick makes tooltip disappear
return;
if (mousePos.left == mLastMouseX && mousePos.top == mLastMouseY)
{
mRemainingDelay -= frameDuration;

View File

@ -80,7 +80,7 @@ namespace MWGui
}
void TradeWindow::startTrade(const MWWorld::Ptr& actor)
{
{
mPtr = actor;
mCurrentBalance = 0;
@ -102,6 +102,8 @@ namespace MWGui
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
// or we end up using a possibly invalid model.
setTitle(MWWorld::Class::get(actor).getName(actor));
onFilterChanged(mFilterAll);
}
void TradeWindow::onFilterChanged(MyGUI::Widget* _sender)

View File

@ -87,7 +87,7 @@ namespace MWInput
{
InputManager::InputManager(OEngine::Render::OgreRenderer &ogre,
OMW::Engine& engine,
const std::string& userFile, bool userFileExists)
const std::string& userFile, bool userFileExists, bool grab)
: mOgre(ogre)
, mPlayer(NULL)
, mEngine(engine)
@ -111,7 +111,7 @@ namespace MWInput
Ogre::RenderWindow* window = ogre.getWindow ();
mInputManager = new SFO::InputWrapper(mOgre.getSDLWindow(), mOgre.getWindow());
mInputManager = new SFO::InputWrapper(mOgre.getSDLWindow(), mOgre.getWindow(), grab);
mInputManager->setMouseEventCallback (this);
mInputManager->setKeyboardEventCallback (this);
mInputManager->setWindowEventCallback(this);

View File

@ -61,7 +61,7 @@ namespace MWInput
public:
InputManager(OEngine::Render::OgreRenderer &_ogre,
OMW::Engine& engine,
const std::string& userFile, bool userFileExists);
const std::string& userFile, bool userFileExists, bool grab);
virtual ~InputManager();

View File

@ -160,6 +160,8 @@ namespace MWMechanics
void Actors::calculateRestoration (const MWWorld::Ptr& ptr, float duration)
{
if (ptr.getClass().getCreatureStats(ptr).isDead())
return;
CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
const MWWorld::Store<ESM::GameSetting>& settings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();

View File

@ -1066,6 +1066,7 @@ void Animation::addEffect(const std::string &model, int effectId, bool loop, con
for(size_t i = 0;i < params.mObjects.mParticles.size(); ++i)
{
Ogre::ParticleSystem* partSys = params.mObjects.mParticles[i];
sh::Factory::getInstance()._ensureMaterial(partSys->getMaterialName(), "Default");
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(partSys->getMaterialName());
static int count = 0;
Ogre::String materialName = "openmw/" + Ogre::StringConverter::toString(count++);

View File

@ -490,10 +490,20 @@ namespace MWScript
ipos.pos[0] = pos.x;
ipos.pos[1] = pos.y;
ipos.pos[2] = pos.z;
ipos.rot[0] = 0;
ipos.rot[1] = 0;
ipos.rot[2] = 0;
if (actor.getClass().isActor())
{
// TODO: should this depend on the 'direction' parameter?
ipos.rot[0] = 0;
ipos.rot[1] = 0;
ipos.rot[2] = 0;
}
else
{
ipos.rot[0] = actor.getRefData().getPosition().rot[0];
ipos.rot[1] = actor.getRefData().getPosition().rot[1];
ipos.rot[2] = actor.getRefData().getPosition().rot[2];
}
// create item
MWWorld::CellStore* store = actor.getCell();
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), itemID, count);

View File

@ -1127,10 +1127,6 @@ namespace MWWorld
void World::doPhysics(float duration)
{
/* No duration? Shouldn't be any movement, then. */
if(duration <= 0.0f)
return;
processDoors(duration);
moveProjectiles(duration);
@ -1547,12 +1543,15 @@ namespace MWWorld
MWWorld::Ptr dropped =
MWWorld::Class::get(object).copyToCell(object, cell, pos);
Ogre::Vector3 min, max;
if (mPhysics->getObjectAABB(object, min, max)) {
float *pos = dropped.getRefData().getPosition().pos;
pos[0] -= (min.x + max.x) / 2;
pos[1] -= (min.y + max.y) / 2;
pos[2] -= min.z;
if (object.getClass().isActor())
{
Ogre::Vector3 min, max;
if (mPhysics->getObjectAABB(object, min, max)) {
float *pos = dropped.getRefData().getPosition().pos;
pos[0] -= (min.x + max.x) / 2;
pos[1] -= (min.y + max.y) / 2;
pos[2] -= min.z;
}
}
if (mWorldScene->isCellActive(cell)) {
@ -2086,6 +2085,8 @@ namespace MWWorld
iter->mEffectID);
projectileModel = magicEffect->mBolt;
if (projectileModel.empty())
projectileModel = "VFX_DefaultBolt";
static const std::string schools[] = {
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"

View File

@ -9,7 +9,7 @@ namespace SFO
{
/// \brief General purpose wrapper for OGRE applications around SDL's event
/// queue, mostly used for handling input-related events.
InputWrapper::InputWrapper(SDL_Window* window, Ogre::RenderWindow* ogreWindow) :
InputWrapper::InputWrapper(SDL_Window* window, Ogre::RenderWindow* ogreWindow, bool grab) :
mSDLWindow(window),
mOgreWindow(ogreWindow),
mWarpCompensate(false),
@ -27,7 +27,8 @@ namespace SFO
mWindowHasFocus(true),
mWantGrab(false),
mWantRelative(false),
mWantMouseVisible(false)
mWantMouseVisible(false),
mAllowGrab(grab)
{
_setupOISKeys();
}
@ -226,7 +227,7 @@ namespace SFO
void InputWrapper::updateMouseSettings()
{
mGrabPointer = mWantGrab && mMouseInWindow && mWindowHasFocus;
SDL_SetWindowGrab(mSDLWindow, mGrabPointer ? SDL_TRUE : SDL_FALSE);
SDL_SetWindowGrab(mSDLWindow, mGrabPointer && mAllowGrab ? SDL_TRUE : SDL_FALSE);
SDL_ShowCursor(mWantMouseVisible || !mWindowHasFocus);

View File

@ -16,7 +16,7 @@ namespace SFO
class InputWrapper
{
public:
InputWrapper(SDL_Window *window, Ogre::RenderWindow* ogreWindow);
InputWrapper(SDL_Window *window, Ogre::RenderWindow* ogreWindow, bool grab);
~InputWrapper();
void setMouseEventCallback(MouseListener* listen) { mMouseListener = listen; }
@ -62,6 +62,7 @@ namespace SFO
bool mWarpCompensate;
bool mWrapPointer;
bool mAllowGrab;
bool mWantMouseVisible;
bool mWantGrab;
bool mWantRelative;