Merge branch 'master' into shadowdebug
This commit is contained in:
commit
32e6942b55
BIN
data/fonts/BigDigitFont.xml
Normal file → Executable file
BIN
data/fonts/BigDigitFont.xml
Normal file → Executable file
Binary file not shown.
BIN
data/fonts/sigmar0.png
Executable file
BIN
data/fonts/sigmar0.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
35
data/gfx/gfx_sparkFire_a.xml
Normal file
35
data/gfx/gfx_sparkFire_a.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For sky particles, the size of the box is ignored -->
|
||||
<particles emitter="box" box_x="0.1" box_y="0.5" box_z="0.1">
|
||||
|
||||
<spreading angle="30" />
|
||||
|
||||
<velocity x="-0.000"
|
||||
y="0.002"
|
||||
z="-0.000" />
|
||||
|
||||
<material file="gfx_sparkFire_a.png" clampu="Y" clampv="Y" />
|
||||
|
||||
<!-- Amount of particles emitted per second -->
|
||||
<rate min="20"
|
||||
max="50" />
|
||||
|
||||
<!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
|
||||
<lifetime min="3000"
|
||||
max="3000" />
|
||||
|
||||
<!-- Size of the particles -->
|
||||
<size min="0.2"
|
||||
max="0.3" />
|
||||
|
||||
<color min="40 40 255"
|
||||
max="255 255 255" />
|
||||
|
||||
<!-- How much time in milliseconds before the particle is fully faded out -->
|
||||
<fadeout time="100" />
|
||||
|
||||
<wind speed="0.16"
|
||||
flips="Y" />
|
||||
|
||||
</particles>
|
@ -12,6 +12,7 @@ uniform mat4 ViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
uniform vec2 screen;
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ uniform mat4 ViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
uniform vec2 screen;
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
uniform mat4 ShadowViewProjMatrixes[4];
|
||||
uniform vec2 screen;
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
|
@ -43,5 +43,12 @@ void main()
|
||||
// Uncharted2 tonemap with Auria's custom coefficients
|
||||
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
|
||||
perChannel = pow(perChannel, vec4(2.2));
|
||||
FragColor = vec4(perChannel.xyz, col.a);
|
||||
|
||||
vec2 inside = uv - 0.5;
|
||||
float vignette = 1 - dot(inside, inside);
|
||||
vignette = clamp(pow(vignette, 0.8), 0., 1.);
|
||||
//vignette = clamp(vignette + vignette - 0.5, 0., 1.15);
|
||||
|
||||
|
||||
FragColor = vec4(perChannel.xyz * vignette, col.a);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ inline int btGetVersion()
|
||||
#ifdef __SPU__
|
||||
#include <spu_printf.h>
|
||||
#define printf spu_printf
|
||||
#define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}}
|
||||
#define btAssert(x) {if(!(x)){printf("Assert " __FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}}
|
||||
#else
|
||||
#define btAssert assert
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "achievements/achievement_info.hpp"
|
||||
#include "achievements/achievements_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "io/utf_writer.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/ptr_vector.hpp"
|
||||
@ -112,14 +113,48 @@ Achievement * AchievementsStatus::getAchievement(uint32_t id)
|
||||
} // getAchievement
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Synchronises the achievements between local and online usage. It takes
|
||||
* the list of online achievements, and marks them all to be achieved
|
||||
* locally. Then it issues 'achieved' requests to the server for all local
|
||||
* achievements that are not set online.
|
||||
*/
|
||||
void AchievementsStatus::sync(const std::vector<uint32_t> & achieved_ids)
|
||||
{
|
||||
std::vector<bool> done;
|
||||
for(unsigned int i =0; i < achieved_ids.size(); ++i)
|
||||
{
|
||||
if(done.size()< achieved_ids[i]+1)
|
||||
done.resize(achieved_ids[i]+1);
|
||||
done[achieved_ids[i]] = true;
|
||||
Achievement * achievement = getAchievement(achieved_ids[i]);
|
||||
if(achievement != NULL)
|
||||
achievement->setAchieved();
|
||||
}
|
||||
|
||||
std::map<uint32_t, Achievement*>::iterator i;
|
||||
|
||||
// String to collect all local ids that are not synched
|
||||
// to the online account
|
||||
std::string ids;
|
||||
for(i=m_achievements.begin(); i!=m_achievements.end(); i++)
|
||||
{
|
||||
unsigned int id = i->second->getID();
|
||||
if(i->second->isAchieved() && (id>=done.size() || !done[id]) )
|
||||
{
|
||||
ids=ids+StringUtils::toString(id)+",";
|
||||
}
|
||||
}
|
||||
|
||||
if(ids.size()>0)
|
||||
{
|
||||
ids = ids.substr(0, ids.size() - 1); // delete the last "," in the string
|
||||
Log::info("Achievements", "Synching achievement %d to server.",
|
||||
ids.c_str());
|
||||
Online::HTTPRequest * request = new Online::HTTPRequest(true, 2);
|
||||
PlayerManager::setUserDetails(request, "achieving");
|
||||
request->addParameter("achievementid", ids);
|
||||
request->queue();
|
||||
}
|
||||
} // sync
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -132,6 +167,7 @@ void AchievementsStatus::onRaceEnd()
|
||||
}
|
||||
} // onRaceEnd
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void AchievementsStatus::onLapEnd()
|
||||
{
|
||||
//reset all values that need to be reset
|
||||
|
@ -69,6 +69,7 @@ protected:
|
||||
public:
|
||||
AnimationBase(const XMLNode &node);
|
||||
AnimationBase(Ipo *ipo);
|
||||
virtual ~AnimationBase() {}
|
||||
virtual void update(float dt, Vec3 *xyz=NULL, Vec3 *hpr=NULL,
|
||||
Vec3 *scale=NULL);
|
||||
/** This needs to be implemented by the inheriting classes. It is called
|
||||
|
@ -166,15 +166,12 @@ PlayerManager::PlayerManager()
|
||||
*/
|
||||
PlayerManager::~PlayerManager()
|
||||
{
|
||||
// If the passwords should not be remembered, clear all saved sessions.
|
||||
if(!UserConfigParams::m_remember_user)
|
||||
// If the passwords should not be remembered, clear the saved session.
|
||||
PlayerProfile *player;
|
||||
for_in(player, m_all_players)
|
||||
{
|
||||
PlayerProfile *player;
|
||||
for_in(player, m_all_players)
|
||||
{
|
||||
if(!player->rememberPassword())
|
||||
player->clearSession();
|
||||
}
|
||||
|
||||
}
|
||||
save();
|
||||
|
||||
@ -266,7 +263,7 @@ void PlayerManager::save()
|
||||
players_file << L"<?xml version=\"1.0\"?>\n";
|
||||
players_file << L"<players version=\"1\" >\n";
|
||||
|
||||
if(m_current_player && UserConfigParams::m_remember_user)
|
||||
if(m_current_player)
|
||||
{
|
||||
players_file << L" <current player=\""
|
||||
<< m_current_player->getName() << L"\"/>\n";
|
||||
|
@ -47,6 +47,7 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
|
||||
m_saved_user_id = 0;
|
||||
m_last_online_name = "";
|
||||
m_last_was_online = false;
|
||||
m_remember_password = false;
|
||||
initRemainingData();
|
||||
} // PlayerProfile
|
||||
|
||||
@ -72,20 +73,22 @@ PlayerProfile::PlayerProfile(const XMLNode* node)
|
||||
m_saved_user_id = 0;
|
||||
m_last_online_name = "";
|
||||
m_last_was_online = false;
|
||||
m_remember_password = false;
|
||||
m_story_mode_status = NULL;
|
||||
m_achievements_status = NULL;
|
||||
m_icon_filename = "";
|
||||
|
||||
node->get("name", &m_local_name );
|
||||
node->get("guest", &m_is_guest_account);
|
||||
node->get("use-frequency", &m_use_frequency );
|
||||
node->get("unique-id", &m_unique_id );
|
||||
node->get("saved-session", &m_saved_session );
|
||||
node->get("saved-user", &m_saved_user_id );
|
||||
node->get("saved-token", &m_saved_token );
|
||||
node->get("last-online-name", &m_last_online_name);
|
||||
node->get("last-was-online", &m_last_was_online );
|
||||
node->get("icon-filename", &m_icon_filename );
|
||||
node->get("name", &m_local_name );
|
||||
node->get("guest", &m_is_guest_account );
|
||||
node->get("use-frequency", &m_use_frequency );
|
||||
node->get("unique-id", &m_unique_id );
|
||||
node->get("saved-session", &m_saved_session );
|
||||
node->get("saved-user", &m_saved_user_id );
|
||||
node->get("saved-token", &m_saved_token );
|
||||
node->get("last-online-name", &m_last_online_name );
|
||||
node->get("last-was-online", &m_last_was_online );
|
||||
node->get("remember-password", &m_remember_password);
|
||||
node->get("icon-filename", &m_icon_filename );
|
||||
|
||||
#ifdef DEBUG
|
||||
m_magic_number = 0xABCD1234;
|
||||
@ -203,7 +206,8 @@ void PlayerProfile::save(UTFWriter &out)
|
||||
out << L" saved-user=\"" << m_saved_user_id
|
||||
<< L"\" saved-token=\"" << m_saved_token << L"\"\n";
|
||||
out << L" last-online-name=\"" << m_last_online_name
|
||||
<< L"\" last-was-online=\"" << m_last_was_online<< L"\">\n";
|
||||
<< L"\" last-was-online=\"" << m_last_was_online << L"\"\n";
|
||||
out << L" remember-password=\"" << m_remember_password << L"\">\n";
|
||||
{
|
||||
if(m_story_mode_status)
|
||||
m_story_mode_status->save(out);
|
||||
|
@ -101,6 +101,9 @@ private:
|
||||
/** True if the last time this player was used as online. */
|
||||
bool m_last_was_online;
|
||||
|
||||
/** True if the login data are saved. */
|
||||
bool m_remember_password;
|
||||
|
||||
/** The complete challenge state. */
|
||||
StoryModeStatus *m_story_mode_status;
|
||||
|
||||
@ -212,7 +215,10 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool isFirstTime() const { return m_story_mode_status->isFirstTime(); }
|
||||
// ------------------------------------------------------------------------
|
||||
void clearUnlocked() { m_story_mode_status->clearUnlocked(); }
|
||||
void clearUnlocked()
|
||||
{
|
||||
m_story_mode_status->clearUnlocked();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current challenge for this player. */
|
||||
const ChallengeStatus* getCurrentChallengeStatus() const
|
||||
@ -248,6 +254,8 @@ public:
|
||||
/** Returns true if a session was saved for this player. */
|
||||
bool hasSavedSession() const { return m_saved_session; }
|
||||
// ------------------------------------------------------------------------
|
||||
StoryModeStatus* getStoryModeStatus() { return m_story_mode_status; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** If a session was saved, return the id of the saved user. */
|
||||
int getSavedUserId() const
|
||||
{
|
||||
@ -269,6 +277,13 @@ public:
|
||||
/** Sets if this player was logged in last time it was used. */
|
||||
void setWasOnlineLastTime(bool b) { m_last_was_online = b; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the last time this player was used it was used online or
|
||||
* offline. */
|
||||
bool rememberPassword() const { return m_remember_password; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets if this player was logged in last time it was used. */
|
||||
void setRememberPassword(bool b) { m_remember_password = b; }
|
||||
// ------------------------------------------------------------------------
|
||||
}; // class PlayerProfile
|
||||
|
||||
#endif
|
||||
|
@ -682,10 +682,6 @@ namespace UserConfigParams
|
||||
|
||||
// ---- User managerment
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_remember_user
|
||||
PARAM_DEFAULT( BoolUserConfigParam(true, "remember_me",
|
||||
"Automatically remember login data"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "always_show_login_screen",
|
||||
"Always show the login screen even if last player's session was saved."));
|
||||
|
@ -532,7 +532,7 @@ unsigned GPUTimer::elapsedTimeus()
|
||||
FrameBuffer::FrameBuffer() {}
|
||||
|
||||
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h, bool layered) :
|
||||
DepthTexture(0), RenderTargets(RTTs), width(w), height(h)
|
||||
RenderTargets(RTTs), DepthTexture(0), width(w), height(h)
|
||||
{
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
@ -551,7 +551,7 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h, bo
|
||||
}
|
||||
|
||||
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered) :
|
||||
DepthTexture(DS), RenderTargets(RTTs), width(w), height(h)
|
||||
RenderTargets(RTTs), DepthTexture(DS), width(w), height(h)
|
||||
{
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
@ -904,4 +904,4 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
|
||||
glUseProgram(0);
|
||||
|
||||
glGetError();
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
node->get("fog", &m_fog );
|
||||
|
||||
node->get("mask", &m_mask );
|
||||
|
||||
node->get("gloss-map", &m_gloss_map );
|
||||
node->get("water-splash", &m_water_splash );
|
||||
node->get("jump", &m_is_jump_texture );
|
||||
node->get("has-gravity", &m_has_gravity );
|
||||
|
@ -224,6 +224,8 @@ private:
|
||||
/** If m_splatting is true, indicates the fourth splatting texture */
|
||||
std::string m_splatting_texture_4;
|
||||
|
||||
std::string m_gloss_map;
|
||||
|
||||
bool m_deprecated;
|
||||
|
||||
void init (unsigned int index);
|
||||
|
@ -31,7 +31,7 @@ static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint i
|
||||
glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0);
|
||||
else
|
||||
{
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_2)
|
||||
#if WIN32
|
||||
glTexStorage3D(target, 1, internalFormat, w, h, d);
|
||||
#else
|
||||
assert(false);
|
||||
@ -49,7 +49,7 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
|
||||
else
|
||||
{
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_2)
|
||||
#if WIN32
|
||||
glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height);
|
||||
#else
|
||||
assert(false);
|
||||
@ -145,10 +145,6 @@ RTT::RTT(size_t width, size_t height)
|
||||
somevector.push_back(RenderTargetTextures[RTT_SSAO]);
|
||||
|
||||
FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
// Clear this FBO to 1s so that if no SSAO is computed we can still use it.
|
||||
glClearColor(1., 1., 1., 1.);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(RenderTargetTextures[RTT_NORMAL_AND_DEPTH]);
|
||||
FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height));
|
||||
@ -189,6 +185,10 @@ RTT::RTT(size_t width, size_t height)
|
||||
somevector.clear();
|
||||
somevector.push_back(RenderTargetTextures[RTT_HALF1_R]);
|
||||
FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
|
||||
// Clear this FBO to 1s so that if no SSAO is computed we can still use it.
|
||||
glClearColor(1., 1., 1., 1.);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(RenderTargetTextures[RTT_HALF2]);
|
||||
FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
|
||||
|
@ -298,15 +298,11 @@ void Shaders::loadShaders()
|
||||
FullScreenShader::DepthOfFieldShader::init();
|
||||
FullScreenShader::FogShader::init();
|
||||
FullScreenShader::Gaussian17TapHShader::init();
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
FullScreenShader::ComputeGaussian17TapHShader::init();
|
||||
#endif
|
||||
FullScreenShader::Gaussian3HBlurShader::init();
|
||||
FullScreenShader::Gaussian3VBlurShader::init();
|
||||
FullScreenShader::Gaussian17TapVShader::init();
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
FullScreenShader::ComputeGaussian17TapVShader::init();
|
||||
#endif
|
||||
FullScreenShader::Gaussian6HBlurShader::init();
|
||||
FullScreenShader::Gaussian6VBlurShader::init();
|
||||
FullScreenShader::GlowShader::init();
|
||||
@ -442,6 +438,8 @@ namespace UtilShader
|
||||
|
||||
void ColoredLine::setUniforms(const irr::video::SColor &col)
|
||||
{
|
||||
if (UserConfigParams::m_ubo_disabled)
|
||||
bypassUBO(Program);
|
||||
glUniform4i(uniform_color, col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
|
||||
glUniformMatrix4fv(glGetUniformLocation(Program, "ModelMatrix"), 1, GL_FALSE, core::IdentityMatrix.pointer());
|
||||
}
|
||||
@ -1119,7 +1117,7 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
@ -2506,18 +2504,19 @@ namespace FullScreenShader
|
||||
vao = createFullScreenVAO(Program);
|
||||
}
|
||||
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
GLuint ComputeGaussian17TapHShader::Program;
|
||||
GLuint ComputeGaussian17TapHShader::uniform_source;
|
||||
GLuint ComputeGaussian17TapHShader::uniform_dest;
|
||||
void ComputeGaussian17TapHShader::init()
|
||||
{
|
||||
#if WIN32
|
||||
Program = LoadProgram(
|
||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/gaussian.comp").c_str());
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
GLuint Gaussian6HBlurShader::Program;
|
||||
GLuint Gaussian6HBlurShader::uniform_tex;
|
||||
GLuint Gaussian6HBlurShader::uniform_pixel;
|
||||
@ -2563,15 +2562,16 @@ namespace FullScreenShader
|
||||
GLuint ComputeGaussian17TapVShader::Program;
|
||||
GLuint ComputeGaussian17TapVShader::uniform_source;
|
||||
GLuint ComputeGaussian17TapVShader::uniform_dest;
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
void ComputeGaussian17TapVShader::init()
|
||||
{
|
||||
#if WIN32
|
||||
Program = LoadProgram(
|
||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/gaussianv.comp").c_str());
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
GLuint Gaussian6VBlurShader::Program;
|
||||
GLuint Gaussian6VBlurShader::uniform_tex;
|
||||
GLuint Gaussian6VBlurShader::uniform_pixel;
|
||||
|
@ -22,7 +22,7 @@ static void createbillboardvao()
|
||||
STKBillboard::STKBillboard(irr::scene::ISceneNode* parent, irr::scene::ISceneManager* mgr, irr::s32 id,
|
||||
const irr::core::vector3df& position, const irr::core::dimension2d<irr::f32>& size,
|
||||
irr::video::SColor colorTop, irr::video::SColor colorBottom) :
|
||||
CBillboardSceneNode(parent, mgr, id, position, size, colorTop, colorBottom), IBillboardSceneNode(parent, mgr, id, position)
|
||||
IBillboardSceneNode(parent, mgr, id, position), CBillboardSceneNode(parent, mgr, id, position, size, colorTop, colorBottom)
|
||||
{
|
||||
if (!billboardvao)
|
||||
createbillboardvao();
|
||||
|
@ -553,8 +553,11 @@ void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelView
|
||||
tmpcol.getGreen() / 255.0f,
|
||||
tmpcol.getBlue() / 255.0f);
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (mesh.textures[0] != NULL)
|
||||
{
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
}
|
||||
|
||||
glUseProgram(MeshShader::TransparentFogShader::Program);
|
||||
MeshShader::TransparentFogShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0);
|
||||
|
@ -138,9 +138,9 @@ void AbstractStateManager::pushScreen(Screen* screen)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void AbstractStateManager::replaceTopMostScreen(Screen* screen)
|
||||
void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState)
|
||||
{
|
||||
assert(m_game_mode != GAME);
|
||||
//assert(m_game_mode != GAME);
|
||||
// you need to close any dialog before calling this
|
||||
assert(!ModalDialog::isADialogActive());
|
||||
|
||||
@ -156,9 +156,11 @@ void AbstractStateManager::replaceTopMostScreen(Screen* screen)
|
||||
assert(m_menu_stack.size() > 0);
|
||||
|
||||
// Send tear-down event to previous menu
|
||||
getCurrentScreen()->tearDown();
|
||||
if (getCurrentScreen() != NULL)
|
||||
getCurrentScreen()->tearDown();
|
||||
|
||||
m_menu_stack[m_menu_stack.size()-1] = name;
|
||||
setGameState(gameState);
|
||||
switchToScreen(name.c_str());
|
||||
|
||||
// Send init event to new menu
|
||||
|
@ -82,7 +82,7 @@ namespace GUIEngine
|
||||
* without displaying the second-topmost menu of the stack
|
||||
* in-between)
|
||||
*/
|
||||
void replaceTopMostScreen(Screen* screen);
|
||||
void replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState = GUIEngine::MENU);
|
||||
|
||||
/**
|
||||
* \brief removes the menu at the top of the screens stack
|
||||
|
@ -687,11 +687,11 @@ namespace GUIEngine
|
||||
{
|
||||
IGUIEnvironment* g_env;
|
||||
Skin* g_skin = NULL;
|
||||
ScalableFont* g_font;
|
||||
ScalableFont* g_large_font;
|
||||
ScalableFont* g_title_font;
|
||||
ScalableFont* g_small_font;
|
||||
ScalableFont* g_digit_font;
|
||||
ScalableFont *g_font;
|
||||
ScalableFont *g_large_font;
|
||||
ScalableFont *g_title_font;
|
||||
ScalableFont *g_small_font;
|
||||
ScalableFont *g_digit_font;
|
||||
|
||||
IrrlichtDevice* g_device;
|
||||
IVideoDriver* g_driver;
|
||||
@ -1062,7 +1062,7 @@ namespace GUIEngine
|
||||
ScalableFont* sfont =
|
||||
new ScalableFont(g_env,
|
||||
file_manager->getAssetChecked(FileManager::FONT,
|
||||
"StkFont.xml",true).c_str() );
|
||||
"StkFont.xml",true) );
|
||||
sfont->setScale(normal_text_scale);
|
||||
sfont->setKerningHeight(-5);
|
||||
g_font = sfont;
|
||||
@ -1070,13 +1070,13 @@ namespace GUIEngine
|
||||
ScalableFont* digit_font =
|
||||
new ScalableFont(g_env,
|
||||
file_manager->getAssetChecked(FileManager::FONT,
|
||||
"BigDigitFont.xml",true).c_str());
|
||||
"BigDigitFont.xml",true));
|
||||
digit_font->lazyLoadTexture(0); // make sure the texture is loaded for this one
|
||||
digit_font->setMonospaceDigits(true);
|
||||
g_digit_font = digit_font;
|
||||
|
||||
Private::font_height = g_font->getDimension( L"X" ).Height;
|
||||
|
||||
|
||||
ScalableFont* sfont_larger = sfont->getHollowCopy();
|
||||
sfont_larger->setScale(normal_text_scale*1.4f);
|
||||
sfont_larger->setKerningHeight(-5);
|
||||
@ -1097,7 +1097,7 @@ namespace GUIEngine
|
||||
new ScalableFont(g_env,
|
||||
file_manager->getAssetChecked(FileManager::FONT,
|
||||
"title_font.xml",
|
||||
true).c_str() );
|
||||
true) );
|
||||
sfont2->m_fallback_font = sfont;
|
||||
// Because the fallback font is much smaller than the title font:
|
||||
sfont2->m_fallback_font_scale = 4.0f;
|
||||
|
@ -305,12 +305,12 @@ void EventHandler::processGUIAction(const PlayerAction action,
|
||||
|
||||
case PA_ACCEL:
|
||||
case PA_MENU_UP:
|
||||
navigateUp(playerID, type, pressedDown);
|
||||
navigate(playerID, type, pressedDown, true);
|
||||
break;
|
||||
|
||||
case PA_BRAKE:
|
||||
case PA_MENU_DOWN:
|
||||
navigateDown(playerID, type, pressedDown);
|
||||
navigate(playerID, type, pressedDown, false);
|
||||
break;
|
||||
|
||||
case PA_RESCUE:
|
||||
@ -364,10 +364,14 @@ const bool NAVIGATION_DEBUG = false;
|
||||
#pragma mark Private methods
|
||||
#endif
|
||||
|
||||
void EventHandler::navigateUp(const int playerID, Input::InputType type, const bool pressedDown)
|
||||
/**
|
||||
* Focus the next widget either downwards or upwards.
|
||||
*
|
||||
* \param reverse True means navigating up, false means down.
|
||||
*/
|
||||
void EventHandler::navigate(const int playerID, Input::InputType type, const bool pressedDown, const bool reverse)
|
||||
{
|
||||
//std::cout << "Naviagte up!\n";
|
||||
IGUIElement *el = NULL/*, *first=NULL*/, *closest=NULL;
|
||||
IGUIElement *el = NULL, *closest = NULL;
|
||||
|
||||
if (type == Input::IT_STICKBUTTON && !pressedDown)
|
||||
return;
|
||||
@ -378,19 +382,22 @@ void EventHandler::navigateUp(const int playerID, Input::InputType type, const b
|
||||
el = w->getIrrlichtElement();
|
||||
}
|
||||
|
||||
|
||||
// list widgets are a bit special, because up/down keys are also used
|
||||
// to navigate between various list items, not only to navigate between
|
||||
// components
|
||||
if (w != NULL && w->m_type == WTYPE_LIST)
|
||||
{
|
||||
ListWidget* list = (ListWidget*)w;
|
||||
ListWidget* list = (ListWidget*) w;
|
||||
|
||||
const bool stay_within_list = list->getSelectionID() > 0;
|
||||
const bool stay_within_list = reverse ? list->getSelectionID() > 0 :
|
||||
list->getSelectionID() < list->getItemCount() - 1;
|
||||
|
||||
if (stay_within_list)
|
||||
{
|
||||
list->setSelectionID(list->getSelectionID()-1);
|
||||
if (reverse)
|
||||
list->setSelectionID(list->getSelectionID() - 1);
|
||||
else
|
||||
list->setSelectionID(list->getSelectionID() + 1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -399,16 +406,15 @@ void EventHandler::navigateUp(const int playerID, Input::InputType type, const b
|
||||
}
|
||||
}
|
||||
|
||||
if (w != NULL && w->m_tab_up_root != -1)
|
||||
if (w != NULL && ((reverse && w->m_tab_up_root != -1) || (!reverse && w->m_tab_down_root != -1)))
|
||||
{
|
||||
Widget* up = GUIEngine::getWidget( w->m_tab_up_root );
|
||||
assert( up != NULL );
|
||||
|
||||
el = up->getIrrlichtElement();
|
||||
Widget* next = GUIEngine::getWidget(reverse ? w->m_tab_up_root : w->m_tab_down_root);
|
||||
assert(next != NULL);
|
||||
el = next->getIrrlichtElement();
|
||||
|
||||
if (el == NULL)
|
||||
{
|
||||
std::cerr << "WARNING : m_tab_down_root is set to an ID for which I can't find the widget\n";
|
||||
std::cerr << "WARNING : m_tab_down/up_root is set to an ID for which I can't find the widget\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -424,190 +430,69 @@ void EventHandler::navigateUp(const int playerID, Input::InputType type, const b
|
||||
// find closest widget
|
||||
if (el != NULL && el->getTabGroup() != NULL)
|
||||
{
|
||||
// if the current widget is e.g. 15, search for widget 14, 13, 12, ... (up to 10 IDs may be missing)
|
||||
for (int n=1; n<10 && !found; n++)
|
||||
// Up: if the current widget is e.g. 15, search for widget 14, 13, 12, ... (up to 10 IDs may be missing)
|
||||
// Down: if the current widget is e.g. 5, search for widget 6, 7, 8, 9, ..., 15 (up to 10 IDs may be missing)
|
||||
for (int n = 1; n < 10 && !found; n++)
|
||||
{
|
||||
closest = GUIEngine::getGUIEnv()->getRootGUIElement()->getElementFromId(el->getTabOrder() - n, true);
|
||||
closest = GUIEngine::getGUIEnv()->getRootGUIElement()->getElementFromId(el->getTabOrder() + (reverse ? -n : n), true);
|
||||
|
||||
if (closest != NULL && Widget::isFocusableId(closest->getID()))
|
||||
{
|
||||
if (NAVIGATION_DEBUG) std::cout << "Navigating up to " << closest->getID() << std::endl;
|
||||
Widget* closestWidget = GUIEngine::getWidget( closest->getID() );
|
||||
|
||||
if (playerID != PLAYER_ID_GAME_MASTER && !closestWidget->m_supports_multiplayer) return;
|
||||
|
||||
// if a dialog is shown, restrict to items in the dialog
|
||||
if (ModalDialog::isADialogActive() && !ModalDialog::getCurrent()->isMyChild(closestWidget))
|
||||
{
|
||||
continue;
|
||||
|
||||
if (NAVIGATION_DEBUG)
|
||||
{
|
||||
std::cout << "Navigating " << (reverse ? "up" : "down") << " to " << closest->getID() << std::endl;
|
||||
}
|
||||
|
||||
// when focusing a list by going up, select the last item of the list
|
||||
assert (closestWidget != NULL);
|
||||
assert(closestWidget != NULL);
|
||||
|
||||
if (!closestWidget->isVisible() || !closestWidget->isActivated())
|
||||
continue;
|
||||
|
||||
closestWidget->setFocusForPlayer(playerID);
|
||||
|
||||
// another list exception : when entering a list by going down, select the first item
|
||||
// when focusing a list by going up, select the last item of the list
|
||||
if (closestWidget->m_type == WTYPE_LIST)
|
||||
{
|
||||
IGUIListBox* list = (IGUIListBox*)(closestWidget->m_element);
|
||||
ListWidget* list = (ListWidget*) closestWidget;
|
||||
assert(list != NULL);
|
||||
|
||||
list->setSelected( list->getItemCount()-1 );
|
||||
return;
|
||||
list->setSelectionID(reverse ? list->getItemCount() - 1 : 0);
|
||||
}
|
||||
found = true;
|
||||
|
||||
}
|
||||
} // end for
|
||||
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
if (NAVIGATION_DEBUG)
|
||||
{
|
||||
std::cout << "EventHandler::navigateUp : wrap around, selecting the last widget\n";
|
||||
}
|
||||
std::cout << "EventHandler::navigat : wrap around\n";
|
||||
|
||||
// select the last widget
|
||||
Widget* lastWidget = NULL;
|
||||
// select the last/first widget
|
||||
Widget* wrapWidget = NULL;
|
||||
|
||||
if (ModalDialog::isADialogActive())
|
||||
{
|
||||
lastWidget = ModalDialog::getCurrent()->getLastWidget();
|
||||
wrapWidget = reverse ? ModalDialog::getCurrent()->getLastWidget() :
|
||||
ModalDialog::getCurrent()->getFirstWidget();
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen* screen = GUIEngine::getCurrentScreen();
|
||||
if (screen == NULL) return;
|
||||
lastWidget = screen->getLastWidget();
|
||||
wrapWidget = reverse ? screen->getLastWidget() :
|
||||
screen->getFirstWidget();
|
||||
}
|
||||
|
||||
if (lastWidget != NULL) lastWidget->setFocusForPlayer(playerID);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void EventHandler::navigateDown(const int playerID, Input::InputType type, const bool pressedDown)
|
||||
{
|
||||
//std::cout << "Naviagte down!\n";
|
||||
|
||||
IGUIElement *el = NULL, *closest = NULL;
|
||||
|
||||
if (type == Input::IT_STICKBUTTON && !pressedDown)
|
||||
return;
|
||||
|
||||
Widget* w = GUIEngine::getFocusForPlayer(playerID);
|
||||
if (w != NULL)
|
||||
{
|
||||
el = w->getIrrlichtElement();
|
||||
}
|
||||
//std::cout << "!!! Player " << playerID << " navigating down of " << w->m_element->getID() << std::endl;
|
||||
|
||||
// list widgets are a bit special, because up/down keys are also used
|
||||
// to navigate between various list items, not only to navigate between
|
||||
// components
|
||||
if (w != NULL && w->m_type == WTYPE_LIST)
|
||||
{
|
||||
ListWidget* list = (ListWidget*)w;
|
||||
|
||||
const bool stay_within_list = list->getSelectionID() < list->getItemCount()-1;
|
||||
|
||||
if (stay_within_list)
|
||||
{
|
||||
list->setSelectionID(list->getSelectionID()+1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->setSelectionID(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (w != NULL && w->m_tab_down_root != -1)
|
||||
{
|
||||
Widget* down = GUIEngine::getWidget( w->m_tab_down_root );
|
||||
assert(down != NULL);
|
||||
el = down->getIrrlichtElement();
|
||||
|
||||
if (el == NULL)
|
||||
{
|
||||
std::cerr << "WARNING : m_tab_down_root is set to an ID for which I can't find the widget\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// don't allow navigating to any widget when a dialog is shown; only navigate to widgets in the dialog
|
||||
if (ModalDialog::isADialogActive() && !ModalDialog::getCurrent()->isMyIrrChild(el))
|
||||
{
|
||||
el = NULL;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
|
||||
if (el != NULL && el->getTabGroup() != NULL)
|
||||
{
|
||||
// if the current widget is e.g. 5, search for widget 6, 7, 8, 9, ..., 15 (up to 10 IDs may be missing)
|
||||
for (int n=1; n<10 && !found; n++)
|
||||
{
|
||||
closest = GUIEngine::getGUIEnv()->getRootGUIElement()->getElementFromId(el->getTabOrder() + n, true);
|
||||
|
||||
if (closest != NULL && Widget::isFocusableId(closest->getID()))
|
||||
{
|
||||
|
||||
Widget* closestWidget = GUIEngine::getWidget( closest->getID() );
|
||||
if (playerID != PLAYER_ID_GAME_MASTER && !closestWidget->m_supports_multiplayer) return;
|
||||
|
||||
// if a dialog is shown, restrict to items in the dialog
|
||||
if (ModalDialog::isADialogActive() && !ModalDialog::getCurrent()->isMyChild(closestWidget))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NAVIGATION_DEBUG)
|
||||
{
|
||||
std::cout << "Navigating down to " << closestWidget->getID() << "\n";
|
||||
}
|
||||
|
||||
assert( closestWidget != NULL );
|
||||
closestWidget->setFocusForPlayer(playerID);
|
||||
|
||||
// another list exception : when entering a list, select the first item
|
||||
if (closestWidget->m_type == WTYPE_LIST)
|
||||
{
|
||||
IGUIListBox* list = (IGUIListBox*)(closestWidget->m_element);
|
||||
assert(list != NULL);
|
||||
|
||||
list->setSelected(0);
|
||||
}
|
||||
|
||||
found = true;
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
||||
if (NAVIGATION_DEBUG) std::cout << "Navigating down : wrap around\n";
|
||||
|
||||
// select the first widget
|
||||
Widget* firstWidget = NULL;
|
||||
|
||||
if (ModalDialog::isADialogActive())
|
||||
{
|
||||
//std::cout << "w = ModalDialog::getCurrent()->getFirstWidget();\n";
|
||||
firstWidget = ModalDialog::getCurrent()->getFirstWidget();
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen* screen = GUIEngine::getCurrentScreen();
|
||||
if (screen == NULL) return;
|
||||
firstWidget = screen->getFirstWidget();
|
||||
}
|
||||
|
||||
if (firstWidget != NULL) firstWidget->setFocusForPlayer(playerID);
|
||||
if (wrapWidget != NULL) wrapWidget->setFocusForPlayer(playerID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -631,7 +516,7 @@ void EventHandler::sendEventToUser(GUIEngine::Widget* widget, std::string& name,
|
||||
|
||||
EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int playerID)
|
||||
{
|
||||
if (w->m_deactivated) return EVENT_BLOCK;
|
||||
if (!w->isActivated()) return EVENT_BLOCK;
|
||||
|
||||
Widget* parent = w->m_event_handler;
|
||||
|
||||
@ -658,7 +543,7 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
|
||||
parent = parent->m_event_handler;
|
||||
}
|
||||
|
||||
if (parent->m_deactivated) return EVENT_BLOCK;
|
||||
if (!parent->isActivated()) return EVENT_BLOCK;
|
||||
|
||||
/* notify the found event event handler, and also notify the main callback if the
|
||||
parent event handler says so */
|
||||
@ -699,7 +584,7 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
||||
{
|
||||
Widget* w = GUIEngine::getWidget(id);
|
||||
if (w == NULL) break;
|
||||
if (w->m_deactivated)
|
||||
if (!w->isActivated())
|
||||
{
|
||||
GUIEngine::getCurrentScreen()->onDisabledItemClicked(w->m_properties[PROP_ID].c_str());
|
||||
return EVENT_BLOCK;
|
||||
|
@ -62,8 +62,7 @@ namespace GUIEngine
|
||||
|
||||
EventPropagation onGUIEvent(const irr::SEvent& event);
|
||||
EventPropagation onWidgetActivated(Widget* w, const int playerID);
|
||||
void navigateUp(const int playerID, Input::InputType type, const bool pressedDown);
|
||||
void navigateDown(const int playerID, Input::InputType type, const bool pressedDown);
|
||||
void navigate(const int playerID, Input::InputType type, const bool pressedDown, const bool reverse);
|
||||
|
||||
/** \brief send an event to the GUI module user's event callback
|
||||
* \param widget the widget that triggerred this event
|
||||
|
@ -21,9 +21,9 @@ namespace gui
|
||||
{
|
||||
|
||||
//! constructor
|
||||
ScalableFont::ScalableFont(IGUIEnvironment *env, const io::path& filename)
|
||||
: Driver(0), SpriteBank(0), Environment(env), WrongCharacter(0),
|
||||
MaxHeight(0), GlobalKerningWidth(0), GlobalKerningHeight(0)
|
||||
ScalableFont::ScalableFont(IGUIEnvironment *env, const std::string &filename)
|
||||
: Driver(0), SpriteBank(0), Environment(env), WrongCharacter(0),
|
||||
MaxHeight(0), GlobalKerningWidth(0), GlobalKerningHeight(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("ScalableFont");
|
||||
@ -44,7 +44,7 @@ ScalableFont::ScalableFont(IGUIEnvironment *env, const io::path& filename)
|
||||
// don't grab environment, to avoid circular references
|
||||
Driver = Environment->getVideoDriver();
|
||||
|
||||
SpriteBank = Environment->addEmptySpriteBank(filename);
|
||||
SpriteBank = Environment->addEmptySpriteBank(io::path(filename.c_str()));
|
||||
if (SpriteBank)
|
||||
SpriteBank->grab();
|
||||
}
|
||||
@ -676,7 +676,6 @@ void ScalableFont::draw(const core::stringw& text,
|
||||
source,
|
||||
clip,
|
||||
color, true);
|
||||
|
||||
#ifdef FONT_DEBUG
|
||||
driver->draw2DLine(core::position2d<s32>(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y),
|
||||
core::position2d<s32>(dest.UpperLeftCorner.X, dest.LowerRightCorner.Y),
|
||||
|
@ -5,17 +5,19 @@
|
||||
#ifndef __C_GUI_FONT_H_INCLUDED__
|
||||
#define __C_GUI_FONT_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
#include "utils/leak_check.hpp"
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
#include "IGUIFontBitmap.h"
|
||||
#include "irrString.h"
|
||||
#include "irrMap.h"
|
||||
#include "IXMLReader.h"
|
||||
#include "IReadFile.h"
|
||||
#include "irrArray.h"
|
||||
#include <map>
|
||||
|
||||
#include "utils/leak_check.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -72,7 +74,7 @@ public:
|
||||
int m_fallback_kerning_width;
|
||||
|
||||
//! constructor
|
||||
ScalableFont(IGUIEnvironment* env, const io::path& filename);
|
||||
ScalableFont(IGUIEnvironment* env, const std::string &filename);
|
||||
|
||||
/** Creates a hollow copy of this font; i.e. the underlying font data is the *same* for
|
||||
* both fonts. The advantage of doing this is that you can change "view" parameters
|
||||
|
@ -339,7 +339,6 @@ void Widget::setVisible(bool visible)
|
||||
m_element->setVisible(visible);
|
||||
}
|
||||
m_is_visible = visible;
|
||||
m_deactivated = !visible;
|
||||
|
||||
const int childrenCount = m_children.size();
|
||||
for (int n=0; n<childrenCount; n++)
|
||||
|
@ -173,8 +173,6 @@ namespace GUIEngine
|
||||
|
||||
/** Override method from base class Widget */
|
||||
virtual void setDeactivated();
|
||||
|
||||
bool isActivated() { return !m_deactivated; }
|
||||
|
||||
/** Display custom text in spinner */
|
||||
void setCustomText(const core::stringw& text);
|
||||
|
@ -308,6 +308,10 @@ void Flyable::getLinearKartItemIntersection (const Vec3 &origin,
|
||||
|
||||
float fire_th = (dx*dist - dz * sqrtf(dx*dx + dz*dz - dist*dist))
|
||||
/ (dx*dx + dz*dz);
|
||||
if(fire_th>1)
|
||||
fire_th = 1.0f;
|
||||
else if (fire_th<-1.0f)
|
||||
fire_th = -1.0f;
|
||||
fire_th = (((dist - dx*fire_th) / dz > 0) ? -acosf(fire_th)
|
||||
: acosf(fire_th));
|
||||
|
||||
@ -326,8 +330,10 @@ void Flyable::getLinearKartItemIntersection (const Vec3 &origin,
|
||||
fire_th += M_PI;
|
||||
|
||||
//createPhysics offset
|
||||
assert(sqrt(a*a+b*b)!=0);
|
||||
time -= forw_offset / sqrt(a*a+b*b);
|
||||
|
||||
assert(time!=0);
|
||||
*fire_angle = fire_th;
|
||||
*up_velocity = (0.5f * time * gravity) + (dy / time)
|
||||
+ (gy * target_kart->getSpeed());
|
||||
|
@ -405,7 +405,7 @@ void setupRaceStart()
|
||||
StateManager::get()->createActivePlayer(
|
||||
PlayerManager::get()->getPlayer(0), device);
|
||||
|
||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
|
||||
{
|
||||
Log::warn("main", "Kart '%s' is unknown so will use the "
|
||||
"default kart.",
|
||||
@ -418,6 +418,13 @@ void setupRaceStart()
|
||||
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
||||
}
|
||||
|
||||
if(!track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
{
|
||||
race_manager->setTrack("jungle");
|
||||
}
|
||||
else
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
// ASSIGN should make sure that only input from assigned devices
|
||||
// is read.
|
||||
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "physics/physics.hpp"
|
||||
#include "states_screens/credits.hpp"
|
||||
#include "states_screens/cutscene_gui.hpp"
|
||||
#include "states_screens/feature_unlocked.hpp"
|
||||
#include "states_screens/offline_kart_selection.hpp"
|
||||
#include "states_screens/main_menu_screen.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -367,20 +368,26 @@ void CutsceneWorld::update(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
//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
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CutsceneWorld::enterRaceOverState()
|
||||
{
|
||||
GUIEngine::CutsceneScreen* cs = dynamic_cast<GUIEngine::CutsceneScreen*>(
|
||||
GUIEngine::getCurrentScreen());
|
||||
if (cs != NULL)
|
||||
cs->onCutsceneEnd();
|
||||
|
||||
|
||||
int partId = -1;
|
||||
for (int i=0; i<(int)m_parts.size(); i++)
|
||||
{
|
||||
@ -408,17 +415,101 @@ void CutsceneWorld::enterRaceOverState()
|
||||
else if (m_parts.size() == 1 && m_parts[0] == "gpwin")
|
||||
{
|
||||
race_manager->exitRace();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
OverWorld::enterOverWorld();
|
||||
|
||||
// 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)
|
||||
{
|
||||
//PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
assert(unlocked.size() > 0);
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
StateManager::get()->replaceTopMostScreen(scene, GUIEngine::INGAME_MENU);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
{
|
||||
//StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
//StateManager::get()->popMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably
|
||||
else if (m_parts.size() == 1 && m_parts[0] == "gplose")
|
||||
{
|
||||
//race_manager->exitRace();
|
||||
//StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
//if (race_manager->raceWasStartedFromOverworld())
|
||||
// OverWorld::enterOverWorld();
|
||||
|
||||
race_manager->exitRace();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
OverWorld::enterOverWorld();
|
||||
|
||||
// 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)
|
||||
{
|
||||
//PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
StateManager::get()->replaceTopMostScreen(scene, GUIEngine::INGAME_MENU);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
{
|
||||
//StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
//StateManager::get()->popMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably
|
||||
else if (race_manager->getTrackName() == "introcutscene" ||
|
||||
|
@ -794,6 +794,11 @@ void World::updateWorld(float dt)
|
||||
return;
|
||||
|
||||
update(dt);
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(m_magic_number == 0xB01D6543);
|
||||
#endif
|
||||
|
||||
if( (!isFinishPhase()) && isRaceOver())
|
||||
{
|
||||
enterRaceOverState();
|
||||
|
@ -77,6 +77,6 @@ public:
|
||||
|
||||
|
||||
|
||||
}; // WorldWithRank
|
||||
}; // WorldWithRank
|
||||
|
||||
#endif
|
||||
|
@ -1,109 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "online/messages.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
namespace Online
|
||||
{
|
||||
namespace Messages
|
||||
{
|
||||
irr::core::stringw signingIn()
|
||||
{
|
||||
return irr::core::stringw(_("Signing in")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw signingOut()
|
||||
{
|
||||
return irr::core::stringw(_("Signing out")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
irr::core::stringw validatingInfo()
|
||||
{
|
||||
return irr::core::stringw(_("Validating info")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
irr::core::stringw searching()
|
||||
{
|
||||
return irr::core::stringw(_("Searching")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw joiningServer()
|
||||
{
|
||||
return irr::core::stringw(_("Joining server")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw creatingServer()
|
||||
{
|
||||
return irr::core::stringw(_("Creating server")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw fetchingServers()
|
||||
{
|
||||
return irr::core::stringw(_("Fetching servers")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw fetchingFriends()
|
||||
{
|
||||
return irr::core::stringw(_("Fetching friends")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw fetchingAchievements()
|
||||
{
|
||||
return irr::core::stringw(_("Fetching achievements")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw processing()
|
||||
{
|
||||
return irr::core::stringw(_("Processing")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Convenience function to type less in calls. */
|
||||
irr::core::stringw loadingDots(const wchar_t *s)
|
||||
{
|
||||
return irr::core::stringw(s)+loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/**
|
||||
* Shows a increasing number of dots.
|
||||
* \param interval A float representing the time it takes to add a new dot
|
||||
* \param max_dots The number of dots used. Defaults to 3.
|
||||
*/
|
||||
irr::core::stringw loadingDots(float interval, int max_dots)
|
||||
{
|
||||
int nr_dots = int(floor(StkTime::getRealTime() / interval)) % (max_dots+1);
|
||||
return irr::core::stringw((std::string(nr_dots,'.') + std::string(max_dots-nr_dots,' ')).c_str());
|
||||
}
|
||||
} // namespace messages
|
||||
} // namespace Online
|
||||
|
||||
|
||||
/* EOF */
|
@ -1,49 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_ONLINE_MESSAGES_HPP
|
||||
#define HEADER_ONLINE_MESSAGES_HPP
|
||||
|
||||
#include <string>
|
||||
#include <irrString.h>
|
||||
|
||||
namespace Online
|
||||
{
|
||||
/**
|
||||
* \brief Messages to be shown related to API communication
|
||||
* \ingroup online
|
||||
*/
|
||||
namespace Messages
|
||||
{
|
||||
irr::core::stringw loadingDots (float interval = 0.5f, int max_dots = 3);
|
||||
irr::core::stringw loadingDots (const wchar_t *s);
|
||||
irr::core::stringw signingIn ();
|
||||
irr::core::stringw signingOut ();
|
||||
irr::core::stringw validatingInfo ();
|
||||
irr::core::stringw searching ();
|
||||
irr::core::stringw joiningServer ();
|
||||
irr::core::stringw creatingServer ();
|
||||
irr::core::stringw fetchingServers ();
|
||||
irr::core::stringw fetchingFriends ();
|
||||
irr::core::stringw fetchingAchievements ();
|
||||
irr::core::stringw processing ();
|
||||
} // namespace Messages
|
||||
}// namespace Online
|
||||
#endif
|
||||
|
||||
/* EOF */
|
@ -125,8 +125,8 @@ namespace Online
|
||||
request->addParameter("username",username);
|
||||
request->addParameter("password",password);
|
||||
request->addParameter("save-session",
|
||||
UserConfigParams::m_remember_user ? "true"
|
||||
: "false");
|
||||
rememberPassword() ? "true"
|
||||
: "false");
|
||||
request->queue();
|
||||
m_online_state = OS_SIGNING_IN;
|
||||
return request;
|
||||
@ -187,18 +187,18 @@ namespace Online
|
||||
m_profile = new OnlineProfile(userid, username, true);
|
||||
assert(token_fetched && username_fetched && userid_fetched);
|
||||
m_online_state = OS_SIGNED_IN;
|
||||
if(UserConfigParams::m_remember_user)
|
||||
if(rememberPassword())
|
||||
{
|
||||
saveSession(getOnlineId(), getToken() );
|
||||
saveSession(getOnlineId(), getToken());
|
||||
}
|
||||
ProfileManager::get()->addPersistent(m_profile);
|
||||
std::string achieved_string("");
|
||||
if(input->get("achieved", &achieved_string) == 1)
|
||||
{
|
||||
std::vector<uint32_t> achieved_ids =
|
||||
StringUtils::splitToUInt(achieved_string, ' ');
|
||||
PlayerManager::getCurrentAchievementsStatus()->sync(achieved_ids);
|
||||
}
|
||||
// Even if no achievements were sent, we have to call sync
|
||||
// in order to upload local achievements to the server
|
||||
input->get("achieved", &achieved_string);
|
||||
std::vector<uint32_t> achieved_ids =
|
||||
StringUtils::splitToUInt(achieved_string, ' ');
|
||||
PlayerManager::getCurrentAchievementsStatus()->sync(achieved_ids);
|
||||
m_profile->fetchFriends();
|
||||
} // if success
|
||||
else
|
||||
@ -238,8 +238,8 @@ namespace Online
|
||||
{
|
||||
m_player = player;
|
||||
m_player->setUserDetails(this,
|
||||
UserConfigParams::m_remember_user ? "client-quit"
|
||||
:"disconnect");
|
||||
m_player->rememberPassword() ? "client-quit"
|
||||
: "disconnect");
|
||||
setAbortable(false);
|
||||
} // SignOutRequest
|
||||
}; // SignOutRequest
|
||||
@ -282,7 +282,7 @@ namespace Online
|
||||
m_profile = NULL;
|
||||
m_online_state = OS_SIGNED_OUT;
|
||||
// Discard token if session should not be saved.
|
||||
if(!UserConfigParams::m_remember_user)
|
||||
if(!rememberPassword())
|
||||
clearSession();
|
||||
} // signOut
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "config/player_manager.hpp"
|
||||
#include "modes/demo_world.hpp"
|
||||
#include "online/servers_manager.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/online_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
@ -115,7 +114,8 @@ void CreateServerScreen::onUpdate(float delta)
|
||||
else
|
||||
{
|
||||
m_info_widget->setDefaultColor();
|
||||
m_info_widget->setText(Online::Messages::creatingServer(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Creating server")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -227,7 +226,8 @@ void ChangePasswordDialog::error(const irr::core::stringw & error)
|
||||
void ChangePasswordDialog::onUpdate(float dt)
|
||||
{
|
||||
if(!m_options_widget->isActivated())
|
||||
m_info_widget->setText(Online::Messages::validatingInfo(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
|
||||
false );
|
||||
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
if (m_self_destroy)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -200,7 +199,8 @@ void RecoveryDialog::onUpdate(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info_widget->setText(Messages::validatingInfo(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "states_screens/register_screen.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "online/messages.hpp"
|
||||
|
||||
#include <IGUIEnvironment.h>
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "network/protocol_manager.hpp"
|
||||
#include "network/protocols/connect_to_server.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/servers_manager.hpp"
|
||||
#include "states_screens/dialogs/registration_dialog.hpp"
|
||||
#include "states_screens/networking_lobby.hpp"
|
||||
@ -152,7 +151,8 @@ void ServerInfoDialog::onUpdate(float dt)
|
||||
else
|
||||
{
|
||||
m_info_widget->setDefaultColor();
|
||||
m_info_widget->setText(Online::Messages::joiningServer(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Joining server")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "guiengine/dialog_queue.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/online_profile.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/online_profile_friends.hpp"
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -453,7 +452,8 @@ bool UserInfoDialog::onEscapePressed()
|
||||
|
||||
void UserInfoDialog::onUpdate(float dt)
|
||||
{
|
||||
if(m_processing) m_info_widget->setText(Messages::processing(), false);
|
||||
if(m_processing)
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Processing")), false);
|
||||
|
||||
//If we want to open the registration dialog, we need to close this one first
|
||||
if (m_enter_profile) m_self_destroy = true;
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -164,8 +163,8 @@ void VoteDialog::updateFetchVote()
|
||||
if (!m_fetch_vote_request->isDone())
|
||||
{
|
||||
// request still pending
|
||||
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
|
||||
+ Messages::loadingDots(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Fetching last vote")),
|
||||
false );
|
||||
return;
|
||||
} // !isDone
|
||||
|
||||
@ -236,8 +235,8 @@ void VoteDialog::onUpdate(float dt)
|
||||
} // isDone
|
||||
else
|
||||
{
|
||||
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
|
||||
+ Messages::loadingDots(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Performing vote")),
|
||||
false);
|
||||
} // !isDone
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ void FeatureUnlockedCutScene::init()
|
||||
else if (!m_unlocked_stuff[n].m_pictures.empty())
|
||||
{
|
||||
video::SMaterial m;
|
||||
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
//m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m.BackfaceCulling = false;
|
||||
m.setTexture(0, m_unlocked_stuff[n].m_pictures[0]);
|
||||
m.AmbientColor = video::SColor(255, 255, 255, 255);
|
||||
@ -335,8 +335,16 @@ void FeatureUnlockedCutScene::init()
|
||||
irr_driver->createTexturedQuadMesh(&m,
|
||||
m_unlocked_stuff[n].m_w,
|
||||
m_unlocked_stuff[n].m_h);
|
||||
m_unlocked_stuff[n].m_root_gift_node = irr_driver->addMesh(mesh);
|
||||
mesh->drop();
|
||||
m_unlocked_stuff[n].m_root_gift_node = irr_driver->getSceneManager()->addEmptySceneNode();
|
||||
m_unlocked_stuff[n].m_side_1 = irr_driver->addMesh(mesh, m_unlocked_stuff[n].m_root_gift_node);
|
||||
//mesh->drop();
|
||||
|
||||
mesh = irr_driver->createTexturedQuadMesh(&m,
|
||||
m_unlocked_stuff[n].m_w,
|
||||
m_unlocked_stuff[n].m_h);
|
||||
m_unlocked_stuff[n].m_side_2 = irr_driver->addMesh(mesh, m_unlocked_stuff[n].m_root_gift_node);
|
||||
m_unlocked_stuff[n].m_side_2->setRotation(core::vector3df(0.0f, 180.0f, 0.0f));
|
||||
//mesh->drop();
|
||||
#ifdef DEBUG
|
||||
m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture");
|
||||
#endif
|
||||
@ -346,6 +354,8 @@ void FeatureUnlockedCutScene::init()
|
||||
std::cerr << "Malformed unlocked goody!!!\n";
|
||||
}
|
||||
}
|
||||
|
||||
PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
} // init
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -430,7 +440,7 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
if (textureID != previousTextureID)
|
||||
{
|
||||
scene::IMeshSceneNode* node = (scene::IMeshSceneNode*)m_unlocked_stuff[n].m_root_gift_node;
|
||||
scene::IMesh* mesh = node->getMesh();
|
||||
scene::IMesh* mesh = m_unlocked_stuff[n].m_side_1->getMesh();
|
||||
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
|
||||
@ -441,7 +451,21 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
|
||||
// FIXME: this mesh is already associated with this node. I'm calling this
|
||||
// to force irrLicht to refresh the display, now that Material has changed.
|
||||
node->setMesh(mesh);
|
||||
m_unlocked_stuff[n].m_side_1->setMesh(mesh);
|
||||
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;
|
||||
|
||||
|
||||
mesh = m_unlocked_stuff[n].m_side_2->getMesh();
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
mb = mesh->getMeshBuffer(0);
|
||||
|
||||
SMaterial& m2 = mb->getMaterial();
|
||||
m2.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]);
|
||||
|
||||
// FIXME: this mesh is already associated with this node. I'm calling this
|
||||
// to force irrLicht to refresh the display, now that Material has changed.
|
||||
m_unlocked_stuff[n].m_side_2->setMesh(mesh);
|
||||
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;
|
||||
} // textureID != previousTextureID
|
||||
|
@ -60,6 +60,9 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
|
||||
/** Contains whatever is in the chest */
|
||||
scene::ISceneNode* m_root_gift_node;
|
||||
|
||||
scene::IMeshSceneNode* m_side_1;
|
||||
scene::IMeshSceneNode* m_side_2;
|
||||
|
||||
float m_scale;
|
||||
|
||||
irr::core::stringw m_unlock_message;
|
||||
|
@ -109,46 +109,6 @@ void GrandPrixLose::onCutsceneEnd()
|
||||
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)
|
||||
{
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
@ -114,43 +114,6 @@ void GrandPrixWin::onCutsceneEnd()
|
||||
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();
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
@ -230,12 +230,14 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
*/
|
||||
|
||||
#if DEBUG_MENU_ITEM
|
||||
if (selection == "options")
|
||||
if (selection == "gpEditor")
|
||||
{
|
||||
// The DEBUG item
|
||||
StoryModeStatus* sms = PlayerManager::getCurrentPlayer()->getStoryModeStatus();
|
||||
sms->unlockFeature(const_cast<ChallengeStatus*>(sms->getChallengeStatus("gp1")),
|
||||
RaceManager::DIFFICULTY_HARD);
|
||||
|
||||
// GP WIN
|
||||
/*
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
@ -246,9 +248,9 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
StateManager::get()->pushScreen(scene);
|
||||
const std::string winners[] = { "elephpant", "nolok", "pidgin" };
|
||||
scene->setKarts(winners);
|
||||
*/
|
||||
|
||||
// GP Lose
|
||||
/*
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
@ -263,15 +265,26 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
//losers.push_back("wilber");
|
||||
//losers.push_back("tux");
|
||||
scene->setKarts(losers);
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
// FEATURE UNLOCKED
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
scene->addTrophy(RaceManager::DIFFICULTY_EASY);
|
||||
StateManager::get()->pushScreen(scene);
|
||||
//StateManager::get()->pushScreen(scene);
|
||||
|
||||
static int i = 1;
|
||||
i++;
|
||||
@ -295,7 +308,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
track_manager->getTrack("lighthouse")
|
||||
->getScreenshotFile().c_str()));
|
||||
textures.push_back(irr_driver->getTexture(
|
||||
track_manager->getTrack("crescentcrossing")
|
||||
track_manager->getTrack("startrack")
|
||||
->getScreenshotFile().c_str()));
|
||||
textures.push_back(irr_driver->getTexture(
|
||||
track_manager->getTrack("sandtrack")
|
||||
@ -304,11 +317,11 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
track_manager->getTrack("snowmountain")
|
||||
->getScreenshotFile().c_str()));
|
||||
|
||||
scene->addUnlockedPictures(textures, 1.0, 0.75, L"You did it");
|
||||
scene->addUnlockedPictures(textures, 4.0, 3.0, L"You did it");
|
||||
|
||||
StateManager::get()->pushScreen(scene);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/online_profile.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -122,7 +121,7 @@ void OnlineProfileAchievements::init()
|
||||
m_visiting_profile->fetchAchievements();
|
||||
m_achievements_list_widget->clear();
|
||||
m_achievements_list_widget->addItem("loading",
|
||||
Messages::fetchingAchievements());
|
||||
StringUtils::loadingDots(_("Fetching achievements")));
|
||||
}
|
||||
} // init
|
||||
|
||||
@ -161,8 +160,8 @@ void OnlineProfileAchievements::onUpdate(float delta)
|
||||
if (!m_visiting_profile->isReady())
|
||||
{
|
||||
// This will display an increasing number of dots while waiting.
|
||||
m_achievements_list_widget->renameItem("loading",
|
||||
Messages::fetchingAchievements());
|
||||
m_achievements_list_widget->renameItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching achievements")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/dialogs/user_info_dialog.hpp"
|
||||
#include "states_screens/online_user_search.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -85,7 +84,8 @@ void OnlineProfileFriends::init()
|
||||
m_visiting_profile->fetchFriends();
|
||||
m_waiting_for_friends = true;
|
||||
m_friends_list_widget->clear();
|
||||
m_friends_list_widget->addItem("loading", Messages::fetchingFriends());
|
||||
m_friends_list_widget->addItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching friends")));
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -171,7 +171,7 @@ void OnlineProfileFriends::onUpdate(float delta)
|
||||
else
|
||||
{
|
||||
m_friends_list_widget->renameItem("loading",
|
||||
Messages::fetchingFriends());
|
||||
StringUtils::loadingDots(_("Fetching friends")));
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "network/protocol_manager.hpp"
|
||||
#include "network/protocols/connect_to_server.hpp"
|
||||
#include "network/protocols/request_connection.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/profile_manager.hpp"
|
||||
#include "online/request.hpp"
|
||||
#include "online/servers_manager.hpp"
|
||||
@ -153,11 +152,13 @@ void OnlineScreen::onUpdate(float delta)
|
||||
|
||||
if (m_recorded_state == PlayerProfile::OS_SIGNING_IN)
|
||||
{
|
||||
m_online_status_widget->setText(Messages::signingIn(), false);
|
||||
m_online_status_widget->setText(StringUtils::loadingDots(_("Signing in")),
|
||||
false );
|
||||
}
|
||||
else if (m_recorded_state == PlayerProfile::OS_SIGNING_OUT)
|
||||
{
|
||||
m_online_status_widget->setText(Messages::signingOut(), false);
|
||||
m_online_status_widget->setText(StringUtils::loadingDots(_("Signing out")),
|
||||
false );
|
||||
}
|
||||
} // onUpdate
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/profile_manager.hpp"
|
||||
#include "states_screens/dialogs/user_info_dialog.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
@ -199,7 +198,7 @@ void OnlineUserSearch::search()
|
||||
|
||||
m_user_list_widget->clear();
|
||||
m_user_list_widget->addItem("spacer", L"");
|
||||
m_user_list_widget->addItem("loading", Messages::searching());
|
||||
m_user_list_widget->addItem("loading", StringUtils::loadingDots(_("Searching")));
|
||||
m_back_widget->setDeactivated();
|
||||
m_search_box_widget->setDeactivated();
|
||||
m_search_button_widget->setDeactivated();
|
||||
@ -276,7 +275,8 @@ void OnlineUserSearch::onUpdate(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_user_list_widget->renameItem("loading", Messages::searching());
|
||||
m_user_list_widget->renameItem("loading",
|
||||
StringUtils::loadingDots(_("Searching")) );
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -89,40 +89,27 @@ RaceGUI::RaceGUI()
|
||||
m_speed_bar_icon = material_manager->getMaterial("speedfore.png");
|
||||
createMarkerTexture();
|
||||
|
||||
// Translate strings only one in constructor to avoid calling
|
||||
// gettext in each frame.
|
||||
//I18N: Shown at the end of a race
|
||||
m_string_lap = _("Lap");
|
||||
m_string_rank = _("Rank");
|
||||
|
||||
|
||||
// Determine maximum length of the rank/lap text, in order to
|
||||
// align those texts properly on the right side of the viewport.
|
||||
gui::ScalableFont* font = GUIEngine::getFont();
|
||||
m_rank_lap_width = font->getDimension(m_string_lap.c_str()).Width;
|
||||
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||
core::dimension2du area = font->getDimension(L"99:99:99");
|
||||
m_timer_width = area.Width;
|
||||
m_font_height = area.Height;
|
||||
|
||||
m_timer_width = font->getDimension(L"99:99:99").Width;
|
||||
|
||||
font = (race_manager->getNumLocalPlayers() > 2 ? GUIEngine::getSmallFont()
|
||||
: GUIEngine::getFont());
|
||||
|
||||
int w;
|
||||
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
||||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES ||
|
||||
race_manager->getNumLaps() > 9)
|
||||
w = font->getDimension(L"99/99").Width;
|
||||
m_lap_width = font->getDimension(L"99/99").Width;
|
||||
else
|
||||
w = font->getDimension(L"9/9").Width;
|
||||
m_lap_width = font->getDimension(L"9/9").Width;
|
||||
|
||||
// In some split screen configuration the energy bar might be next
|
||||
// to the lap display - so make the lap X/Y display large enough to
|
||||
// leave space for the energy bar (16 pixels) and 10 pixels of space
|
||||
// to the right (see drawEnergyMeter for details).
|
||||
w += 16 + 10;
|
||||
if(m_rank_lap_width < w) m_rank_lap_width = w;
|
||||
w = font->getDimension(m_string_rank.c_str()).Width;
|
||||
if(m_rank_lap_width < w) m_rank_lap_width = w;
|
||||
// Technically we only need getNumLocalPlayers, but using the
|
||||
// global kart id to find the data for a specific kart.
|
||||
int n = race_manager->getNumberOfKarts();
|
||||
|
||||
m_animation_states.resize(n);
|
||||
m_rank_animation_start_times.resize(n);
|
||||
m_last_ranks.resize(n);
|
||||
} // RaceGUI
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -130,6 +117,20 @@ RaceGUI::~RaceGUI()
|
||||
{
|
||||
} // ~Racegui
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Reset the gui before a race. It initialised all rank animation related
|
||||
* values back to the default.
|
||||
*/
|
||||
void RaceGUI::reset()
|
||||
{
|
||||
RaceGUIBase::reset();
|
||||
for(unsigned int i=0; i<race_manager->getNumberOfKarts(); i++)
|
||||
{
|
||||
m_animation_states[i] = AS_NONE;
|
||||
m_last_ranks[i] = i+1;
|
||||
}
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Render all global parts of the race gui, i.e. things that are only
|
||||
* displayed once even in splitscreen.
|
||||
@ -201,24 +202,26 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
|
||||
core::vector2df scaling = camera->getScaling();
|
||||
const AbstractKart *kart = camera->getKart();
|
||||
if(!kart) return;
|
||||
|
||||
|
||||
drawPlungerInFace(camera, dt);
|
||||
|
||||
scaling *= viewport.getWidth()/800.0f; // scale race GUI along screen size
|
||||
drawAllMessages (kart, viewport, scaling);
|
||||
drawAllMessages(kart, viewport, scaling);
|
||||
|
||||
if(!World::getWorld()->isRacePhase()) return;
|
||||
|
||||
drawPowerupIcons (kart, viewport, scaling);
|
||||
drawSpeedAndEnergy (kart, viewport, scaling);
|
||||
drawPowerupIcons (kart, viewport, scaling);
|
||||
drawSpeedEnergyRank(kart, viewport, scaling);
|
||||
|
||||
if (!m_is_tutorial)
|
||||
drawRankLap (kart, viewport);
|
||||
drawLap(kart, viewport, scaling);
|
||||
|
||||
RaceGUIBase::renderPlayerView(camera, dt);
|
||||
} // renderPlayerView
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Shows the current soccer result.
|
||||
*/
|
||||
void RaceGUI::drawScores()
|
||||
{
|
||||
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
||||
@ -271,7 +274,8 @@ void RaceGUI::drawScores()
|
||||
numLeader++;
|
||||
offsetX += position.LowerRightCorner.X;
|
||||
}
|
||||
}
|
||||
} // drawScores
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Displays the racing time on the screen.s
|
||||
*/
|
||||
@ -321,7 +325,9 @@ void RaceGUI::drawGlobalTimer()
|
||||
pos += core::vector2d<s32>(0, UserConfigParams::m_height/2);
|
||||
}
|
||||
|
||||
gui::ScalableFont* font = GUIEngine::getFont();
|
||||
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||
font->setShadow(video::SColor(255, 128, 0, 0));
|
||||
font->setScale(1.0f);
|
||||
font->draw(sw.c_str(), pos, time_color, false, false, NULL,
|
||||
true /* ignore RTL */);
|
||||
|
||||
@ -388,10 +394,10 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
float minRatio = std::min(scaling.X, scaling.Y);
|
||||
float min_ratio = std::min(scaling.X, scaling.Y);
|
||||
const int GAUGEWIDTH = 78;
|
||||
int gauge_width = (int)(GAUGEWIDTH*minRatio);
|
||||
int gauge_height = (int)(GAUGEWIDTH*minRatio);
|
||||
int gauge_width = (int)(GAUGEWIDTH*min_ratio);
|
||||
int gauge_height = (int)(GAUGEWIDTH*min_ratio);
|
||||
|
||||
float state = (float)(kart->getEnergy())
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
@ -404,14 +410,13 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
|
||||
|
||||
// Background
|
||||
draw2DImage(m_gauge_empty,
|
||||
core::rect<s32>((int)offset.X,
|
||||
(int) offset.Y-gauge_height,
|
||||
(int) offset.X + gauge_width,
|
||||
(int)offset.Y) /* dest rect */,
|
||||
core::rect<s32>(0, 0, 256, 256) /* source rect */,
|
||||
NULL /* clip rect */, NULL /* colors */,
|
||||
true /* alpha */);
|
||||
draw2DImage(m_gauge_empty, core::rect<s32>((int)offset.X,
|
||||
(int)offset.Y-gauge_height,
|
||||
(int)offset.X + gauge_width,
|
||||
(int)offset.Y) /* dest rect */,
|
||||
core::rect<s32>(0, 0, 256, 256) /* source rect */,
|
||||
NULL /* clip rect */, NULL /* colors */,
|
||||
true /* alpha */);
|
||||
|
||||
// Target
|
||||
|
||||
@ -581,22 +586,99 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count,
|
||||
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // drawEnergyMeter
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceGUI::drawRank(const AbstractKart *kart,
|
||||
const core::vector2df &offset,
|
||||
float min_ratio, int meter_width,
|
||||
int meter_height)
|
||||
{
|
||||
// Draw rank
|
||||
WorldWithRank *world = dynamic_cast<WorldWithRank*>(World::getWorld());
|
||||
if (!world || !world->displayRank())
|
||||
return;
|
||||
|
||||
void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
||||
int id = kart->getWorldKartId();
|
||||
|
||||
if (m_animation_states[id] == AS_NONE)
|
||||
{
|
||||
if (m_last_ranks[id] != kart->getPosition())
|
||||
{
|
||||
m_rank_animation_start_times[id] = world->getTime();
|
||||
m_animation_states[id] = AS_SMALLER;
|
||||
}
|
||||
}
|
||||
|
||||
float scale = 1.0f;
|
||||
int rank = kart->getPosition();
|
||||
const float DURATION = 0.4f;
|
||||
const float MIN_SHRINK = 0.3f;
|
||||
if (m_animation_states[id] == AS_SMALLER)
|
||||
{
|
||||
scale = 1.0f - (world->getTime() - m_rank_animation_start_times[id])
|
||||
/ DURATION;
|
||||
rank = m_last_ranks[id];
|
||||
if (scale < MIN_SHRINK)
|
||||
{
|
||||
m_animation_states[id] = AS_BIGGER;
|
||||
m_rank_animation_start_times[id] = world->getTime();
|
||||
// Store the new rank
|
||||
m_last_ranks[id] = kart->getPosition();
|
||||
scale = MIN_SHRINK;
|
||||
}
|
||||
}
|
||||
else if (m_animation_states[id] == AS_BIGGER)
|
||||
{
|
||||
scale = (world->getTime() - m_rank_animation_start_times[id])
|
||||
/ DURATION + MIN_SHRINK;
|
||||
rank = m_last_ranks[id];
|
||||
if (scale > 1.0f)
|
||||
{
|
||||
m_animation_states[id] = AS_NONE;
|
||||
scale = 1.0f;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_last_ranks[id] = kart->getPosition();
|
||||
}
|
||||
|
||||
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||
font->setScale(min_ratio * scale);
|
||||
font->setShadow(video::SColor(255, 128, 0, 0));
|
||||
std::ostringstream oss;
|
||||
oss << rank; // the current font has no . :( << ".";
|
||||
|
||||
core::recti pos;
|
||||
pos.LowerRightCorner = core::vector2di(int(offset.X + 0.65f*meter_width),
|
||||
int(offset.Y - 0.55f*meter_height));
|
||||
pos.UpperLeftCorner = core::vector2di(int(offset.X + 0.65f*meter_width),
|
||||
int(offset.Y - 0.55f*meter_height));
|
||||
|
||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||
font->draw(oss.str().c_str(), pos, color, true, true);
|
||||
font->setScale(1.0f);
|
||||
} // drawRank
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Draws the speedometer, the display of available nitro, and
|
||||
* the rank of the kart (inside the speedometer).
|
||||
* \param kart The kart for which to show the data.
|
||||
* \param viewport The viewport to use.
|
||||
* \param scaling Which scaling to apply to the speedometer.
|
||||
*/
|
||||
void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
float minRatio = std::min(scaling.X, scaling.Y);
|
||||
float min_ratio = std::min(scaling.X, scaling.Y);
|
||||
const int SPEEDWIDTH = 128;
|
||||
int meter_width = (int)(SPEEDWIDTH*minRatio);
|
||||
int meter_height = (int)(SPEEDWIDTH*minRatio);
|
||||
int meter_width = (int)(SPEEDWIDTH*min_ratio);
|
||||
int meter_height = (int)(SPEEDWIDTH*min_ratio);
|
||||
|
||||
drawEnergyMeter(viewport.LowerRightCorner.X ,
|
||||
(int)(viewport.LowerRightCorner.Y),
|
||||
@ -604,8 +686,6 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
||||
|
||||
// First draw the meter (i.e. the background )
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
core::vector2df offset;
|
||||
offset.X = (float)(viewport.LowerRightCorner.X-meter_width) - 24.0f*scaling.X;
|
||||
offset.Y = viewport.LowerRightCorner.Y-10.0f*scaling.Y;
|
||||
@ -621,6 +701,10 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
||||
NULL, true);
|
||||
|
||||
const float speed = kart->getSpeed();
|
||||
|
||||
drawRank(kart, offset, min_ratio, meter_width, meter_height);
|
||||
|
||||
|
||||
if(speed <=0) return; // Nothing to do if speed is negative.
|
||||
|
||||
// Draw the actual speed bar (if the speed is >0)
|
||||
@ -698,41 +782,25 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
||||
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count,
|
||||
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
||||
|
||||
|
||||
// Draw Speed in Numbers
|
||||
|
||||
core::recti pos;
|
||||
pos.UpperLeftCorner.X=(int)(offset.X + 0.5f*meter_width);
|
||||
pos.UpperLeftCorner.Y=(int)(offset.Y - 0.62f*meter_height);
|
||||
pos.LowerRightCorner.X=(int)(offset.X + 0.8f*meter_width);
|
||||
pos.LowerRightCorner.Y=(int)(offset.X - 0.5f*meter_height);
|
||||
|
||||
gui::ScalableFont* font;
|
||||
|
||||
if (pos.getWidth() > 55)
|
||||
font = GUIEngine::getLargeFont();
|
||||
else if (pos.getWidth() > 40)
|
||||
font = GUIEngine::getFont();
|
||||
else
|
||||
font = GUIEngine::getSmallFont();
|
||||
|
||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||
std::ostringstream oss;
|
||||
oss << (int)(speed*10);
|
||||
|
||||
font->draw(oss.str().c_str(), pos, color);
|
||||
|
||||
}
|
||||
} // drawSpeedEnergyRank
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Displays the rank and the lap of the kart.
|
||||
* \param info Info object c
|
||||
*/
|
||||
void RaceGUI::drawRankLap(const AbstractKart* kart,
|
||||
const core::recti &viewport)
|
||||
void RaceGUI::drawLap(const AbstractKart* kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
// Don't display laps or ranks if the kart has already finished the race.
|
||||
if (kart->hasFinishedRace()) return;
|
||||
|
||||
World *world = World::getWorld();
|
||||
if (!world->raceHasLaps()) return;
|
||||
const int lap = world->getKartLaps(kart->getWorldKartId());
|
||||
|
||||
// don't display 'lap 0/..' at the start of a race
|
||||
if (lap < 0 ) return;
|
||||
|
||||
core::recti pos;
|
||||
pos.UpperLeftCorner.Y = viewport.UpperLeftCorner.Y;
|
||||
@ -742,52 +810,20 @@ void RaceGUI::drawRankLap(const AbstractKart* kart,
|
||||
if(viewport.UpperLeftCorner.Y==0 &&
|
||||
viewport.LowerRightCorner.X==UserConfigParams::m_width &&
|
||||
race_manager->getNumPlayers()!=3)
|
||||
pos.UpperLeftCorner.Y += 40;
|
||||
pos.LowerRightCorner.Y = viewport.LowerRightCorner.Y;
|
||||
pos.UpperLeftCorner.Y += m_font_height;
|
||||
pos.LowerRightCorner.Y = viewport.LowerRightCorner.Y+20;
|
||||
pos.UpperLeftCorner.X = viewport.LowerRightCorner.X
|
||||
- m_rank_lap_width - 10;
|
||||
- m_lap_width - 10;
|
||||
pos.LowerRightCorner.X = viewport.LowerRightCorner.X;
|
||||
|
||||
gui::ScalableFont* font = (race_manager->getNumLocalPlayers() > 2
|
||||
? GUIEngine::getSmallFont()
|
||||
: GUIEngine::getFont());
|
||||
int font_height = (int)(font->getDimension(L"X").Height);
|
||||
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||
WorldWithRank *world = (WorldWithRank*)(World::getWorld());
|
||||
std::ostringstream out;
|
||||
out << lap + 1 << "/" << race_manager->getNumLaps();
|
||||
|
||||
if (world->displayRank())
|
||||
{
|
||||
const int rank = kart->getPosition();
|
||||
font = GUIEngine::getHighresDigitFont();
|
||||
font->setScale(scaling.Y < 1.0f ? 0.5f: 1.0f);
|
||||
font->draw(out.str().c_str(), pos, color);
|
||||
font->setScale(1.0f);
|
||||
|
||||
font->draw(m_string_rank.c_str(), pos, color);
|
||||
pos.UpperLeftCorner.Y += font_height;
|
||||
pos.LowerRightCorner.Y += font_height;
|
||||
|
||||
char str[256];
|
||||
const unsigned int kart_amount = world->getCurrentNumKarts();
|
||||
sprintf(str, "%d/%d", rank, kart_amount);
|
||||
font->draw(core::stringw(str).c_str(), pos, color);
|
||||
pos.UpperLeftCorner.Y += font_height;
|
||||
pos.LowerRightCorner.Y += font_height;
|
||||
}
|
||||
|
||||
// Don't display laps in follow the leader mode
|
||||
if(world->raceHasLaps())
|
||||
{
|
||||
const int lap = world->getKartLaps(kart->getWorldKartId());
|
||||
|
||||
// don't display 'lap 0/...'
|
||||
if(lap>=0)
|
||||
{
|
||||
font->draw(m_string_lap.c_str(), pos, color);
|
||||
char str[256];
|
||||
sprintf(str, "%d/%d", lap+1, race_manager->getNumLaps());
|
||||
pos.UpperLeftCorner.Y += font_height;
|
||||
pos.LowerRightCorner.Y += font_height;
|
||||
font->draw(core::stringw(str).c_str(), pos, color);
|
||||
pos.UpperLeftCorner.Y += font_height;
|
||||
pos.LowerRightCorner.Y += font_height;
|
||||
}
|
||||
}
|
||||
|
||||
} // drawRankLap
|
||||
} // drawLap
|
||||
|
@ -44,12 +44,6 @@ private:
|
||||
Material *m_speed_meter_icon;
|
||||
Material *m_speed_bar_icon;
|
||||
|
||||
/** Translated string 'lap' displayed every frame. */
|
||||
core::stringw m_string_lap;
|
||||
|
||||
/** Translated string 'rank' displayed every frame. */
|
||||
core::stringw m_string_rank;
|
||||
|
||||
// Minimap related variables
|
||||
// -------------------------
|
||||
/** The mini map of the track. */
|
||||
@ -81,25 +75,42 @@ private:
|
||||
/** Distance of map from bottom of screen. */
|
||||
int m_map_bottom;
|
||||
|
||||
/** Maximum string length of 'rank', 'lap', '99/99'. Used to position
|
||||
* the rank/lap text correctly close to the right border. */
|
||||
int m_rank_lap_width;
|
||||
/** Maximum lap display length (either 9/9 or 99/99). */
|
||||
int m_lap_width;
|
||||
|
||||
/** Maximum string length for the timer */
|
||||
int m_timer_width;
|
||||
|
||||
/** Height of the digit font. */
|
||||
int m_font_height;
|
||||
|
||||
bool m_is_tutorial;
|
||||
/** Animation state: none, getting smaller (old value),
|
||||
* getting bigger (new number). */
|
||||
enum AnimationState {AS_NONE, AS_SMALLER, AS_BIGGER};
|
||||
std::vector<AnimationState> m_animation_states;
|
||||
|
||||
/** When the animation state was changed. */
|
||||
std::vector<float> m_rank_animation_start_times;
|
||||
|
||||
/** Stores the previous rank for each kart. Used for the rank animation. */
|
||||
std::vector<int> m_last_ranks;
|
||||
|
||||
bool m_is_tutorial;
|
||||
|
||||
/* Display informat for one player on the screen. */
|
||||
void drawEnergyMeter (int x, int y, const AbstractKart *kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling);
|
||||
void drawSpeedAndEnergy (const AbstractKart* kart,
|
||||
void drawSpeedEnergyRank (const AbstractKart* kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling);
|
||||
void drawRankLap (const AbstractKart* kart,
|
||||
const core::recti &viewport);
|
||||
void drawLap (const AbstractKart* kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling);
|
||||
void drawRank (const AbstractKart *kart,
|
||||
const core::vector2df &offset,
|
||||
float min_ratio, int meter_width,
|
||||
int meter_height);
|
||||
|
||||
/** Display items that are shown once only (for all karts). */
|
||||
void drawGlobalMiniMap ();
|
||||
@ -111,6 +122,7 @@ public:
|
||||
|
||||
RaceGUI();
|
||||
~RaceGUI();
|
||||
virtual void reset();
|
||||
virtual void renderGlobal(float dt);
|
||||
virtual void renderPlayerView(const Camera *camera, float dt);
|
||||
|
||||
|
@ -377,7 +377,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
||||
// 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();
|
||||
//if (KartSelectionScreen::getRunningInstance() != NULL)
|
||||
// KartSelectionScreen::getRunningInstance()->tearDown();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/xml_request.hpp"
|
||||
#include "states_screens/dialogs/registration_dialog.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
@ -286,7 +285,8 @@ void RegisterScreen::onUpdate(float dt)
|
||||
if(m_signup_request)
|
||||
{
|
||||
if(!m_options_widget->isActivated())
|
||||
m_info_widget->setText(Messages::validatingInfo(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
|
||||
false);
|
||||
|
||||
if(m_signup_request->isDone())
|
||||
{
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
|
||||
using namespace Online;
|
||||
@ -64,7 +63,8 @@ void ServerSelection::refresh()
|
||||
m_fake_refresh = (m_refresh_request == NULL ? true : false);
|
||||
m_server_list_widget->clear();
|
||||
m_server_list_widget->addItem("spacer", L"");
|
||||
m_server_list_widget->addItem("loading", Messages::fetchingServers());
|
||||
m_server_list_widget->addItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching servers")));
|
||||
m_reload_widget->setDeactivated();
|
||||
}
|
||||
|
||||
@ -206,7 +206,8 @@ void ServerSelection::onUpdate(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_server_list_widget->renameItem("loading", Messages::fetchingServers());
|
||||
m_server_list_widget->renameItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching servers")));
|
||||
}
|
||||
}
|
||||
else if(m_fake_refresh)
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/list_widget.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
#include "states_screens/main_menu_screen.hpp"
|
||||
#include "states_screens/options_screen_audio.hpp"
|
||||
@ -73,8 +72,6 @@ void BaseUserScreen::init()
|
||||
m_info_widget = getWidget<LabelWidget>("message");
|
||||
assert(m_info_widget);
|
||||
|
||||
getWidget<CheckBoxWidget>("remember-user")
|
||||
->setState(UserConfigParams::m_remember_user);
|
||||
m_sign_out_name = "";
|
||||
m_sign_in_name = "";
|
||||
|
||||
@ -87,7 +84,7 @@ void BaseUserScreen::init()
|
||||
Screen::init();
|
||||
|
||||
m_players->clearItems();
|
||||
std::string current_player_index="";
|
||||
int current_player_index = -1;
|
||||
|
||||
for (unsigned int n=0; n<PlayerManager::get()->getNumPlayers(); n++)
|
||||
{
|
||||
@ -96,38 +93,20 @@ void BaseUserScreen::init()
|
||||
std::string s = StringUtils::toString(n);
|
||||
m_players->addItem(player->getName(), s, player->getIconFilename(), 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
if(player==PlayerManager::getCurrentPlayer())
|
||||
current_player_index = s;
|
||||
if(player == PlayerManager::getCurrentPlayer())
|
||||
current_player_index = n;
|
||||
}
|
||||
|
||||
m_players->updateItemDisplay();
|
||||
|
||||
// Select the current player. That can only be done after
|
||||
// updateItemDisplay is called.
|
||||
if(current_player_index.size()>0)
|
||||
{
|
||||
m_players->setSelection(current_player_index, PLAYER_ID_GAME_MASTER,
|
||||
/*focus*/ true);
|
||||
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||
const stringw &online_name = player->getLastOnlineName();
|
||||
m_username_tb->setText(online_name);
|
||||
// Select 'online
|
||||
m_online_cb->setState(player->wasOnlineLastTime() ||
|
||||
player->isLoggedIn() );
|
||||
makeEntryFieldsVisible();
|
||||
// We have to deactivate after make visible (since make visible
|
||||
// automatically activates widgets).
|
||||
if(online_name.size()>0)
|
||||
m_username_tb->setDeactivated();
|
||||
else
|
||||
m_username_tb->setActivated();
|
||||
}
|
||||
else // no current player found
|
||||
{
|
||||
// The first player is the most frequently used, so select it
|
||||
if (PlayerManager::get()->getNumPlayers() > 0)
|
||||
selectUser(0);
|
||||
}
|
||||
if(current_player_index != -1)
|
||||
selectUser(current_player_index);
|
||||
// no current player found
|
||||
// The first player is the most frequently used, so select it
|
||||
else if (PlayerManager::get()->getNumPlayers() > 0)
|
||||
selectUser(0);
|
||||
|
||||
} // init
|
||||
|
||||
@ -157,9 +136,8 @@ void BaseUserScreen::selectUser(int index)
|
||||
PlayerProfile *profile = PlayerManager::get()->getPlayer(index);
|
||||
assert(profile);
|
||||
|
||||
getWidget<TextBoxWidget >("username")->setText(profile
|
||||
->getLastOnlineName());
|
||||
m_players->setSelection(StringUtils::toString(index), 0, /*focusIt*/true);
|
||||
m_players->setSelection(StringUtils::toString(index), PLAYER_ID_GAME_MASTER,
|
||||
/*focusIt*/ true);
|
||||
|
||||
// Last game was not online, so make the offline settings the default
|
||||
// (i.e. unckeck online checkbox, and make entry fields invisible).
|
||||
@ -175,6 +153,8 @@ void BaseUserScreen::selectUser(int index)
|
||||
m_online_cb->setState(true);
|
||||
makeEntryFieldsVisible();
|
||||
m_username_tb->setText(profile->getLastOnlineName());
|
||||
getWidget<CheckBoxWidget>("remember-user")->setState(
|
||||
profile->rememberPassword());
|
||||
if(profile->getLastOnlineName().size()>0)
|
||||
m_username_tb->setDeactivated();
|
||||
else
|
||||
@ -246,21 +226,24 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
}
|
||||
else if (name == "remember-user")
|
||||
{
|
||||
UserConfigParams::m_remember_user =
|
||||
getWidget<CheckBoxWidget>("remember-user")->getState();
|
||||
getSelectedPlayer()->setRememberPassword(
|
||||
getWidget<CheckBoxWidget>("remember-user")->getState());
|
||||
}
|
||||
else if (name == "online")
|
||||
{
|
||||
// If online access is not allowed, do not accept an online account
|
||||
// but advice the user where to enable this option.
|
||||
if (m_online_cb->getState() && UserConfigParams::m_internet_status ==
|
||||
Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
if (m_online_cb->getState())
|
||||
{
|
||||
m_info_widget->setText(
|
||||
_("Internet access is disabled, please enable it in the options"),
|
||||
true);
|
||||
sfx_manager->quickSound( "anvil" );
|
||||
m_online_cb->setState(false);
|
||||
if (UserConfigParams::m_internet_status ==
|
||||
Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
{
|
||||
m_info_widget->setText(
|
||||
_("Internet access is disabled, please enable it in the options"),
|
||||
true);
|
||||
sfx_manager->quickSound( "anvil" );
|
||||
m_online_cb->setState(false);
|
||||
}
|
||||
}
|
||||
makeEntryFieldsVisible();
|
||||
}
|
||||
@ -411,8 +394,8 @@ void BaseUserScreen::onUpdate(float dt)
|
||||
core::stringw message = (m_state & STATE_LOGOUT)
|
||||
? _(L"Signing out '%s'",m_sign_out_name.c_str())
|
||||
: _(L"Signing in '%s'", m_sign_in_name.c_str());
|
||||
m_info_widget->setText(Online::Messages::loadingDots(message.c_str()),
|
||||
false );
|
||||
m_info_widget->setText(StringUtils::loadingDots(message.c_str()),
|
||||
false );
|
||||
}
|
||||
PlayerProfile *player = getSelectedPlayer();
|
||||
if(player)
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
#include "coreutil.h"
|
||||
|
||||
@ -523,6 +524,29 @@ namespace StringUtils
|
||||
return std::string(s);
|
||||
} // timeToString
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Shows a increasing number of dots.
|
||||
* \param interval A float representing the time it takes to add a new dot
|
||||
* \param max_dots The number of dots used. Defaults to 3.
|
||||
*/
|
||||
irr::core::stringw loadingDots(float interval, int max_dots)
|
||||
{
|
||||
int nr_dots = int(floor(StkTime::getRealTime() / interval))
|
||||
% (max_dots + 1);
|
||||
return irr::core::stringw((std::string(nr_dots, '.') +
|
||||
std::string(max_dots - nr_dots, ' ')).c_str());
|
||||
} // loadingDots
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the string given with loadingDots appended. A simple
|
||||
* convenience function to type less in calls.
|
||||
* \parameter s The string to which the loading dots are appended.
|
||||
*/
|
||||
irr::core::stringw loadingDots(const wchar_t *s)
|
||||
{
|
||||
return irr::core::stringw(s) + loadingDots();
|
||||
} // loadingDots
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Replaces values in a string.
|
||||
* \param other string in which to replace stuff
|
||||
|
@ -46,6 +46,8 @@ namespace StringUtils
|
||||
|
||||
bool notEmpty(const irr::core::stringw& input);
|
||||
std::string timeToString(float time);
|
||||
irr::core::stringw loadingDots(float interval = 0.5f, int max_dots = 3);
|
||||
irr::core::stringw loadingDots(const wchar_t *s);
|
||||
std::string toUpperCase(const std::string&);
|
||||
std::string toLowerCase(const std::string&);
|
||||
std::vector<std::string> split(const std::string& s, char c,
|
||||
|
@ -9,6 +9,10 @@ const int fontsizes[] = {4,6,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,56,68,72
|
||||
|
||||
char bUsed[0x10000]={0};
|
||||
|
||||
/** True if pot files where given, which indicates that Asian fonts
|
||||
* are to be created, and an offset needs to be used for the index. */
|
||||
bool has_pot_files = false;
|
||||
|
||||
inline u32 getTextureSizeFromSurfaceSize(u32 size)
|
||||
{
|
||||
u32 ts = 0x01;
|
||||
@ -19,6 +23,7 @@ inline u32 getTextureSizeFromSurfaceSize(u32 size)
|
||||
}
|
||||
|
||||
bool LoadPoFiles(const char* sListFileName){
|
||||
has_pot_files = true;
|
||||
char s[1024];
|
||||
std::ifstream fin(sListFileName);
|
||||
if(!fin){
|
||||
@ -57,6 +62,17 @@ bool LoadPoFiles(const char* sListFileName){
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Set all characters in the given character string to be used. */
|
||||
bool setUsedCharacters(const char* characters)
|
||||
{
|
||||
int n = strlen(characters);
|
||||
for(int i=0; i<n; i++)
|
||||
bUsed[short(characters[i])] = true;
|
||||
return true;
|
||||
} // setUsedCharacters
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// windows specific
|
||||
#ifdef _IRR_WINDOWS_
|
||||
|
||||
@ -762,7 +778,8 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format)
|
||||
writer->writeLineBreak();
|
||||
|
||||
// write images and link to them
|
||||
u32 offset_for_asian_fonts=100;
|
||||
// Only use the offset if Asian fonts are created.
|
||||
u32 offset_for_asian_fonts=has_pot_files ? 100 : 0;
|
||||
for (u32 i=0; i<currentImages.size(); ++i)
|
||||
{
|
||||
imagename = filename;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#endif
|
||||
|
||||
bool LoadPoFiles(const char* sListFileName);
|
||||
bool setUsedCharacters(const char* characters);
|
||||
|
||||
namespace irr {
|
||||
class CFontTool : public irr::IReferenceCounted
|
||||
|
@ -14,10 +14,10 @@ if(FONT_TOOL)
|
||||
if(FREETYPE_FOUND)
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS})
|
||||
add_executable(font_tool CFontTool.cpp main.cpp)
|
||||
target_link_libraries(font_tool stkirrlicht)
|
||||
target_link_libraries(font_tool ${FREETYPE_LIBRARIES})
|
||||
target_link_libraries(font_tool ${X11_Xft_LIB} Xxf86vm)
|
||||
target_link_libraries(font_tool ${OPENGL_LIBRARIES})
|
||||
target_link_libraries(font_tool stkirrlicht)
|
||||
target_link_libraries(font_tool ${FONTCONFIG_LIBRARY})
|
||||
else()
|
||||
message(STATUS "Freetype was not found, the font tool won't be built (only useful for developers)")
|
||||
|
@ -412,7 +412,7 @@ void createGUI(IrrlichtDevice* device, CFontTool* fc)
|
||||
|
||||
//new
|
||||
|
||||
env->addCheckBox(false, core::rect<s32>(xp,yp,xp+150,yp+h),win, 201, L"Export used characters only")->setEnabled(false);
|
||||
env->addCheckBox(false, core::rect<s32>(xp,yp,xp+150,yp+h),win, 201, L"Export used characters only")->setChecked(false);
|
||||
yp += (s32)(h*1.5f);
|
||||
|
||||
env->addCheckBox(false, core::rect<s32>(xp,yp,xp+150,yp+h),win, 202, L"Exclude basic latin characters");
|
||||
@ -512,10 +512,34 @@ int main(int argc,char **argv)
|
||||
|
||||
createGUI(device, fc);
|
||||
|
||||
//new
|
||||
if(argc>1 && LoadPoFiles(argv[1])){
|
||||
device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(201,true)->setEnabled(true);
|
||||
}
|
||||
for(int i=1; i<argc; i++)
|
||||
{
|
||||
if(!strcmp(argv[i],"-c") && i<argc-1)
|
||||
{
|
||||
i++;
|
||||
if(setUsedCharacters(argv[i]))
|
||||
{
|
||||
IGUICheckBox *box =
|
||||
dynamic_cast<IGUICheckBox*>(device->getGUIEnvironment()
|
||||
->getRootGUIElement()
|
||||
->getElementFromId(201, true));
|
||||
box->setChecked(true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Old style: just a single parameter, assume it's a file name with pot files in it
|
||||
if(LoadPoFiles(argv[i]))
|
||||
{
|
||||
IGUICheckBox *box =
|
||||
dynamic_cast<IGUICheckBox*>(device->getGUIEnvironment()
|
||||
->getRootGUIElement()
|
||||
->getElementFromId(201, true));
|
||||
box->setChecked(true);
|
||||
}
|
||||
}
|
||||
} // for i <argc
|
||||
|
||||
while(device->run())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user