1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 11:22:45 +01:00

Adjust game map a little more

This commit is contained in:
Daniel Evans 2015-01-25 18:42:29 +00:00
parent cbebbbed87
commit 87ca358717
4 changed files with 39 additions and 13 deletions

View File

@ -259,6 +259,7 @@ public:
void loadCutscene(const std::string& name);
void startCutscene();
void clearCutscene();
bool isCutsceneDone();
MADStream fgAudio;
bool cutsceneAudioLoaded;

View File

@ -712,6 +712,19 @@ void GameWorld::clearCutscene()
state.cutsceneStartTime = -1.f;
}
bool GameWorld::isCutsceneDone()
{
if( state.currentCutscene ) {
float time = gameTime - state.cutsceneStartTime;
if( state.skipCutscene ) {
return true;
}
return time > state.currentCutscene->tracks.duration;
}
return true;
}
void GameWorld::loadSpecialCharacter(const unsigned short index, const std::string &name)
{
std::string lowerName(name);

View File

@ -185,21 +185,10 @@ void IngameState::tick(float dt)
void IngameState::draw(sf::RenderWindow& w)
{
MapRenderer::MapInfo map;
map.scale = 0.5f;
map.viewport = glm::vec2(w.getSize().x, w.getSize().y);
map.mapPos = glm::vec2(map.viewport.x * 0.2f, map.viewport.y * 0.2f);
float aspect = map.viewport.x / map.viewport.y;
map.mapSize = map.viewport * 0.3f;
map.mapPos.x /= aspect;
map.mapSize.x /= aspect;
if( getWorld()->state.player )
if( !(getWorld()->state.isCinematic || !getWorld()->isCutsceneDone()) )
{
map.center = glm::vec2(getWorld()->state.player->getCharacter()->getPosition());
drawHUD(w);
}
getWorld()->renderer.map.draw(map);
State::draw(w);
}
@ -305,3 +294,23 @@ const ViewCamera &IngameState::getCamera()
{
return _look;
}
void IngameState::drawHUD(const sf::RenderWindow& w)
{
MapRenderer::MapInfo map;
map.scale = 0.5f;
map.viewport = glm::vec2(w.getSize().x, w.getSize().y);
map.mapPos = glm::vec2(map.viewport.x * 0.2f, map.viewport.y * 0.2f);
float aspect = map.viewport.x / map.viewport.y;
map.mapSize = map.viewport * 0.3f;
map.mapPos.x /= aspect;
map.mapSize.x /= aspect;
if( getWorld()->state.player )
{
map.center = glm::vec2(getWorld()->state.player->getCharacter()->getPosition());
}
getWorld()->renderer.map.draw(map);
}

View File

@ -29,6 +29,9 @@ public:
virtual void handleEvent(const sf::Event& event);
const ViewCamera& getCamera();
private:
void drawHUD(const sf::RenderWindow& w);
};
#endif // INGAMESTATE_HPP