mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 20:02:40 +01:00
Adjust game map a little more
This commit is contained in:
parent
cbebbbed87
commit
87ca358717
@ -259,6 +259,7 @@ public:
|
||||
void loadCutscene(const std::string& name);
|
||||
void startCutscene();
|
||||
void clearCutscene();
|
||||
bool isCutsceneDone();
|
||||
|
||||
MADStream fgAudio;
|
||||
bool cutsceneAudioLoaded;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user