Merge branch 'master' of https://github.com/supertuxkart/stk-code into ScriptEngine
This commit is contained in:
commit
e08bbb5138
@ -55,9 +55,20 @@
|
||||
|
||||
<div layout="horizontal-row" width="100%" proportion="1">
|
||||
<spacer width="70" height="10"/>
|
||||
<checkbox id="ssao"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Ambient Occlusion" I18N="Video settings"/>
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="ssao"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Ambient Occlusion" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="global_illumination"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Global illumination" I18N="Video settings"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="10" />
|
||||
|
@ -61,5 +61,6 @@
|
||||
</box>
|
||||
<spacer width="20" height="15"/>
|
||||
</div>
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
</stkgui>
|
||||
|
@ -70,5 +70,6 @@
|
||||
</box>
|
||||
<spacer width="20" height="15"/>
|
||||
</div>
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
</stkgui>
|
||||
|
@ -89,6 +89,19 @@ static PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB;
|
||||
static HGLRC getMeAGLContext(HDC HDc)
|
||||
{
|
||||
HGLRC hrc = 0;
|
||||
int ctx44[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
hrc = wglCreateContextAttribs_ARB(HDc, 0, ctx44);
|
||||
if (hrc)
|
||||
return hrc;
|
||||
|
||||
int ctx40[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||
|
@ -272,10 +272,12 @@ void PlayerManager::save()
|
||||
<< m_current_player->getName() << L"\"/>\n";
|
||||
}
|
||||
|
||||
// Save all non-guest players
|
||||
PlayerProfile *player;
|
||||
for_in(player, m_all_players)
|
||||
{
|
||||
player->save(players_file);
|
||||
if(!player->isGuestAccount())
|
||||
player->save(players_file);
|
||||
}
|
||||
players_file << L"</players>\n";
|
||||
players_file.close();
|
||||
@ -373,10 +375,36 @@ void PlayerManager::addDefaultPlayer()
|
||||
// screen to be shown.
|
||||
m_all_players.push_back(new Online::OnlinePlayerProfile(username.c_str()) );
|
||||
|
||||
// add default guest player
|
||||
m_all_players.push_back(new Online::OnlinePlayerProfile(_LTR("Guest"), /*guest*/true));
|
||||
} // addDefaultPlayer
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Makes sure at least n guest players exist. This is used by the multiplayer
|
||||
* KartSelection screen to make sure enough guest players can be picked by
|
||||
* the players.
|
||||
* \param n Minimum number of guest players that must exist.
|
||||
*/
|
||||
void PlayerManager::createGuestPlayers(int n)
|
||||
{
|
||||
int num_guests = m_all_players.size() - getNumNonGuestPlayers();
|
||||
for(int i=num_guests; i<n; i++)
|
||||
{
|
||||
core::stringw guest_name;
|
||||
if(i==0)
|
||||
{
|
||||
// I18N: Name of first guest player (without number)
|
||||
guest_name = _LTR("Guest");
|
||||
}
|
||||
else
|
||||
{
|
||||
// I18N: Name of further guest players, with a 1, 2, ... attached
|
||||
guest_name = _LTR("Guest %d", i);
|
||||
}
|
||||
PlayerProfile *guest = new Online::OnlinePlayerProfile(guest_name,
|
||||
/*guest*/ true);
|
||||
m_all_players.push_back(guest);
|
||||
}
|
||||
} // createGuestPlayers
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns the number of 'real' (non-guest) players.
|
||||
*/
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
unsigned int getUniqueId() const;
|
||||
void addDefaultPlayer();
|
||||
PlayerProfile* addNewPlayer(const irr::core::stringw& name);
|
||||
void createGuestPlayers(int n);
|
||||
void deletePlayer(PlayerProfile *player);
|
||||
void setCurrentPlayer(PlayerProfile *player);
|
||||
const PlayerProfile *getPlayerById(unsigned int id);
|
||||
|
@ -146,7 +146,7 @@ void PlayerProfile::initRemainingData()
|
||||
*/
|
||||
void PlayerProfile::addIcon()
|
||||
{
|
||||
if (m_icon_filename.size() > 0)
|
||||
if (m_icon_filename.size() > 0 || isGuestAccount())
|
||||
return;
|
||||
|
||||
int n = m_unique_id % kart_properties_manager->getNumberOfKarts();
|
||||
|
@ -71,6 +71,9 @@ PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
PFNGLBLENDCOLORPROC glBlendColor;
|
||||
PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
||||
PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
||||
PFNGLTEXSTORAGE1DPROC glTexStorage1D;
|
||||
PFNGLTEXSTORAGE2DPROC glTexStorage2D;
|
||||
PFNGLTEXSTORAGE3DPROC glTexStorage3D;
|
||||
#endif
|
||||
|
||||
static bool is_gl_init = false;
|
||||
@ -220,6 +223,9 @@ void initGL()
|
||||
glBlendColor = (PFNGLBLENDCOLORPROC)IRR_OGL_LOAD_EXTENSION("glBlendColor");
|
||||
glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glCompressedTexImage2D");
|
||||
glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)IRR_OGL_LOAD_EXTENSION("glGetCompressedTexImage");
|
||||
glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage1D");
|
||||
glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage2D");
|
||||
glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage3D");
|
||||
#ifdef DEBUG
|
||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)IRR_OGL_LOAD_EXTENSION("glDebugMessageCallbackARB");
|
||||
#endif
|
||||
|
@ -94,6 +94,9 @@ extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
extern PFNGLBLENDCOLORPROC glBlendColor;
|
||||
extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
||||
extern PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
||||
extern PFNGLTEXSTORAGE1DPROC glTexStorage1D;
|
||||
extern PFNGLTEXSTORAGE2DPROC glTexStorage2D;
|
||||
extern PFNGLTEXSTORAGE3DPROC glTexStorage3D;
|
||||
#ifdef DEBUG
|
||||
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
#endif
|
||||
|
@ -114,6 +114,7 @@ enum QueryPerf
|
||||
Q_TRANSPARENT,
|
||||
Q_PARTICLES,
|
||||
Q_DISPLACEMENT,
|
||||
Q_DOF,
|
||||
Q_GODRAYS,
|
||||
Q_BLOOM,
|
||||
Q_TONEMAP,
|
||||
@ -360,12 +361,13 @@ private:
|
||||
void renderTransparent();
|
||||
void renderParticles();
|
||||
void computeSunVisibility();
|
||||
void renderScene(scene::ICameraSceneNode * const camnode, std::vector<GlowData>& glows, float dt, bool hasShadows);
|
||||
void renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadows);
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height);
|
||||
void renderShadows();
|
||||
void renderGlow(std::vector<GlowData>& glows);
|
||||
void renderSSAO();
|
||||
void renderLights(scene::ICameraSceneNode * const camnode, float dt);
|
||||
unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt);
|
||||
void renderLights(unsigned pointlightCount);
|
||||
void renderDisplacement();
|
||||
void doScreenShot();
|
||||
public:
|
||||
|
@ -718,8 +718,11 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
|
||||
if (UserConfigParams::m_dof)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- DoF", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_DOF));
|
||||
renderDoF(*out_fbo, in_fbo->getRTT()[0]);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -143,8 +143,9 @@ void IrrDriver::renderGLSL(float dt)
|
||||
|
||||
const core::recti &viewport = camera->getViewport();
|
||||
|
||||
unsigned plc = UpdateLightsInfo(camnode, dt);
|
||||
computeCameraMatrix(camnode, viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
|
||||
renderScene(camnode, glows, dt, track->hasShadows());
|
||||
renderScene(camnode, plc, glows, dt, track->hasShadows());
|
||||
|
||||
// Debug physic
|
||||
// Note that drawAll must be called before rendering
|
||||
@ -260,7 +261,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
getPostProcessing()->update(dt);
|
||||
}
|
||||
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, std::vector<GlowData>& glows, float dt, bool hasShadow)
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadow)
|
||||
{
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
||||
|
||||
@ -287,7 +288,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, std::vector
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_LIGHT));
|
||||
renderLights(camnode, dt);
|
||||
renderLights(pointlightcount);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
@ -740,7 +741,7 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
|
||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
}
|
||||
if (!(tick % 100))
|
||||
if ((tick % 100) == 2)
|
||||
rsm_matrix = sun_ortho_matrix[3];
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
core::vector3df campos = camnode->getAbsolutePosition();
|
||||
@ -900,37 +901,8 @@ static void renderPointLights(unsigned count)
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, count);
|
||||
}
|
||||
|
||||
void IrrDriver::renderLights(scene::ICameraSceneNode * const camnode, float dt)
|
||||
unsigned IrrDriver::UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt)
|
||||
{
|
||||
//RH
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
m_rtts->getRH().Bind();
|
||||
glUseProgram(FullScreenShader::RadianceHintsConstructionShader::Program);
|
||||
glBindVertexArray(FullScreenShader::RadianceHintsConstructionShader::vao);
|
||||
setTexture(0, m_rtts->getRSM().getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||
setTexture(1, m_rtts->getRSM().getRTT()[1], GL_LINEAR, GL_LINEAR);
|
||||
setTexture(2, m_rtts->getRSM().getDepthTexture(), GL_LINEAR, GL_LINEAR);
|
||||
FullScreenShader::RadianceHintsConstructionShader::setUniforms(rsm_matrix, rh_matrix, rh_extend, 0, 1, 2);
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 32);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < sun_ortho_matrix.size(); i++)
|
||||
sun_ortho_matrix[i] *= getInvViewMatrix();
|
||||
m_rtts->getFBO(FBO_COMBINED_TMP1_TMP2).Bind();
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
glClearColor(.5, .5, .5, .5);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return;
|
||||
|
||||
if (UserConfigParams::m_gi)
|
||||
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
|
||||
|
||||
if (SkyboxCubeMap)
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
const u32 lightcount = m_lights.size();
|
||||
const core::vector3df &campos = camnode->getAbsolutePosition();
|
||||
|
||||
@ -940,10 +912,6 @@ void IrrDriver::renderLights(scene::ICameraSceneNode * const camnode, float dt)
|
||||
if (!m_lights[i]->isPointLight())
|
||||
{
|
||||
m_lights[i]->render();
|
||||
if (UserConfigParams::m_shadows && World::getWorld()->getTrack()->hasShadows())
|
||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
||||
else
|
||||
m_post_processing->renderSunlight();
|
||||
continue;
|
||||
}
|
||||
const core::vector3df &lightpos = (m_lights[i]->getAbsolutePosition() - campos);
|
||||
@ -998,8 +966,51 @@ void IrrDriver::renderLights(scene::ICameraSceneNode * const camnode, float dt)
|
||||
}
|
||||
|
||||
lightnum++;
|
||||
return lightnum;
|
||||
}
|
||||
|
||||
renderPointLights(MIN2(lightnum, MAXLIGHT));
|
||||
void IrrDriver::renderLights(unsigned pointlightcount)
|
||||
{
|
||||
//RH
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
m_rtts->getRH().Bind();
|
||||
glUseProgram(FullScreenShader::RadianceHintsConstructionShader::Program);
|
||||
glBindVertexArray(FullScreenShader::RadianceHintsConstructionShader::vao);
|
||||
setTexture(0, m_rtts->getRSM().getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||
setTexture(1, m_rtts->getRSM().getRTT()[1], GL_LINEAR, GL_LINEAR);
|
||||
setTexture(2, m_rtts->getRSM().getDepthTexture(), GL_LINEAR, GL_LINEAR);
|
||||
FullScreenShader::RadianceHintsConstructionShader::setUniforms(rsm_matrix, rh_matrix, rh_extend, 0, 1, 2);
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 32);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < sun_ortho_matrix.size(); i++)
|
||||
sun_ortho_matrix[i] *= getInvViewMatrix();
|
||||
m_rtts->getFBO(FBO_COMBINED_TMP1_TMP2).Bind();
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
glClearColor(.5, .5, .5, .5);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return;
|
||||
|
||||
if (UserConfigParams::m_gi)
|
||||
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
|
||||
|
||||
if (SkyboxCubeMap)
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
// Render sunlight if and only if track supports shadow
|
||||
if (World::getWorld()->getTrack()->hasShadows())
|
||||
{
|
||||
if (UserConfigParams::m_shadows)
|
||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
||||
else
|
||||
m_post_processing->renderSunlight();
|
||||
}
|
||||
|
||||
|
||||
renderPointLights(MIN2(pointlightcount, MAXLIGHT));
|
||||
if (SkyboxCubeMap)
|
||||
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||
}
|
||||
|
@ -27,7 +27,10 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
|
||||
GLuint result;
|
||||
glGenTextures(1, &result);
|
||||
glBindTexture(GL_TEXTURE_2D, result);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
|
||||
else
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, res.Width, res.Height);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -55,6 +58,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
{
|
||||
m_shadow_FBO = NULL;
|
||||
m_RSM = NULL;
|
||||
m_RH_FBO = NULL;
|
||||
using namespace video;
|
||||
using namespace core;
|
||||
|
||||
@ -87,7 +91,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
RenderTargetTextures[RTT_LINEAR_DEPTH] = generateRTT(res, GL_R32F, GL_RED, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB, GL_BGR, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB8, GL_BGR, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_SSAO] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
|
||||
@ -187,7 +191,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
somevector.push_back(RenderTargetTextures[RTT_TMP_128]);
|
||||
FrameBuffers.push_back(new FrameBuffer(somevector, 128, 128));
|
||||
|
||||
if (irr_driver->getGLSLVersion() >= 150)
|
||||
if (UserConfigParams::m_shadows)
|
||||
{
|
||||
glGenTextures(1, &shadowColorTex);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, shadowColorTex);
|
||||
@ -199,7 +203,10 @@ RTT::RTT(size_t width, size_t height)
|
||||
somevector.clear();
|
||||
somevector.push_back(shadowColorTex);
|
||||
m_shadow_FBO = new FrameBuffer(somevector, shadowDepthTex, 1024, 1024, true);
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
//Todo : use "normal" shadowtex
|
||||
glGenTextures(1, &RSM_Color);
|
||||
glBindTexture(GL_TEXTURE_2D, RSM_Color);
|
||||
@ -237,20 +244,24 @@ RTT::RTT(size_t width, size_t height)
|
||||
|
||||
RTT::~RTT()
|
||||
{
|
||||
delete m_shadow_FBO;
|
||||
delete m_RH_FBO;
|
||||
delete m_RSM;
|
||||
glDeleteTextures(RTT_COUNT, RenderTargetTextures);
|
||||
glDeleteTextures(1, &DepthStencilTexture);
|
||||
if (irr_driver->getGLSLVersion() >= 150)
|
||||
if (UserConfigParams::m_shadows)
|
||||
{
|
||||
glDeleteTextures(1, &shadowColorTex);
|
||||
glDeleteTextures(1, &shadowDepthTex);
|
||||
}
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
glDeleteTextures(1, &RSM_Color);
|
||||
glDeleteTextures(1, &RSM_Normal);
|
||||
glDeleteTextures(1, &RSM_Depth);
|
||||
glDeleteTextures(1, &RH_Red);
|
||||
glDeleteTextures(1, &RH_Green);
|
||||
glDeleteTextures(1, &RH_Blue);
|
||||
|
||||
delete m_shadow_FBO;
|
||||
delete m_RH_FBO;
|
||||
delete m_RSM;
|
||||
}
|
||||
}
|
||||
|
@ -1510,8 +1510,6 @@ namespace MeshShader
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_RSMMatrix = glGetUniformLocation(Program, "RSMMatrix");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
void RSMShader::setUniforms(const core::matrix4 &RSMMatrix, const core::matrix4 &ModelMatrix, unsigned TU_tex)
|
||||
@ -2339,8 +2337,6 @@ namespace FullScreenShader
|
||||
uniform_RHMatrix = glGetUniformLocation(Program, "RHMatrix");
|
||||
uniform_RSMMatrix = glGetUniformLocation(Program, "RSMMatrix");
|
||||
vao = createVAO(Program);
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
void RadianceHintsConstructionShader::setUniforms(const core::matrix4 &RSMMatrix, const core::matrix4 &RHMatrix, const core::vector3df &extents, unsigned TU_ctex, unsigned TU_ntex, unsigned TU_dtex)
|
||||
@ -2507,29 +2503,6 @@ namespace FullScreenShader
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
GLuint ShadowGenShader::Program;
|
||||
GLuint ShadowGenShader::uniform_halft;
|
||||
GLuint ShadowGenShader::uniform_quarter;
|
||||
GLuint ShadowGenShader::uniform_height;
|
||||
GLuint ShadowGenShader::vao;
|
||||
void ShadowGenShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/shadowgen.frag").c_str());
|
||||
uniform_halft = glGetUniformLocation(Program, "halft");
|
||||
uniform_quarter = glGetUniformLocation(Program, "quarter");
|
||||
uniform_height = glGetUniformLocation(Program, "height");
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
void ShadowGenShader::setUniforms(GLuint TU_halft, GLuint TU_quarter, GLuint TU_height)
|
||||
{
|
||||
glUniform1i(uniform_halft, TU_halft);
|
||||
glUniform1i(uniform_quarter, TU_quarter);
|
||||
glUniform1i(uniform_height, TU_height);
|
||||
}
|
||||
|
||||
GLuint PassThroughShader::Program;
|
||||
GLuint PassThroughShader::uniform_texture;
|
||||
GLuint PassThroughShader::vao;
|
||||
|
@ -701,39 +701,6 @@ public:
|
||||
static void init();
|
||||
};
|
||||
|
||||
class PenumbraHShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_tex, uniform_pixel;
|
||||
static GLuint vao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::vector2df &pixels, GLuint TU_tex);
|
||||
};
|
||||
|
||||
class PenumbraVShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_tex, uniform_pixel;
|
||||
static GLuint vao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::vector2df &pixels, GLuint TU_tex);
|
||||
};
|
||||
|
||||
class ShadowGenShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_halft, uniform_quarter, uniform_height;
|
||||
static GLuint vao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(GLuint TU_halft, GLuint TU_quarter, GLuint TU_height);
|
||||
};
|
||||
|
||||
class PassThroughShader
|
||||
{
|
||||
public:
|
||||
|
@ -150,8 +150,6 @@ void STKAnimatedMesh::render()
|
||||
core::matrix4 invmodel;
|
||||
AbsoluteTransformation.getInverse(invmodel);
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("GATHER SOLID MESHES", 0xFC, 0xFA, 0x68);
|
||||
|
||||
GLMesh* mesh;
|
||||
for_in(mesh, GeometricMesh[FPSM_DEFAULT])
|
||||
{
|
||||
@ -167,14 +165,11 @@ void STKAnimatedMesh::render()
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
return;
|
||||
}
|
||||
|
||||
if (irr_driver->getPhase() == SOLID_LIT_PASS)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("GATHER TRANSPARENT MESHES", 0xFC, 0xFA, 0x68);
|
||||
|
||||
core::matrix4 invmodel;
|
||||
AbsoluteTransformation.getInverse(invmodel);
|
||||
|
||||
@ -221,7 +216,6 @@ void STKAnimatedMesh::render()
|
||||
GroupedSM<SM_UNTEXTURED>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -668,6 +668,7 @@ namespace GUIEngine
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "guiengine/dialog_queue.hpp"
|
||||
#include "modes/demo_world.hpp"
|
||||
#include "modes/cutscene_world.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
|
||||
@ -1210,6 +1211,12 @@ namespace GUIEngine
|
||||
}
|
||||
|
||||
|
||||
if (gamestate == INGAME_MENU && dynamic_cast<CutsceneWorld*>(World::getWorld()) != NULL)
|
||||
{
|
||||
RaceGUIBase* rg = World::getWorld()->getRaceGUI();
|
||||
if (rg != NULL) rg->renderGlobal(elapsed_time);
|
||||
}
|
||||
|
||||
if (gamestate == MENU || gamestate == INGAME_MENU)
|
||||
{
|
||||
g_skin->drawTooltips();
|
||||
|
@ -309,6 +309,17 @@ namespace GUIEngine
|
||||
virtual void onDialogClose() {}
|
||||
};
|
||||
|
||||
class CutsceneScreen : public Screen
|
||||
{
|
||||
public:
|
||||
CutsceneScreen(const char* name) : Screen(name, false)
|
||||
{
|
||||
setNeeds3D(true);
|
||||
m_throttle_FPS = false;
|
||||
}
|
||||
|
||||
virtual void onCutsceneEnd() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -585,7 +585,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
||||
|
||||
if (device != NULL)
|
||||
{
|
||||
KartSelectionScreen::getRunningInstance()->playerJoin(device,
|
||||
KartSelectionScreen::getRunningInstance()->joinPlayer(device,
|
||||
false );
|
||||
}
|
||||
}
|
||||
|
@ -997,12 +997,36 @@ std::string FileManager::checkAndCreateLinuxDir(const char *env_name,
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Redirects output to go into files in the user's config directory
|
||||
* instead of to the console.
|
||||
* instead of to the console. It keeps backup copies of previous stdout files
|
||||
* (3 atm), which can help to diagnose problems caused by a previous crash.
|
||||
*/
|
||||
void FileManager::redirectOutput()
|
||||
{
|
||||
//Enable logging of stdout and stderr to logfile
|
||||
// Do a simple log rotate: stdout.log.2 becomes stdout.log.3 etc
|
||||
const int NUM_BACKUPS=3;
|
||||
std::string logoutfile = getUserConfigFile("stdout.log");
|
||||
for(int i=NUM_BACKUPS; i>1; i--)
|
||||
{
|
||||
std::ostringstream out_old;
|
||||
out_old << logoutfile << "." << i;
|
||||
removeFile(out_old.str());
|
||||
std::ostringstream out_new;
|
||||
out_new << logoutfile << "." << i-1;
|
||||
if(fileExists(out_new.str()))
|
||||
{
|
||||
rename(out_new.str().c_str(), out_old.str().c_str());
|
||||
}
|
||||
} // for i in NUM_BACKUPS
|
||||
|
||||
if(fileExists(logoutfile))
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << logoutfile<<".1";
|
||||
// No good place to log error messages when log is not yet initialised
|
||||
rename(logoutfile.c_str(), out.str().c_str());
|
||||
}
|
||||
|
||||
//Enable logging of stdout and stderr to logfile
|
||||
Log::verbose("main", "Error messages and other text output will "
|
||||
"be logged to %s.", logoutfile.c_str());
|
||||
Log::openOutputFiles(logoutfile);
|
||||
|
@ -403,7 +403,7 @@ void setupRaceStart()
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(
|
||||
PlayerManager::get()->getPlayer(0), device, NULL);
|
||||
PlayerManager::get()->getPlayer(0), device);
|
||||
|
||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <IMeshSceneNode.h>
|
||||
#include <ISceneManager.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
bool CutsceneWorld::s_use_duration = false;
|
||||
@ -187,12 +188,12 @@ void CutsceneWorld::update(float dt)
|
||||
{
|
||||
/*
|
||||
{
|
||||
PtrVector<TrackObject>& objects = m_track->getTrackObjectManager()->getObjects();
|
||||
TrackObject* curr;
|
||||
for_in(curr, objects)
|
||||
{
|
||||
printf("* %s\n", curr->getType().c_str());
|
||||
}
|
||||
PtrVector<TrackObject>& objects = m_track->getTrackObjectManager()->getObjects();
|
||||
TrackObject* curr;
|
||||
for_in(curr, objects)
|
||||
{
|
||||
printf("* %s\n", curr->getType().c_str());
|
||||
}
|
||||
}
|
||||
**/
|
||||
|
||||
@ -235,18 +236,29 @@ void CutsceneWorld::update(float dt)
|
||||
dt = (float)(m_time - prev_time);
|
||||
}
|
||||
|
||||
float fade;
|
||||
float fade = 0.0f;
|
||||
float fadeIn = -1.0f;
|
||||
float fadeOut = -1.0f;
|
||||
if (m_time < 2.0f)
|
||||
{
|
||||
fade = 1.0f - (float)m_time / 2.0f;
|
||||
fadeIn = 1.0f - (float)m_time / 2.0f;
|
||||
}
|
||||
else if (m_time > m_duration - 2.0f)
|
||||
if (m_time > m_duration - 2.0f)
|
||||
{
|
||||
fade = (float)(m_time - (m_duration - 2.0f)) / 2.0f;
|
||||
fadeOut = (float)(m_time - (m_duration - 2.0f)) / 2.0f;
|
||||
}
|
||||
else
|
||||
|
||||
if (fadeIn >= 0.0f && fadeOut >= 0.0f)
|
||||
{
|
||||
fade = 0.0f;
|
||||
fade = std::max(fadeIn, fadeOut);
|
||||
}
|
||||
else if (fadeIn >= 0.0f)
|
||||
{
|
||||
fade = fadeIn;
|
||||
}
|
||||
else if (fadeOut >= 0.0f)
|
||||
{
|
||||
fade = fadeOut;
|
||||
}
|
||||
dynamic_cast<CutsceneGUI*>(m_race_gui)->setFadeLevel(fade);
|
||||
|
||||
@ -354,6 +366,15 @@ void CutsceneWorld::update(float dt)
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
bool isOver = (m_time > m_duration);
|
||||
if (isOver && (s_use_duration || m_aborted))
|
||||
{
|
||||
GUIEngine::CutsceneScreen* cs = dynamic_cast<GUIEngine::CutsceneScreen*>(
|
||||
GUIEngine::getCurrentScreen());
|
||||
if (cs != NULL)
|
||||
cs->onCutsceneEnd();
|
||||
}
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -440,10 +461,12 @@ void CutsceneWorld::enterRaceOverState()
|
||||
*/
|
||||
bool CutsceneWorld::isRaceOver()
|
||||
{
|
||||
bool isOver = (m_time > m_duration);
|
||||
|
||||
if (!s_use_duration && !m_aborted)
|
||||
return false;
|
||||
|
||||
return m_time > m_duration;
|
||||
return isOver;
|
||||
} // isRaceOver
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -142,7 +142,7 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||
// Use keyboard 0 by default in --no-start-screen
|
||||
device = input_manager->getDeviceList()->getKeyboard(0);
|
||||
StateManager::get()->createActivePlayer(
|
||||
PlayerManager::get()->getPlayer(0), device , NULL);
|
||||
PlayerManager::get()->getPlayer(0), device);
|
||||
// ASSIGN should make sure that only input from assigned devices
|
||||
// is read.
|
||||
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||
|
@ -67,7 +67,7 @@ void OverWorld::enterOverWorld()
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
|
||||
device, NULL);
|
||||
device);
|
||||
|
||||
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
|
||||
{
|
||||
|
@ -826,7 +826,7 @@ void World::updateWorld(float dt)
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
|
||||
device, NULL);
|
||||
device);
|
||||
|
||||
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ void StartGameProtocol::update()
|
||||
if (StateManager::get()->getActivePlayers().size() >= 1) // more than one player, we're the first
|
||||
new_player_id = 0;
|
||||
else
|
||||
new_player_id = StateManager::get()->createActivePlayer( profile_to_use, device , players[i]->user_profile);
|
||||
new_player_id = StateManager::get()->createActivePlayer( profile_to_use, device);
|
||||
device->setPlayer(StateManager::get()->getActivePlayer(new_player_id));
|
||||
input_manager->getDeviceList()->setSinglePlayer(StateManager::get()->getActivePlayer(new_player_id));
|
||||
|
||||
@ -147,7 +147,7 @@ void StartGameProtocol::update()
|
||||
|
||||
if (!is_me)
|
||||
{
|
||||
StateManager::get()->createActivePlayer( NULL, NULL , players[i]->user_profile);
|
||||
StateManager::get()->createActivePlayer( NULL, NULL );
|
||||
|
||||
race_manager->setPlayerKart(i, rki);
|
||||
}
|
||||
|
@ -98,12 +98,20 @@ void GrandPrixData::reload()
|
||||
{
|
||||
Log::error("GrandPrixData",
|
||||
"Error while trying to read grandprix file '%s': "
|
||||
"missing 'name' attribute", m_filename.c_str());
|
||||
"Missing 'name' attribute", m_filename.c_str());
|
||||
throw std::runtime_error("Missing name attribute");
|
||||
}
|
||||
|
||||
// Every iteration means parsing one track entry
|
||||
const int amount = root->getNumNodes();
|
||||
if (amount == 0)
|
||||
{
|
||||
Log::error("GrandPrixData",
|
||||
"Error while trying to read grandprix file '%s': "
|
||||
"There is no track defined", m_filename.c_str());
|
||||
throw std::runtime_error("No track defined");
|
||||
}
|
||||
|
||||
// Every iteration means parsing one track entry
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
const XMLNode* node = root->getNode(i);
|
||||
@ -235,7 +243,7 @@ bool GrandPrixData::checkConsistency(bool log_error) const
|
||||
* is unlocked). It also prevents people from using the grand prix editor as
|
||||
* a way to play tracks that still haven't been unlocked
|
||||
*/
|
||||
bool GrandPrixData::isTrackAvailable(const std::string &id,
|
||||
bool GrandPrixData::isTrackAvailable(const std::string &id,
|
||||
bool includeLocked ) const
|
||||
{
|
||||
if (includeLocked)
|
||||
|
@ -87,6 +87,7 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
|
||||
|
||||
getWidget<CheckBoxWidget>("dynamiclight")->setState(UserConfigParams::m_dynamic_lights);
|
||||
getWidget<CheckBoxWidget>("lightshaft")->setState(UserConfigParams::m_light_shaft);
|
||||
getWidget<CheckBoxWidget>("global_illumination")->setState(UserConfigParams::m_gi);
|
||||
getWidget<CheckBoxWidget>("motionblur")->setState(UserConfigParams::m_motionblur);
|
||||
getWidget<CheckBoxWidget>("mlaa")->setState(UserConfigParams::m_mlaa);
|
||||
getWidget<CheckBoxWidget>("glow")->setState(UserConfigParams::m_glow);
|
||||
@ -139,6 +140,9 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
||||
UserConfigParams::m_light_shaft =
|
||||
getWidget<CheckBoxWidget>("lightshaft")->getState();
|
||||
|
||||
UserConfigParams::m_gi =
|
||||
getWidget<CheckBoxWidget>("global_illumination")->getState();
|
||||
|
||||
UserConfigParams::m_glow =
|
||||
getWidget<CheckBoxWidget>("glow")->getState();
|
||||
|
||||
|
@ -57,13 +57,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
||||
m_gp_ident = gpIdent;
|
||||
|
||||
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gpIdent);
|
||||
if (gp == NULL)
|
||||
{
|
||||
assert(false);
|
||||
std::cerr << "ERROR at " << __FILE__ << " : " << __LINE__ << "; trying to continue\n";
|
||||
ModalDialog::dismiss();
|
||||
return;
|
||||
}
|
||||
assert (gp != NULL);
|
||||
|
||||
// ---- GP Name
|
||||
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);
|
||||
@ -183,14 +177,14 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
||||
continueBtn->add();
|
||||
continueBtn->getIrrlichtElement()->setTabStop(true);
|
||||
continueBtn->getIrrlichtElement()->setTabGroup(false);
|
||||
|
||||
|
||||
okBtn->m_x = m_area.getWidth()/2 - 310;
|
||||
}
|
||||
else
|
||||
{
|
||||
okBtn->m_x = m_area.getWidth()/2 - 200;
|
||||
}
|
||||
|
||||
|
||||
okBtn->m_y = y2;
|
||||
okBtn->m_w = 400;
|
||||
okBtn->m_h = m_area.getHeight() - y2 - 15;
|
||||
@ -201,7 +195,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
||||
okBtn->getIrrlichtElement()->setTabGroup(false);
|
||||
|
||||
okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
@ -82,15 +82,76 @@ DEFINE_SCREEN_SINGLETON( GrandPrixLose );
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
GrandPrixLose::GrandPrixLose() : Screen("grand_prix_lose.stkgui", false /* pause race */)
|
||||
GrandPrixLose::GrandPrixLose() : CutsceneScreen("grand_prix_lose.stkgui")
|
||||
{
|
||||
setNeeds3D(true);
|
||||
|
||||
m_throttle_FPS = false;
|
||||
} // GrandPrixLose
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixLose::onCutsceneEnd()
|
||||
{
|
||||
TrackObjectManager* tobjman = World::getWorld()->getTrack()->getTrackObjectManager();
|
||||
if (m_kart_node[0] != NULL)
|
||||
m_kart_node[0]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[1] != NULL)
|
||||
m_kart_node[1]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[2] != NULL)
|
||||
m_kart_node[2]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[3] != NULL)
|
||||
m_kart_node[3]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
|
||||
for (unsigned int i = 0; i<m_all_kart_models.size(); i++)
|
||||
delete m_all_kart_models[i];
|
||||
|
||||
m_all_kart_models.clear();
|
||||
|
||||
m_kart_node[0] = NULL;
|
||||
m_kart_node[1] = NULL;
|
||||
m_kart_node[2] = NULL;
|
||||
m_kart_node[3] = NULL;
|
||||
|
||||
// un-set the GP mode so that after unlocking, it doesn't try to continue the GP
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
|
||||
std::vector<const ChallengeData*> unlocked =
|
||||
PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges();
|
||||
if (unlocked.size() > 0)
|
||||
{
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
StateManager::get()->replaceTopMostScreen(scene);
|
||||
PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
{
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
StateManager::get()->popMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
bool GrandPrixLose::onEscapePressed()
|
||||
{
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixLose::loadedFromFile()
|
||||
{
|
||||
m_kart_node[0] = NULL;
|
||||
@ -121,17 +182,6 @@ void GrandPrixLose::init()
|
||||
void GrandPrixLose::tearDown()
|
||||
{
|
||||
Screen::tearDown();
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
|
||||
for (unsigned int i=0; i<m_all_kart_models.size(); i++)
|
||||
delete m_all_kart_models[i];
|
||||
|
||||
m_all_kart_models.clear();
|
||||
|
||||
m_kart_node[0] = NULL;
|
||||
m_kart_node[1] = NULL;
|
||||
m_kart_node[2] = NULL;
|
||||
m_kart_node[3] = NULL;
|
||||
} // tearDown
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@ -181,36 +231,7 @@ void GrandPrixLose::eventCallback(GUIEngine::Widget* widget,
|
||||
{
|
||||
if (name == "continue")
|
||||
{
|
||||
// un-set the GP mode so that after unlocking, it doesn't try to continue the GP
|
||||
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
|
||||
|
||||
std::vector<const ChallengeData*> unlocked =
|
||||
PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges();
|
||||
if (unlocked.size() > 0)
|
||||
{
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
StateManager::get()->replaceTopMostScreen(scene);
|
||||
PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
{
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
StateManager::get()->popMenu();
|
||||
}
|
||||
}
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
|
@ -33,7 +33,7 @@ class TrackObject;
|
||||
* \brief Screen shown at the end of a Grand Prix
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class GrandPrixLose : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<GrandPrixLose>
|
||||
class GrandPrixLose : public GUIEngine::CutsceneScreen, public GUIEngine::ScreenSingleton<GrandPrixLose>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<GrandPrixLose>;
|
||||
|
||||
@ -53,6 +53,10 @@ class GrandPrixLose : public GUIEngine::Screen, public GUIEngine::ScreenSingleto
|
||||
|
||||
public:
|
||||
|
||||
virtual void onCutsceneEnd() OVERRIDE;
|
||||
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
|
@ -53,24 +53,21 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
const float KARTS_X = -0.62f;
|
||||
const float KARTS_DELTA_X = 0.815f;
|
||||
const float KARTS_X = -0.95f;
|
||||
const float KARTS_DELTA_X = 1.9f;
|
||||
const float KARTS_DELTA_Y = -0.55f;
|
||||
const float KARTS_DEST_Z = 1.2f;
|
||||
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 = -0.89f;
|
||||
const float PODIUM_HEIGHT[3] = { 0.325f, 0.5f, 0.15f };
|
||||
const float INITIAL_PODIUM_Y = -1.27f;
|
||||
const float PODIUM_HEIGHT[3] = { 0.650f, 1.0f, 0.30f };
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( GrandPrixWin );
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
GrandPrixWin::GrandPrixWin() : Screen("grand_prix_win.stkgui", false /* pause race */)
|
||||
GrandPrixWin::GrandPrixWin() : CutsceneScreen("grand_prix_win.stkgui")
|
||||
{
|
||||
setNeeds3D(true);
|
||||
|
||||
m_throttle_FPS = false;
|
||||
|
||||
m_kart_node[0] = NULL;
|
||||
m_kart_node[1] = NULL;
|
||||
m_kart_node[2] = NULL;
|
||||
@ -83,6 +80,70 @@ GrandPrixWin::GrandPrixWin() : Screen("grand_prix_win.stkgui", false /* pause ra
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
GrandPrixWin::~GrandPrixWin()
|
||||
{
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixWin::onCutsceneEnd()
|
||||
{
|
||||
for (unsigned int i = 0; i<m_all_kart_models.size(); i++)
|
||||
delete m_all_kart_models[i];
|
||||
m_all_kart_models.clear();
|
||||
|
||||
if (m_unlocked_label != NULL)
|
||||
{
|
||||
manualRemoveWidget(m_unlocked_label);
|
||||
delete m_unlocked_label;
|
||||
m_unlocked_label = NULL;
|
||||
}
|
||||
|
||||
TrackObjectManager* tobjman = World::getWorld()->getTrack()->getTrackObjectManager();
|
||||
if (m_kart_node[0] != NULL)
|
||||
m_kart_node[0]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[1] != NULL)
|
||||
m_kart_node[1]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[2] != NULL)
|
||||
m_kart_node[2]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
|
||||
m_kart_node[0] = NULL;
|
||||
m_kart_node[1] = NULL;
|
||||
m_kart_node[2] = NULL;
|
||||
|
||||
m_podium_steps[0] = NULL;
|
||||
m_podium_steps[1] = NULL;
|
||||
m_podium_steps[2] = NULL;
|
||||
|
||||
|
||||
|
||||
// un-set the GP mode so that after unlocking, it doesn't try to continue the GP
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()
|
||||
->getRecentlyCompletedChallenges().size() > 0)
|
||||
{
|
||||
std::vector<const ChallengeData*> unlocked =
|
||||
PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges();
|
||||
PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
|
||||
FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance();
|
||||
|
||||
assert(unlocked.size() > 0);
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
StateManager::get()->replaceTopMostScreen(scene);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
StateManager::get()->popMenu();
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixWin::loadedFromFile()
|
||||
{
|
||||
} // loadedFromFile
|
||||
@ -160,29 +221,17 @@ void GrandPrixWin::init()
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
bool GrandPrixWin::onEscapePressed()
|
||||
{
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixWin::tearDown()
|
||||
{
|
||||
Screen::tearDown();
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
|
||||
for (unsigned int i = 0; i<m_all_kart_models.size(); i++)
|
||||
delete m_all_kart_models[i];
|
||||
m_all_kart_models.clear();
|
||||
|
||||
if (m_unlocked_label != NULL)
|
||||
{
|
||||
manualRemoveWidget(m_unlocked_label);
|
||||
delete m_unlocked_label;
|
||||
m_unlocked_label = NULL;
|
||||
}
|
||||
|
||||
m_kart_node[0] = NULL;
|
||||
m_kart_node[1] = NULL;
|
||||
m_kart_node[2] = NULL;
|
||||
|
||||
m_podium_steps[0] = NULL;
|
||||
m_podium_steps[1] = NULL;
|
||||
m_podium_steps[2] = NULL;
|
||||
} // tearDown
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@ -221,7 +270,7 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
|
||||
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(0.5f, 0.5f, 0.5f);
|
||||
core::vector3df kart_scale(1.0f, 1.0f, 1.0f);
|
||||
m_kart_node[k]->move(kart_pos, kart_rot, kart_scale, false);
|
||||
}
|
||||
} // end for
|
||||
@ -246,7 +295,7 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
|
||||
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(0.5f, 0.5f, 0.5f);
|
||||
core::vector3df kart_scale(1.0f, 1.0f, 1.0f);
|
||||
m_kart_node[k]->move(kart_pos, kart_rot, kart_scale, false);
|
||||
|
||||
core::vector3df podium_pos = m_podium_steps[k]->getInitXYZ();
|
||||
@ -274,7 +323,7 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
m_kart_y[k] += dt*(PODIUM_HEIGHT[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(0.5f, 0.5f, 0.5f);
|
||||
core::vector3df kart_scale(1.0f, 1.0f, 1.0f);
|
||||
m_kart_node[k]->move(kart_pos, kart_rot, kart_scale, false);
|
||||
|
||||
|
||||
@ -310,29 +359,7 @@ void GrandPrixWin::eventCallback(GUIEngine::Widget* widget,
|
||||
{
|
||||
if (name == "continue")
|
||||
{
|
||||
// un-set the GP mode so that after unlocking, it doesn't try to continue the GP
|
||||
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()
|
||||
->getRecentlyCompletedChallenges().size() > 0)
|
||||
{
|
||||
std::vector<const ChallengeData*> unlocked =
|
||||
PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges();
|
||||
PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
|
||||
FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance();
|
||||
|
||||
assert(unlocked.size() > 0);
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
StateManager::get()->replaceTopMostScreen(scene);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
StateManager::get()->popMenu();
|
||||
}
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
@ -359,12 +386,12 @@ void GrandPrixWin::setKarts(const std::string idents_arg[3])
|
||||
|
||||
m_kart_x[i] = KARTS_X + i*KARTS_DELTA_X;
|
||||
m_kart_y[i] = INITIAL_Y + KARTS_DELTA_Y;
|
||||
m_kart_z[i] = -4; // to 1.2
|
||||
m_kart_z[i] = KARTS_INITIAL_Z;
|
||||
m_kart_rotation[i] = 0.0f;
|
||||
|
||||
core::vector3df kart_pos(m_kart_x[i], m_kart_y[i], m_kart_z[i]);
|
||||
core::vector3df kart_rot(0, 0, 0);
|
||||
core::vector3df kart_scale(0.5, 0.5, 0.5);
|
||||
core::vector3df kart_scale(1.0f, 1.0f, 1.0f);
|
||||
|
||||
//FIXME: it's not ideal that both the track object and the presentation know the initial coordinates of the object
|
||||
TrackObjectPresentationSceneNode* presentation = new TrackObjectPresentationSceneNode(
|
||||
|
@ -32,12 +32,14 @@ class TrackObject;
|
||||
* \brief Screen shown at the end of a Grand Prix
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class GrandPrixWin : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<GrandPrixWin>
|
||||
class GrandPrixWin : public GUIEngine::CutsceneScreen, public GUIEngine::ScreenSingleton<GrandPrixWin>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<GrandPrixWin>;
|
||||
|
||||
GrandPrixWin();
|
||||
|
||||
virtual ~GrandPrixWin();
|
||||
|
||||
/** Global evolution of time */
|
||||
double m_global_time;
|
||||
|
||||
@ -61,6 +63,10 @@ class GrandPrixWin : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
|
||||
|
||||
public:
|
||||
|
||||
virtual void onCutsceneEnd() OVERRIDE;
|
||||
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
|
@ -67,7 +67,7 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
|
||||
device, NULL);
|
||||
device);
|
||||
|
||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||
{
|
||||
|
@ -1005,7 +1005,7 @@ void KartSelectionScreen::init()
|
||||
else */
|
||||
// For now this is what will happen
|
||||
{
|
||||
playerJoin( input_manager->getDeviceList()->getLatestUsedDevice(),
|
||||
joinPlayer( input_manager->getDeviceList()->getLatestUsedDevice(),
|
||||
true );
|
||||
w->updateItemDisplay();
|
||||
}
|
||||
@ -1063,24 +1063,24 @@ void KartSelectionScreen::unloaded()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Return true if event was handled successfully
|
||||
bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
bool KartSelectionScreen::joinPlayer(InputDevice* device, bool first_player)
|
||||
{
|
||||
if (UserConfigParams::logGUI())
|
||||
Log::info("[KartSelectionScreen]", "playerJoin() invoked");
|
||||
if (!m_multiplayer && !firstPlayer) return false;
|
||||
Log::info("[KartSelectionScreen]", "joinPlayer() invoked");
|
||||
if (!m_multiplayer && !first_player) return false;
|
||||
|
||||
assert (g_dispatcher != NULL);
|
||||
|
||||
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
||||
if (w == NULL)
|
||||
{
|
||||
Log::error("[KartSelectionScreen]", "playerJoin(): Called outside of "
|
||||
Log::error("[KartSelectionScreen]", "joinPlayer(): Called outside of "
|
||||
"kart selection screen.");
|
||||
return false;
|
||||
}
|
||||
else if (device == NULL)
|
||||
{
|
||||
Log::error("[KartSelectionScreen]", "playerJoin(): Received null "
|
||||
Log::error("[KartSelectionScreen]", "joinPlayer(): Received null "
|
||||
"device pointer");
|
||||
return false;
|
||||
}
|
||||
@ -1093,32 +1093,19 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---- Get available area for karts
|
||||
// make a copy of the area, ands move it to be outside the screen
|
||||
Widget* kartsAreaWidget = getWidget("playerskarts");
|
||||
// start at the rightmost of the screen
|
||||
const int shift = irr_driver->getFrameSize().Width;
|
||||
core::recti kartsArea(kartsAreaWidget->m_x + shift,
|
||||
kartsAreaWidget->m_y,
|
||||
kartsAreaWidget->m_x + shift + kartsAreaWidget->m_w,
|
||||
kartsAreaWidget->m_y + kartsAreaWidget->m_h);
|
||||
|
||||
// ---- Create new active player
|
||||
PlayerProfile* profile_to_use = PlayerManager::getCurrentPlayer();
|
||||
|
||||
if (!firstPlayer)
|
||||
// Make sure enough guest character exists. At this stage this player has
|
||||
// not been added, so the number of guests requested for the first player
|
||||
// is 0 --> forcing at least one real player.
|
||||
PlayerManager::get()->createGuestPlayers(
|
||||
StateManager::get()->activePlayerCount());
|
||||
if (!first_player)
|
||||
{
|
||||
const int player_profile_count = PlayerManager::get()->getNumPlayers();
|
||||
for (int i=0; i<player_profile_count; i++)
|
||||
{
|
||||
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
|
||||
if (player->isGuestAccount())
|
||||
{
|
||||
profile_to_use = player;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Give each player a different start profile
|
||||
const int num_active_players = StateManager::get()->activePlayerCount();
|
||||
profile_to_use = PlayerManager::get()->getPlayer(num_active_players);
|
||||
|
||||
// Remove multiplayer message
|
||||
if (m_multiplayer_message != NULL)
|
||||
@ -1132,7 +1119,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
}
|
||||
|
||||
const int new_player_id =
|
||||
StateManager::get()->createActivePlayer( profile_to_use, device, NULL );
|
||||
StateManager::get()->createActivePlayer( profile_to_use, device);
|
||||
StateManager::ActivePlayer* aplayer =
|
||||
StateManager::get()->getActivePlayer(new_player_id);
|
||||
|
||||
@ -1142,6 +1129,16 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
std::string selected_kart_group =
|
||||
tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
// ---- Get available area for karts
|
||||
// make a copy of the area, ands move it to be outside the screen
|
||||
Widget* kartsAreaWidget = getWidget("playerskarts");
|
||||
// start at the rightmost of the screen
|
||||
const int shift = irr_driver->getFrameSize().Width;
|
||||
core::recti kartsArea(kartsAreaWidget->m_x + shift,
|
||||
kartsAreaWidget->m_y,
|
||||
kartsAreaWidget->m_x + shift + kartsAreaWidget->m_w,
|
||||
kartsAreaWidget->m_y + kartsAreaWidget->m_h);
|
||||
|
||||
// ---- Create player/kart widget
|
||||
PlayerKartWidget* newPlayerWidget =
|
||||
new PlayerKartWidget(this, aplayer, NULL, kartsArea, m_kart_widgets.size(),
|
||||
@ -1157,7 +1154,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
Widget* fullarea = getWidget("playerskarts");
|
||||
|
||||
// in this special case, leave room for a message on the right
|
||||
if (m_multiplayer && firstPlayer)
|
||||
if (m_multiplayer && first_player)
|
||||
{
|
||||
const int splitWidth = fullarea->m_w / 2;
|
||||
|
||||
@ -1189,7 +1186,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
}
|
||||
|
||||
|
||||
if (!firstPlayer)
|
||||
if (!first_player)
|
||||
{
|
||||
// select something (anything) in the ribbon; by default, only the
|
||||
// game master has something selected. Thus, when a new player joins,
|
||||
@ -1197,17 +1194,17 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
|
||||
w->setSelection(new_player_id, new_player_id, true);
|
||||
|
||||
newPlayerWidget->m_player_ident_spinner
|
||||
->setFocusForPlayer(new_player_id);
|
||||
->setFocusForPlayer(new_player_id);
|
||||
}
|
||||
|
||||
if (!m_multiplayer)
|
||||
{
|
||||
input_manager->getDeviceList()->setSinglePlayer( StateManager::get()
|
||||
->getActivePlayer(0));
|
||||
->getActivePlayer(0));
|
||||
}
|
||||
|
||||
return true;
|
||||
} // playerJoin
|
||||
} // joinPlayer
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
|
||||
/** \brief Called when a player hits 'fire'/'select' on his device to
|
||||
* join the game */
|
||||
bool playerJoin(InputDevice* device, bool firstPlayer);
|
||||
bool joinPlayer(InputDevice* device, bool first_player);
|
||||
|
||||
/**
|
||||
* \brief Called when a player hits 'rescue'/'cancel' on his device
|
||||
|
@ -358,7 +358,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
|
||||
device, NULL);
|
||||
device);
|
||||
|
||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||
{
|
||||
|
@ -61,6 +61,7 @@ struct GFXPreset
|
||||
int anisotropy;
|
||||
/** Depth of field */
|
||||
bool dof;
|
||||
bool global_illumination;
|
||||
};
|
||||
|
||||
static GFXPreset GFX_PRESETS[] =
|
||||
@ -68,31 +69,36 @@ static GFXPreset GFX_PRESETS[] =
|
||||
{
|
||||
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
|
||||
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
|
||||
false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */, false /* depth of field */
|
||||
false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */,
|
||||
false /* depth of field */, false /* global illumination */
|
||||
},
|
||||
|
||||
{
|
||||
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
|
||||
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
|
||||
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, false /* depth of field */
|
||||
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */,
|
||||
false /* depth of field */, false /* global illumination */
|
||||
},
|
||||
|
||||
{
|
||||
true /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
|
||||
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, true /* weather */,
|
||||
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, false /* depth of field */
|
||||
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */,
|
||||
false /* depth of field */, false /* global illumination */
|
||||
},
|
||||
|
||||
{
|
||||
true /* light */, 0 /* shadow */, false /* bloom */, true /* motionblur */,
|
||||
true /* lightshaft */, true /* glow */, true /* mlaa */, false /* ssao */, true /* weather */,
|
||||
true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */, false /* depth of field */
|
||||
true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */,
|
||||
false /* depth of field */, false /* global illumination */
|
||||
},
|
||||
|
||||
{
|
||||
true /* light */, 2 /* shadow */, true /* bloom */, true /* motionblur */,
|
||||
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
|
||||
true /* animatedScenery */, 2 /* animatedCharacters */, 8 /* anisotropy */, true /* depth of field */
|
||||
true /* animatedScenery */, 2 /* animatedCharacters */, 8 /* anisotropy */,
|
||||
true /* depth of field */, true /* global illumination */
|
||||
}
|
||||
};
|
||||
|
||||
@ -362,7 +368,8 @@ void OptionsScreenVideo::updateGfxSlider()
|
||||
GFX_PRESETS[l].shadows == UserConfigParams::m_shadows &&
|
||||
GFX_PRESETS[l].ssao == UserConfigParams::m_ssao &&
|
||||
GFX_PRESETS[l].weather == UserConfigParams::m_weather_effects &&
|
||||
GFX_PRESETS[l].dof == UserConfigParams::m_dof)
|
||||
GFX_PRESETS[l].dof == UserConfigParams::m_dof &&
|
||||
GFX_PRESETS[l].global_illumination == UserConfigParams::m_gi)
|
||||
{
|
||||
gfx->setValue(l + 1);
|
||||
found = true;
|
||||
@ -444,6 +451,14 @@ void OptionsScreenVideo::updateTooltip()
|
||||
tooltip = tooltip + L"\n" + _("Light shaft (God rays) : %s",
|
||||
UserConfigParams::m_light_shaft ? enabled : disabled);
|
||||
|
||||
//I18N: in graphical options
|
||||
tooltip = tooltip + L"\n" + _("Depth of field : %s",
|
||||
UserConfigParams::m_dof ? enabled : disabled);
|
||||
|
||||
//I18N: in graphical options
|
||||
tooltip = tooltip + L"\n" + _("Global illumination : %s",
|
||||
UserConfigParams::m_gi ? enabled : disabled);
|
||||
|
||||
gfx->setTooltip(tooltip);
|
||||
} // updateTooltip
|
||||
|
||||
@ -526,6 +541,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
||||
UserConfigParams::m_ssao = GFX_PRESETS[level].ssao;
|
||||
UserConfigParams::m_weather_effects = GFX_PRESETS[level].weather;
|
||||
UserConfigParams::m_dof = GFX_PRESETS[level].dof;
|
||||
UserConfigParams::m_gi = GFX_PRESETS[level].global_illumination;
|
||||
|
||||
updateGfxSlider();
|
||||
}
|
||||
|
@ -344,7 +344,10 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
||||
{
|
||||
race_manager->exitRace();
|
||||
race_manager->setAIKartOverride("");
|
||||
NetworkKartSelectionScreen::getInstance()->tearDown(); // be sure to delete the kart selection screen
|
||||
// FIXME: why is this call necessary here? tearDown should be
|
||||
// automatically called when the screen is left. Note that the
|
||||
// NetworkKartSelectionScreen::getInstance()->tearDown(); caused #1347
|
||||
KartSelectionScreen::getRunningInstance()->tearDown();
|
||||
Screen* newStack[] = {MainMenuScreen::getInstance(),
|
||||
RaceSetupScreen::getInstance(),
|
||||
NULL};
|
||||
@ -358,7 +361,10 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
||||
{
|
||||
race_manager->exitRace();
|
||||
race_manager->setAIKartOverride("");
|
||||
NetworkKartSelectionScreen::getInstance()->tearDown(); // be sure to delete the kart selection screen
|
||||
// FIXME: why is this call necessary here? tearDown should be
|
||||
// automatically called when the screen is left. Note that the
|
||||
// NetworkKartSelectionScreen::getInstance()->tearDown(); caused #1347
|
||||
KartSelectionScreen::getRunningInstance()->tearDown();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
|
@ -102,12 +102,11 @@ void StateManager::updateActivePlayerIDs()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int StateManager::createActivePlayer(PlayerProfile *profile,
|
||||
InputDevice *device,
|
||||
Online::OnlineProfile* user)
|
||||
InputDevice *device)
|
||||
{
|
||||
ActivePlayer *p;
|
||||
int i;
|
||||
p = new ActivePlayer(profile, device, user);
|
||||
p = new ActivePlayer(profile, device);
|
||||
i = m_active_players.size();
|
||||
m_active_players.push_back(p);
|
||||
|
||||
@ -254,8 +253,7 @@ void StateManager::onStackEmptied()
|
||||
#endif
|
||||
|
||||
StateManager::ActivePlayer::ActivePlayer(PlayerProfile* player,
|
||||
InputDevice *device,
|
||||
Online::OnlineProfile* user)
|
||||
InputDevice *device)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
m_magic_number = 0xAC1EF1AE;
|
||||
@ -264,7 +262,6 @@ StateManager::ActivePlayer::ActivePlayer(PlayerProfile* player,
|
||||
m_player = player;
|
||||
m_device = NULL;
|
||||
m_kart = NULL;
|
||||
m_online_user = user;
|
||||
setDevice(device);
|
||||
} // ActivePlayer
|
||||
|
||||
|
@ -76,7 +76,6 @@ public:
|
||||
{
|
||||
friend class StateManager;
|
||||
|
||||
Online::OnlineProfile *m_online_user;
|
||||
PlayerProfile *m_player;
|
||||
InputDevice *m_device;
|
||||
|
||||
@ -86,8 +85,7 @@ public:
|
||||
/** ID of this player within the list of active players */
|
||||
int m_id;
|
||||
|
||||
ActivePlayer(PlayerProfile* player, InputDevice* device,
|
||||
Online::OnlineProfile* user);
|
||||
ActivePlayer(PlayerProfile* player, InputDevice* device);
|
||||
|
||||
#ifdef DEBUG
|
||||
unsigned int m_magic_number;
|
||||
@ -128,19 +126,6 @@ public:
|
||||
* selecting his identity) */
|
||||
void setPlayerProfile(PlayerProfile* player);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
Online::OnlineProfile* getOnlineUser()
|
||||
{
|
||||
return m_online_user;
|
||||
} // getOnlineUser
|
||||
// --------------------------------------------------------------------
|
||||
/** Call to change the identity of this player (useful when player is
|
||||
* selecting his identity) */
|
||||
void setOnlineUser(Online::OnlineProfile* user)
|
||||
{
|
||||
m_online_user = user;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
/** ID of this player within the list of active players */
|
||||
int getID() const
|
||||
@ -197,8 +182,7 @@ public:
|
||||
*/
|
||||
const PlayerProfile* getActivePlayerProfile(const int id);
|
||||
|
||||
int createActivePlayer(PlayerProfile *profile, InputDevice *device,
|
||||
Online::OnlineProfile* use);
|
||||
int createActivePlayer(PlayerProfile *profile, InputDevice *device);
|
||||
void removeActivePlayer(int id);
|
||||
|
||||
unsigned int activePlayerCount();
|
||||
|
@ -46,20 +46,8 @@ DEFINE_SCREEN_SINGLETON( TracksScreen );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
TracksScreen::TracksScreen() : Screen("tracks.stkgui")
|
||||
{
|
||||
} // TracksScreen
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TracksScreen::loadedFromFile()
|
||||
{
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
const int playerID )
|
||||
const int playerID)
|
||||
{
|
||||
// -- track selection screen
|
||||
if (name == "tracks")
|
||||
@ -87,8 +75,8 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
std::string track = m_random_track_list.front();
|
||||
m_random_track_list.pop_front();
|
||||
m_random_track_list.push_back(track);
|
||||
Track* clicked_track = track_manager->getTrack(track);
|
||||
|
||||
Track* clicked_track = track_manager->getTrack(track);
|
||||
|
||||
if (clicked_track)
|
||||
{
|
||||
@ -129,29 +117,17 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
else if (name == "gps")
|
||||
{
|
||||
DynamicRibbonWidget* gps_widget = dynamic_cast<DynamicRibbonWidget*>(widget);
|
||||
if (gps_widget)
|
||||
{
|
||||
const std::string &selection =
|
||||
const std::string &selection =
|
||||
gps_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
if (selection == "locked")
|
||||
{
|
||||
unlock_manager->playLockSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
new GPInfoDialog( selection, 0.8f, 0.7f );
|
||||
}
|
||||
}
|
||||
if (selection == "locked")
|
||||
unlock_manager->playLockSound();
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
} // name=="gps"
|
||||
new GPInfoDialog(selection, 0.8f, 0.7f);
|
||||
}
|
||||
else if (name == "trackgroups")
|
||||
{
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
|
||||
UserConfigParams::m_last_used_track_group = tabs->getSelectionIDString(0);
|
||||
buildTrackList();
|
||||
}
|
||||
@ -166,10 +142,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
void TracksScreen::beforeAddingWidget()
|
||||
{
|
||||
Screen::init();
|
||||
// Dynamically add tabs
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
|
||||
tabs->clearAllChildren();
|
||||
|
||||
const std::vector<std::string>& groups = track_manager->getAllTrackGroups();
|
||||
@ -188,15 +161,11 @@ void TracksScreen::beforeAddingWidget()
|
||||
//I18N: track group name
|
||||
FOR_GETTEXT_ONLY( _("Add-Ons") )
|
||||
|
||||
// add others after
|
||||
// add behind the other categories
|
||||
for (int n=0; n<group_amount; n++)
|
||||
{
|
||||
// try to translate the group name
|
||||
tabs->addTextChild( _(groups[n].c_str()), groups[n] );
|
||||
}
|
||||
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget );
|
||||
tracks_widget->setItemCountHint( track_manager->getNumberOfTracks()+1 );
|
||||
} // beforeAddingWidget
|
||||
|
||||
@ -204,69 +173,60 @@ void TracksScreen::beforeAddingWidget()
|
||||
|
||||
void TracksScreen::init()
|
||||
{
|
||||
DynamicRibbonWidget* gps_widget = getWidget<DynamicRibbonWidget>("gps");
|
||||
assert( gps_widget );
|
||||
|
||||
DynamicRibbonWidget* gps_widget = getWidget<DynamicRibbonWidget>("gps");
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget );
|
||||
assert(tracks_widget != NULL);
|
||||
|
||||
// Reset GP list everytime (accounts for locking changes, etc.)
|
||||
gps_widget->clearItems();
|
||||
|
||||
// Ensure that no GP and no track is NULL
|
||||
grand_prix_manager->checkConsistency();
|
||||
|
||||
// Build GP list
|
||||
const int gpAmount = grand_prix_manager->getNumberOfGrandPrix();
|
||||
for (int n=0; n<gpAmount; n++)
|
||||
{
|
||||
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(n);
|
||||
|
||||
const std::vector<std::string> tracks = gp->getTrackNames(true);
|
||||
|
||||
std::vector<std::string> sshot_files;
|
||||
std::vector<std::string> screenshots;
|
||||
for (unsigned int t=0; t<tracks.size(); t++)
|
||||
{
|
||||
Track* curr = track_manager->getTrack(tracks[t]);
|
||||
if (!curr )
|
||||
{
|
||||
Log::warn("TracksScreen", "Grand Prix '%s' refers to track '%s',"
|
||||
"which does not exist.",
|
||||
gp->getId().c_str(), tracks[t].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
sshot_files.push_back(curr->getScreenshotFile());
|
||||
}
|
||||
}
|
||||
if (sshot_files.size() == 0)
|
||||
{
|
||||
Log::warn("TracksScreen",
|
||||
"Grand Prix '%s' does not contain any valid track.",
|
||||
gp->getId().c_str());
|
||||
sshot_files.push_back("gui/main_help.png");
|
||||
const Track* curr = track_manager->getTrack(tracks[t]);
|
||||
screenshots.push_back(curr->getScreenshotFile());
|
||||
}
|
||||
assert(screenshots.size() > 0);
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(gp->getId()))
|
||||
{
|
||||
gps_widget->addAnimatedItem(_("Locked!"),
|
||||
"locked", sshot_files, 1.5f,
|
||||
gps_widget->addAnimatedItem(_("Locked!"), "locked",
|
||||
screenshots, 1.5f,
|
||||
LOCKED_BADGE | TROPHY_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_widget->addAnimatedItem(translations->fribidize(gp->getName()),
|
||||
gp->getId(),
|
||||
sshot_files, 1.5f, TROPHY_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
|
||||
gp->getId(), screenshots, 1.5f,
|
||||
TROPHY_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
}
|
||||
}
|
||||
|
||||
/*// Random GP - not finished yet
|
||||
std::vector<std::string> screenshots;
|
||||
screenshots.push_back("gui/main_help.png");
|
||||
gps_widget->addAnimatedItem(translations->fribidize("Random"), "Random",
|
||||
screenshots, 1.5f, 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);*/
|
||||
|
||||
gps_widget->updateItemDisplay();
|
||||
|
||||
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
tabs->select(UserConfigParams::m_last_used_track_group, PLAYER_ID_GAME_MASTER);
|
||||
|
||||
|
||||
buildTrackList();
|
||||
|
||||
// select old track for the game master (if found)
|
||||
@ -287,11 +247,8 @@ void TracksScreen::init()
|
||||
*/
|
||||
void TracksScreen::buildTrackList()
|
||||
{
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget);
|
||||
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks");
|
||||
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
|
||||
|
||||
// Reset track list everytime (accounts for locking changes, etc.)
|
||||
tracks_widget->clearItems();
|
||||
@ -338,8 +295,8 @@ void TracksScreen::buildTrackList()
|
||||
}
|
||||
}
|
||||
|
||||
tracks_widget->addItem(_("Random Track"), "random_track",
|
||||
"/gui/track_random.png", 0 /* no badge */,
|
||||
tracks_widget->addItem(_("Random Track"), "random_track",
|
||||
"/gui/track_random.png", 0 /* no badge */,
|
||||
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
||||
|
||||
tracks_widget->updateItemDisplay();
|
||||
@ -350,8 +307,7 @@ void TracksScreen::buildTrackList()
|
||||
|
||||
void TracksScreen::setFocusOnTrack(const std::string& trackName)
|
||||
{
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget);
|
||||
DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks");
|
||||
|
||||
// only the game master can select tracks,
|
||||
// so it's safe to use 'PLAYER_ID_GAME_MASTER'
|
||||
@ -363,7 +319,6 @@ void TracksScreen::setFocusOnTrack(const std::string& trackName)
|
||||
void TracksScreen::setFocusOnGP(const std::string& gpName)
|
||||
{
|
||||
DynamicRibbonWidget* gps_widget = getWidget<DynamicRibbonWidget>("gps");
|
||||
assert( gps_widget );
|
||||
|
||||
// only the game master can select tracks/GPs,
|
||||
// so it's safe to use 'PLAYER_ID_GAME_MASTER'
|
||||
|
@ -27,11 +27,12 @@ namespace GUIEngine { class Widget; }
|
||||
* \brief screen where the user can select a track
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class TracksScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<TracksScreen>
|
||||
class TracksScreen : public GUIEngine::Screen,
|
||||
public GUIEngine::ScreenSingleton<TracksScreen>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<TracksScreen>;
|
||||
|
||||
TracksScreen();
|
||||
TracksScreen() : Screen("tracks.stkgui") {}
|
||||
|
||||
/** adds the tracks from the current track group into the tracks ribbon */
|
||||
void buildTrackList();
|
||||
@ -41,10 +42,11 @@ class TracksScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
|
||||
public:
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
virtual void loadedFromFile() OVERRIDE {};
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||
virtual void eventCallback(GUIEngine::Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
|
@ -284,6 +284,10 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
deletePlayer();
|
||||
}
|
||||
} // options
|
||||
else if (name == "back")
|
||||
{
|
||||
StateManager::get()->escapePressed();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
|
@ -399,6 +399,7 @@ void Profiler::draw()
|
||||
"Transparent",
|
||||
"Particles",
|
||||
"Displacement",
|
||||
"Depth of Field",
|
||||
"Godrays",
|
||||
"Bloom",
|
||||
"Tonemap",
|
||||
|
Loading…
x
Reference in New Issue
Block a user