made toggle-type script instructions more verbose

actorid
Marc Zinnschlag 14 years ago
parent 53e0e38862
commit f52e6bd5ef

@ -191,7 +191,7 @@ void MWScene::scaleObject (const std::string& handle, float scale)
}
void MWScene::toggleCollisionMode()
bool MWScene::toggleCollisionMode()
{
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = eng->PhysicActorMap.begin(); it != eng->PhysicActorMap.end();it++)
{
@ -203,6 +203,7 @@ void MWScene::toggleCollisionMode()
act->setGravity(0.);
act->setVerticalVelocity(0);
mFreeFly = true;
return false;
}
else
{
@ -210,11 +211,15 @@ void MWScene::toggleCollisionMode()
act->enableCollisions(true);
act->setGravity(4.);
act->setVerticalVelocity(0);
return true;
}
}
return false; // This should never happen, but it shall not bother us now, since
// this part of the code needs a rewrite anyway.
}
void MWScene::toggleRenderMode (int mode)
bool MWScene::toggleRenderMode (int mode)
{
switch (mode)
{
@ -223,6 +228,8 @@ void MWScene::toggleRenderMode (int mode)
// TODO use a proper function instead of accessing the member variable
// directly.
eng->setDebugRenderingMode (!eng->isDebugCreated);
break;
return eng->isDebugCreated;
}
return false;
}

@ -91,12 +91,14 @@ namespace MWRender
/// Toggle collision mode for player. If disabled player object should ignore
/// collisions and gravity.
void toggleCollisionMode();
/// \return Resulting mode
bool toggleCollisionMode();
/// Toggle render mode
/// \todo Using an int instead of a enum here to avoid cyclic includes. Will be fixed
/// when the mw*-refactoring is done.
void toggleRenderMode (int mode);
/// \return Resulting mode
bool toggleRenderMode (int mode);
};
}

@ -46,7 +46,9 @@ namespace MWScript
InterpreterContext& context
= static_cast<InterpreterContext&> (runtime.getContext());
context.getWorld().toggleCollisionMode();
bool enabled = context.getWorld().toggleCollisionMode();
context.messageBox (enabled ? "Collsion -> On" : "Collision -> Off");
}
};

@ -99,7 +99,11 @@ namespace MWScript
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
bool enabled =
context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug);
context.messageBox (enabled ?
"Collsion Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
}
};

@ -22,7 +22,9 @@ namespace MWScript
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
context.getWorld().toggleSky();
bool enabled = context.getWorld().toggleSky();
context.messageBox (enabled ? "Sky -> On" : "Sky -> Off");
}
};
@ -104,4 +106,3 @@ namespace MWScript
}
}
}

@ -645,12 +645,13 @@ namespace MWWorld
mSkyManager->setDate (mGlobalVariables->getInt ("day"), month);
}
void World::toggleSky()
bool World::toggleSky()
{
if (mSky)
{
mSky = false;
mSkyManager->disable();
return false;
}
else
{
@ -660,6 +661,7 @@ namespace MWWorld
mSkyManager->setDate (mGlobalVariables->getInt ("day"),
mGlobalVariables->getInt ("month"));
mSkyManager->enable();
return true;
}
}
@ -853,13 +855,13 @@ namespace MWWorld
mScene.doPhysics (duration, *this, actors);
}
void World::toggleCollisionMode()
bool World::toggleCollisionMode()
{
mScene.toggleCollisionMode();
return mScene.toggleCollisionMode();
}
void World::toggleRenderMode (RenderMode mode)
bool World::toggleRenderMode (RenderMode mode)
{
mScene.toggleRenderMode (mode);
return mScene.toggleRenderMode (mode);
}
}

@ -147,7 +147,8 @@ namespace MWWorld
void setDay (int day);
void toggleSky();
bool toggleSky();
///< \return Resulting mode
int getMasserPhase() const;
@ -185,12 +186,14 @@ namespace MWWorld
float duration);
///< Run physics simulation and modify \a world accordingly.
void toggleCollisionMode();
bool toggleCollisionMode();
///< Toggle collision mode for player. If disabled player object should ignore
/// collisions and gravity.
///< \return Resulting mode
void toggleRenderMode (RenderMode mode);
bool toggleRenderMode (RenderMode mode);
///< Toggle a render mode.
///< \return Resulting mode
};
}

Loading…
Cancel
Save