Add new GPwin cutscene (#2875)
* Add new cutscene * Cleanup * Make all podiums arrive at the same time
This commit is contained in:
parent
6fc285b794
commit
7b185ce2f1
@ -58,14 +58,53 @@ using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
using namespace GUIEngine;
|
||||
|
||||
const float KARTS_X = -0.95f;
|
||||
const float KARTS_DELTA_X = 1.9f;
|
||||
const float KARTS_DELTA_Y = -0.55f;
|
||||
const float KARTS_INITIAL_Z = -10.0f;
|
||||
const float KARTS_DEST_Z = -1.8f;
|
||||
const float INITIAL_Y = 0.0f;
|
||||
const float INITIAL_PODIUM_Y = -1.33f;
|
||||
const float PODIUM_HEIGHT[3] = { 0.650f, 1.0f, 0.30f };
|
||||
/*
|
||||
* FIXME: Some of these are not yet fully implemented
|
||||
*/
|
||||
|
||||
// { 2nd, 1st, 3rd }
|
||||
|
||||
// The hight of the podiums' tops above y=0, used to put the kart on top
|
||||
const float PODIUMS_HEIGHT_FROM_Y0 = 0.78f;
|
||||
|
||||
// The hight of the podiums
|
||||
const float PODIUMS_HEIGHT = 1.56f;
|
||||
|
||||
// Initial locations and rotations (Begin Stage 1)
|
||||
const float KARTS_AND_PODIUMS_INITIAL_ROTATION[3] = { 90.0f, 90.0f, 90.0f };
|
||||
const float PODIUMS_INITIAL_Y[3] = { -2.51f, -2.61f, -2.51f };
|
||||
const float KARTS_INITIAL_X[3] = { 18.0f, 18.0f, 18.0f };
|
||||
//const float KARTS_INITIAL_Y[3] = { -1.73f, -1.83f, -1.73f };
|
||||
const float KARTS_INITIAL_Y[3] = {
|
||||
PODIUMS_INITIAL_Y[0] + PODIUMS_HEIGHT_FROM_Y0,
|
||||
PODIUMS_INITIAL_Y[1] + PODIUMS_HEIGHT_FROM_Y0,
|
||||
PODIUMS_INITIAL_Y[2] + PODIUMS_HEIGHT_FROM_Y0
|
||||
};
|
||||
const float KARTS_INITIAL_Z[3] = { 44.9f, 40.9f, 36.9f };
|
||||
|
||||
// Locations for karts to go to, should be the locations of the podiums (End Stage 1)
|
||||
const float KARTS_PODIUM_X[3] = { 20.5f, 20.75f, 21.0f };
|
||||
const float KARTS_PODIUM_Y[3] = {KARTS_INITIAL_Y[0], KARTS_INITIAL_Y[1], KARTS_INITIAL_Y[2]};
|
||||
const float KARTS_PODIUM_Z[3] = {KARTS_INITIAL_Z[0], KARTS_INITIAL_Z[1], KARTS_INITIAL_Z[2]};
|
||||
|
||||
// Rotations for karts to go to in Stage 2
|
||||
const float KARTS_AND_PODIUMS_FINAL_ROTATION[3] = { 270.0f, 270.0f, 270.0f };
|
||||
|
||||
// Locations for karts and podiums to go to in Stage 3
|
||||
//const float KARTS_FINAL_X[3] = KARTS_PODIUM_X; // Not yet implemented
|
||||
const float KARTS_FINAL_Y[3] = {
|
||||
PODIUMS_INITIAL_Y[0] + (PODIUMS_HEIGHT * 0.6f) + PODIUMS_HEIGHT_FROM_Y0,
|
||||
PODIUMS_INITIAL_Y[1] + (PODIUMS_HEIGHT * 0.9f) + PODIUMS_HEIGHT_FROM_Y0,
|
||||
PODIUMS_INITIAL_Y[2] + (PODIUMS_HEIGHT * 0.3f) + PODIUMS_HEIGHT_FROM_Y0
|
||||
};
|
||||
//const float KARTS_FINAL_Z[3] = KARTS_INITIAL_Z; // Not yet implemented
|
||||
const float PODIUMS_FINAL_Y[3] = {
|
||||
PODIUMS_INITIAL_Y[0] + PODIUMS_HEIGHT * 0.6f,
|
||||
PODIUMS_INITIAL_Y[1] + PODIUMS_HEIGHT * 0.9f,
|
||||
PODIUMS_INITIAL_Y[2] + PODIUMS_HEIGHT * 0.3f
|
||||
};
|
||||
|
||||
const float PODIUMS_AND_KARTS_SPEED_Y[3] = { 0.9f, 1.35f, 0.45f };
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( GrandPrixWin );
|
||||
|
||||
@ -194,14 +233,14 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
if (m_kart_node[k] != NULL)
|
||||
{
|
||||
|
||||
if (fabsf(m_kart_z[k] - KARTS_DEST_Z) > dt)
|
||||
if (fabsf(m_kart_x[k] - KARTS_PODIUM_X[k]) > dt)
|
||||
{
|
||||
if (m_kart_z[k] < KARTS_DEST_Z - dt)
|
||||
m_kart_z[k] += dt;
|
||||
else if (m_kart_z[k] > KARTS_DEST_Z + dt)
|
||||
m_kart_z[k] -= dt;
|
||||
if (m_kart_x[k] < KARTS_PODIUM_X[k] - dt)
|
||||
m_kart_x[k] += dt;
|
||||
else if (m_kart_x[k] > KARTS_PODIUM_X[k] + dt)
|
||||
m_kart_x[k] -= dt;
|
||||
else
|
||||
m_kart_z[k] = KARTS_DEST_Z;
|
||||
m_kart_x[k] = KARTS_PODIUM_X[k];
|
||||
karts_not_yet_done++;
|
||||
}
|
||||
|
||||
@ -224,7 +263,7 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
{
|
||||
if (m_kart_node[k] != NULL)
|
||||
{
|
||||
if (m_kart_rotation[k] < 180.f)
|
||||
if (m_kart_rotation[k] < KARTS_AND_PODIUMS_FINAL_ROTATION[k])
|
||||
{
|
||||
m_kart_rotation[k] += 25.0f*dt;
|
||||
|
||||
@ -234,7 +273,6 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
m_kart_node[k]->move(kart_pos, kart_rot, kart_scale, false, true);
|
||||
|
||||
core::vector3df podium_pos = m_podium_steps[k]->getInitXYZ();
|
||||
podium_pos.Y = INITIAL_PODIUM_Y;
|
||||
core::vector3df podium_rot(0, m_kart_rotation[k], 0);
|
||||
m_podium_steps[k]->move(podium_pos, podium_rot, core::vector3df(1.0f, 1.0f, 1.0f), false, true);
|
||||
|
||||
@ -254,20 +292,20 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
{
|
||||
if (m_kart_node[k] != NULL)
|
||||
{
|
||||
const float y_target = INITIAL_Y + PODIUM_HEIGHT[k];
|
||||
if (m_kart_y[k] < y_target + KARTS_DELTA_Y)
|
||||
if (m_kart_y[k] < KARTS_FINAL_Y[k])
|
||||
{
|
||||
m_kart_y[k] += dt*(PODIUM_HEIGHT[k]);
|
||||
m_kart_y[k] += dt * PODIUMS_AND_KARTS_SPEED_Y[k];
|
||||
core::vector3df kart_pos(m_kart_x[k], m_kart_y[k], m_kart_z[k]);
|
||||
core::vector3df kart_rot(0, m_kart_rotation[k], 0);
|
||||
core::vector3df kart_scale(1.0f, 1.0f, 1.0f);
|
||||
m_kart_node[k]->move(kart_pos, kart_rot, kart_scale, false, true);
|
||||
}
|
||||
|
||||
|
||||
core::vector3df podium_pos = m_podium_steps[k]->getInitXYZ();
|
||||
if (m_podium_y[k] < PODIUMS_FINAL_Y[k]) {
|
||||
core::vector3df podium_pos(m_podium_steps[k]->getInitXYZ().X, m_podium_y[k], m_podium_steps[k]->getInitXYZ().Z);
|
||||
core::vector3df podium_rot(0, m_kart_rotation[k], 0);
|
||||
podium_pos.Y = INITIAL_PODIUM_Y - (INITIAL_Y - m_kart_y[k]) - KARTS_DELTA_Y;
|
||||
m_podium_steps[k]->move(podium_pos, podium_rot, core::vector3df(1.0f, 1.0f, 1.0f), false, true);
|
||||
m_podium_y[k] += dt * PODIUMS_AND_KARTS_SPEED_Y[k];
|
||||
m_podium_steps[k]->move(core::vector3df(m_podium_x[k], m_podium_y[k], m_podium_z[k]), podium_rot, core::vector3df(1.0f, 1.0f, 1.0f), false, true);
|
||||
}
|
||||
}
|
||||
} // end for
|
||||
@ -310,10 +348,10 @@ void GrandPrixWin::setKarts(const std::string idents_arg[3])
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false, false);
|
||||
|
||||
m_kart_x[i] = KARTS_X + i*KARTS_DELTA_X;
|
||||
m_kart_y[i] = INITIAL_Y + KARTS_DELTA_Y;
|
||||
m_kart_z[i] = KARTS_INITIAL_Z;
|
||||
m_kart_rotation[i] = 0.0f;
|
||||
m_kart_x[i] = KARTS_INITIAL_X[i];
|
||||
m_kart_y[i] = KARTS_INITIAL_Y[i];
|
||||
m_kart_z[i] = KARTS_INITIAL_Z[i];
|
||||
m_kart_rotation[i] = KARTS_AND_PODIUMS_INITIAL_ROTATION[i];
|
||||
|
||||
core::vector3df kart_pos(m_kart_x[i], m_kart_y[i], m_kart_z[i]);
|
||||
core::vector3df kart_rot(0, 0, 0);
|
||||
@ -349,8 +387,12 @@ void GrandPrixWin::setKarts(const std::string idents_arg[3])
|
||||
|
||||
for (int k=0; k<3; k++)
|
||||
{
|
||||
core::vector3df podium_pos = m_podium_steps[k]->getInitXYZ();
|
||||
podium_pos.Y = INITIAL_PODIUM_Y;
|
||||
m_podium_x[k] = m_podium_steps[k]->getInitXYZ().X;
|
||||
m_podium_y[k] = PODIUMS_INITIAL_Y[k];
|
||||
m_podium_z[k] = m_podium_steps[k]->getInitXYZ().Z;
|
||||
|
||||
core::vector3df podium_pos(m_podium_x[k], m_podium_y[k], m_podium_z[k]);
|
||||
|
||||
m_podium_steps[k]->move(podium_pos, core::vector3df(0, 0, 0), core::vector3df(1.0f, 1.0f, 1.0f), false, true);
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,8 @@ class GrandPrixWin :
|
||||
float m_kart_x[3], m_kart_y[3], m_kart_z[3];
|
||||
float m_kart_rotation[3];
|
||||
|
||||
float m_podium_x[3], m_podium_y[3], m_podium_z[3];
|
||||
|
||||
public:
|
||||
// implement callbacks from parent class GUIEngine::Screen
|
||||
void init() OVERRIDE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user