Fix order of ghost replay difficulties depending on race result
This commit is contained in:
parent
c09305b236
commit
7dc8f3e958
@ -32,11 +32,13 @@
|
|||||||
#include "LinearMath/btQuaternion.h"
|
#include "LinearMath/btQuaternion.h"
|
||||||
|
|
||||||
GhostKart::GhostKart(const std::string& ident, unsigned int world_kart_id,
|
GhostKart::GhostKart(const std::string& ident, unsigned int world_kart_id,
|
||||||
int position, float color_hue)
|
int position, float color_hue,
|
||||||
|
const ReplayPlay::ReplayData& rd)
|
||||||
: Kart(ident, world_kart_id,
|
: Kart(ident, world_kart_id,
|
||||||
position, btTransform(btQuaternion(0, 0, 0, 1)),
|
position, btTransform(btQuaternion(0, 0, 0, 1)),
|
||||||
HANDICAP_NONE,
|
HANDICAP_NONE,
|
||||||
std::make_shared<RenderInfo>(color_hue, true/*transparent*/))
|
std::make_shared<RenderInfo>(color_hue, true/*transparent*/)),
|
||||||
|
m_replay_data(rd)
|
||||||
{
|
{
|
||||||
} // GhostKart
|
} // GhostKart
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#define HEADER_GHOST_KART_HPP
|
#define HEADER_GHOST_KART_HPP
|
||||||
|
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
#include "replay/replay_base.hpp"
|
#include "replay/replay_play.hpp"
|
||||||
#include "utils/cpp2011.hpp"
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
#include "LinearMath/btTransform.h"
|
#include "LinearMath/btTransform.h"
|
||||||
@ -46,6 +46,8 @@ private:
|
|||||||
|
|
||||||
std::vector<ReplayBase::KartReplayEvent> m_all_replay_events;
|
std::vector<ReplayBase::KartReplayEvent> m_all_replay_events;
|
||||||
|
|
||||||
|
ReplayPlay::ReplayData m_replay_data;
|
||||||
|
|
||||||
unsigned int m_last_egg_idx = 0;
|
unsigned int m_last_egg_idx = 0;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -54,7 +56,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GhostKart(const std::string& ident, unsigned int world_kart_id,
|
GhostKart(const std::string& ident, unsigned int world_kart_id,
|
||||||
int position, float color_hue);
|
int position, float color_hue,
|
||||||
|
const ReplayPlay::ReplayData& rd);
|
||||||
virtual void update(int ticks) OVERRIDE;
|
virtual void update(int ticks) OVERRIDE;
|
||||||
virtual void updateGraphics(float dt) OVERRIDE;
|
virtual void updateGraphics(float dt) OVERRIDE;
|
||||||
virtual void reset() OVERRIDE;
|
virtual void reset() OVERRIDE;
|
||||||
@ -101,6 +104,9 @@ public:
|
|||||||
virtual void kartIsInRestNow() OVERRIDE {}
|
virtual void kartIsInRestNow() OVERRIDE {}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual void makeKartRest() OVERRIDE {}
|
virtual void makeKartRest() OVERRIDE {}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
const ReplayPlay::ReplayData& getReplayData() const
|
||||||
|
{ return m_replay_data; }
|
||||||
}; // GhostKart
|
}; // GhostKart
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line, bool second_replay)
|
|||||||
ReplayData &rd = m_replay_file_list[replay_index];
|
ReplayData &rd = m_replay_file_list[replay_index];
|
||||||
m_ghost_karts.push_back(std::make_shared<GhostKart>
|
m_ghost_karts.push_back(std::make_shared<GhostKart>
|
||||||
(rd.m_kart_list.at(kart_num-first_loaded_f_num), kart_num, kart_num + 1,
|
(rd.m_kart_list.at(kart_num-first_loaded_f_num), kart_num, kart_num + 1,
|
||||||
rd.m_kart_color.at(kart_num-first_loaded_f_num)));
|
rd.m_kart_color.at(kart_num-first_loaded_f_num), rd));
|
||||||
m_ghost_karts[kart_num]->init(RaceManager::KT_GHOST);
|
m_ghost_karts[kart_num]->init(RaceManager::KT_GHOST);
|
||||||
Controller* controller = new GhostController(getGhostKart(kart_num).get(),
|
Controller* controller = new GhostController(getGhostKart(kart_num).get(),
|
||||||
rd.m_name_list[kart_num-first_loaded_f_num]);
|
rd.m_name_list[kart_num-first_loaded_f_num]);
|
||||||
|
@ -39,10 +39,10 @@
|
|||||||
#include "guiengine/widgets/label_widget.hpp"
|
#include "guiengine/widgets/label_widget.hpp"
|
||||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "karts/abstract_kart.hpp"
|
|
||||||
#include "karts/controller/controller.hpp"
|
#include "karts/controller/controller.hpp"
|
||||||
#include "karts/controller/end_controller.hpp"
|
#include "karts/controller/end_controller.hpp"
|
||||||
#include "karts/controller/local_player_controller.hpp"
|
#include "karts/controller/local_player_controller.hpp"
|
||||||
|
#include "karts/ghost_kart.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
#include "modes/cutscene_world.hpp"
|
#include "modes/cutscene_world.hpp"
|
||||||
@ -1964,14 +1964,20 @@ void RaceResultGUI::unload()
|
|||||||
core::stringw difficulty_two;
|
core::stringw difficulty_two;
|
||||||
if (RaceManager::get()->hasGhostKarts() && ReplayPlay::get()->isSecondReplayEnabled())
|
if (RaceManager::get()->hasGhostKarts() && ReplayPlay::get()->isSecondReplayEnabled())
|
||||||
{
|
{
|
||||||
unsigned idw = ReplayPlay::get()->getCurrentReplayFileIndex();
|
WorldWithRank* wwr = dynamic_cast<WorldWithRank*>(World::getWorld());
|
||||||
unsigned idx = ReplayPlay::get()->getSecondReplayFileIndex();
|
for (unsigned k = 0; k < wwr->getNumKarts(); k++)
|
||||||
const ReplayPlay::ReplayData& rd1 = ReplayPlay::get()->getReplayData(idw);
|
{
|
||||||
const ReplayPlay::ReplayData& rd2 = ReplayPlay::get()->getReplayData(idx);
|
GhostKart* gk = dynamic_cast<GhostKart*>(wwr->getKartAtPosition(k + 1));
|
||||||
difficulty_one = RaceManager::get()->getDifficultyName((RaceManager::Difficulty)rd1.m_difficulty);
|
if (!gk)
|
||||||
difficulty_two = RaceManager::get()->getDifficultyName((RaceManager::Difficulty)rd2.m_difficulty);
|
continue;
|
||||||
|
const ReplayPlay::ReplayData& rd = gk->getReplayData();
|
||||||
|
if (difficulty_one.empty())
|
||||||
|
difficulty_one = RaceManager::get()->getDifficultyName((RaceManager::Difficulty)rd.m_difficulty);
|
||||||
|
else if (difficulty_two.empty())
|
||||||
|
difficulty_two = RaceManager::get()->getDifficultyName((RaceManager::Difficulty)rd.m_difficulty);
|
||||||
|
}
|
||||||
if (difficulty_one != difficulty_two)
|
if (difficulty_one != difficulty_two)
|
||||||
difficulty_name = difficulty_one +" / "+ difficulty_two;
|
difficulty_name = difficulty_one + L" / " + difficulty_two;
|
||||||
else
|
else
|
||||||
difficulty_name = difficulty_one;
|
difficulty_name = difficulty_one;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user