From bf76fbff6ec058f4e186e27904313b4cc31fac62 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Thu, 5 Jun 2014 16:16:08 +0200 Subject: [PATCH 01/64] Fix bug with deactivated widgets where visibility is changed --- src/guiengine/event_handler.cpp | 6 +++--- src/guiengine/widget.cpp | 1 - src/guiengine/widgets/spinner_widget.hpp | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/guiengine/event_handler.cpp b/src/guiengine/event_handler.cpp index cfcc0332c..0e6e3465f 100644 --- a/src/guiengine/event_handler.cpp +++ b/src/guiengine/event_handler.cpp @@ -631,7 +631,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 +658,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 +699,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; diff --git a/src/guiengine/widget.cpp b/src/guiengine/widget.cpp index 446d4b565..4d8fe4e98 100644 --- a/src/guiengine/widget.cpp +++ b/src/guiengine/widget.cpp @@ -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 Date: Thu, 5 Jun 2014 18:27:19 +0200 Subject: [PATCH 02/64] Fix compiler warnings --- lib/bullet/src/LinearMath/btScalar.h | 2 +- src/animations/animation_base.hpp | 1 + src/graphics/glwrap.cpp | 6 +++--- src/graphics/stkbillboard.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/bullet/src/LinearMath/btScalar.h b/lib/bullet/src/LinearMath/btScalar.h index 7d54bf5ad..f601e3a90 100644 --- a/lib/bullet/src/LinearMath/btScalar.h +++ b/lib/bullet/src/LinearMath/btScalar.h @@ -109,7 +109,7 @@ inline int btGetVersion() #ifdef __SPU__ #include #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 diff --git a/src/animations/animation_base.hpp b/src/animations/animation_base.hpp index 2bc335bc3..9be757ae6 100644 --- a/src/animations/animation_base.hpp +++ b/src/animations/animation_base.hpp @@ -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 diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 45c51a279..516be8203 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -532,7 +532,7 @@ unsigned GPUTimer::elapsedTimeus() FrameBuffer::FrameBuffer() {} FrameBuffer::FrameBuffer(const std::vector &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 &RTTs, size_t w, size_t h, bo } FrameBuffer::FrameBuffer(const std::vector &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& position, glUseProgram(0); glGetError(); -} \ No newline at end of file +} diff --git a/src/graphics/stkbillboard.cpp b/src/graphics/stkbillboard.cpp index 4ce29f479..710dec32d 100644 --- a/src/graphics/stkbillboard.cpp +++ b/src/graphics/stkbillboard.cpp @@ -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& 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(); From db4699781ad156775e15bc14743c4e53b3fb39f6 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Thu, 5 Jun 2014 18:47:15 +0200 Subject: [PATCH 03/64] Fix my fix --- src/animations/animation_base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/animations/animation_base.hpp b/src/animations/animation_base.hpp index 9be757ae6..1fc6ef090 100644 --- a/src/animations/animation_base.hpp +++ b/src/animations/animation_base.hpp @@ -69,7 +69,7 @@ protected: public: AnimationBase(const XMLNode &node); AnimationBase(Ipo *ipo); - virtual ~AnimationBase() {}; + 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 From cd8c27cbecec79c12cad2e6adf5066a6a695df83 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Thu, 5 Jun 2014 22:07:00 +0200 Subject: [PATCH 04/64] Save 'remember-password' setting per user --- src/config/player_manager.cpp | 13 +++++-------- src/config/player_profile.cpp | 26 +++++++++++++++----------- src/config/player_profile.hpp | 10 ++++++++++ src/config/user_config.hpp | 4 ---- src/online/online_player_profile.cpp | 12 ++++++------ src/states_screens/user_screen.cpp | 19 +++++++++++++------ 6 files changed, 49 insertions(+), 35 deletions(-) diff --git a/src/config/player_manager.cpp b/src/config/player_manager.cpp index 0455fab3c..31d553cb7 100644 --- a/src/config/player_manager.cpp +++ b/src/config/player_manager.cpp @@ -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"\n"; players_file << L"\n"; - if(m_current_player && UserConfigParams::m_remember_user) + if(m_current_player) { players_file << L" getName() << L"\"/>\n"; diff --git a/src/config/player_profile.cpp b/src/config/player_profile.cpp index fe7d47077..e8db49a39 100644 --- a/src/config/player_profile.cpp +++ b/src/config/player_profile.cpp @@ -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); diff --git a/src/config/player_profile.hpp b/src/config/player_profile.hpp index a4c5ab3c7..82bbb1b92 100644 --- a/src/config/player_profile.hpp +++ b/src/config/player_profile.hpp @@ -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; @@ -269,6 +272,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 diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index bf91d0ddc..bf65f4633 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -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.")); diff --git a/src/online/online_player_profile.cpp b/src/online/online_player_profile.cpp index 11634a4a0..6617a2195 100644 --- a/src/online/online_player_profile.cpp +++ b/src/online/online_player_profile.cpp @@ -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,7 +187,7 @@ 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() ); } @@ -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 diff --git a/src/states_screens/user_screen.cpp b/src/states_screens/user_screen.cpp index 0f305431c..0f8532d1b 100644 --- a/src/states_screens/user_screen.cpp +++ b/src/states_screens/user_screen.cpp @@ -74,7 +74,7 @@ void BaseUserScreen::init() assert(m_info_widget); getWidget("remember-user") - ->setState(UserConfigParams::m_remember_user); + ->setState(false); m_sign_out_name = ""; m_sign_in_name = ""; @@ -114,6 +114,8 @@ void BaseUserScreen::init() // Select 'online m_online_cb->setState(player->wasOnlineLastTime() || player->isLoggedIn() ); + getWidget("remember-user")->setState( + player->rememberPassword()); makeEntryFieldsVisible(); // We have to deactivate after make visible (since make visible // automatically activates widgets). @@ -157,8 +159,6 @@ void BaseUserScreen::selectUser(int index) PlayerProfile *profile = PlayerManager::get()->getPlayer(index); assert(profile); - getWidget("username")->setText(profile - ->getLastOnlineName()); m_players->setSelection(StringUtils::toString(index), 0, /*focusIt*/true); // Last game was not online, so make the offline settings the default @@ -175,6 +175,8 @@ void BaseUserScreen::selectUser(int index) m_online_cb->setState(true); makeEntryFieldsVisible(); m_username_tb->setText(profile->getLastOnlineName()); + getWidget("remember-user")->setState( + profile->rememberPassword()); // And make the password invisible if the session is saved (i.e // the user does not need to enter a password). @@ -242,8 +244,8 @@ void BaseUserScreen::eventCallback(Widget* widget, } else if (name == "remember-user") { - UserConfigParams::m_remember_user = - getWidget("remember-user")->getState(); + getSelectedPlayer()->setRememberPassword( + getWidget("remember-user")->getState()); } else if (name == "online") { @@ -257,8 +259,13 @@ void BaseUserScreen::eventCallback(Widget* widget, true); sfx_manager->quickSound( "anvil" ); m_online_cb->setState(false); + } else + { + m_username_tb->setText(""); + m_password_tb->setText(""); + getWidget("remember-user")->setState(false); + makeEntryFieldsVisible(); } - makeEntryFieldsVisible(); } else if (name == "options") { From d5d7f5bd920788abee302b1bdef36311bc86bf2a Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 6 Jun 2014 08:05:25 +1000 Subject: [PATCH 05/64] Fixed logout of old player when switching to a new player. Fixed disabling the account name (to prevent people from changing their online name). --- src/states_screens/user_screen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/states_screens/user_screen.cpp b/src/states_screens/user_screen.cpp index ba64e889a..88193f09f 100644 --- a/src/states_screens/user_screen.cpp +++ b/src/states_screens/user_screen.cpp @@ -175,6 +175,10 @@ void BaseUserScreen::selectUser(int index) m_online_cb->setState(true); makeEntryFieldsVisible(); m_username_tb->setText(profile->getLastOnlineName()); + if(profile->getLastOnlineName().size()>0) + m_username_tb->setDeactivated(); + else + m_username_tb->setActivated(); // And make the password invisible if the session is saved (i.e // the user does not need to enter a password). @@ -332,10 +336,11 @@ void BaseUserScreen::login() m_sign_out_name = current->getLastOnlineName(); current->requestSignOut(); m_state = (UserScreenState)(m_state | STATE_LOGOUT); + // If the online user name was changed, reset the save data // for this user (otherwise later the saved session will be // resumed, not logging the user with the new account). - if(current->getLastOnlineName()!=new_username) + if(player==current && current->getLastOnlineName()!=new_username) current->clearSession(); } PlayerManager::get()->setCurrentPlayer(player); From 3cd2b97202b54ace9b525895ae4b38a4ade8c9b5 Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 6 Jun 2014 09:36:12 +1000 Subject: [PATCH 06/64] Added missing operator-(Vec3, btVector3). Without this operator additional typecast where necessary on VS when computing Vec3-btVector3. --- src/karts/kart.cpp | 2 +- src/physics/physical_object.cpp | 2 +- src/utils/vec3.hpp | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index c6d975ee4..efe45ef5c 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1752,7 +1752,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal) btVector3 gravity = m_body->getGravity(); gravity.normalize(); // Cast necessary since otherwise to operator- (vec3/btvector) exists - Vec3 impulse = (btVector3)normal - gravity* btDot(normal, gravity); + Vec3 impulse = normal - gravity* btDot(normal, gravity); if(impulse.getX() || impulse.getZ()) impulse.normalize(); else diff --git a/src/physics/physical_object.cpp b/src/physics/physical_object.cpp index fd009d103..45eaeb564 100644 --- a/src/physics/physical_object.cpp +++ b/src/physics/physical_object.cpp @@ -188,7 +188,7 @@ void PhysicalObject::move(const Vec3& xyz, const core::vector3df& hpr) irr::core::quaternion tempQuat(mat); q = btQuaternion(tempQuat.X, tempQuat.Y, tempQuat.Z, tempQuat.W); - btTransform trans(q,(btVector3)xyz-quatRotate(q,m_graphical_offset)); + btTransform trans(q, xyz-quatRotate(q,m_graphical_offset)); m_motion_state->setWorldTransform(trans); } // move diff --git a/src/utils/vec3.hpp b/src/utils/vec3.hpp index 77d894369..c52e6d7e8 100644 --- a/src/utils/vec3.hpp +++ b/src/utils/vec3.hpp @@ -168,6 +168,14 @@ public: Vec3 operator-(const Vec3& v1) const {return (Vec3)(*(btVector3*)this -(btVector3)v1); } // ------------------------------------------------------------------------ + /** Computes this = this - v1. On VS this special version is needed, + * since otherwise Vec3-btVector3 is ont unique (could be cast to + * btVector3-btVector3, or convert btVector3 to Vec3()). */ + Vec3 operator-(const btVector3 v1) const + { + return *(btVector3*)this - v1; + } + // ------------------------------------------------------------------------ /** Helper functions to treat this vec3 as a 2d vector. This returns the * square of the length of the first 2 dimensions. */ float length2_2d() const { return m_floats[0]*m_floats[0] From be5577045dc7f47170e381095275dbce646433bb Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Thu, 5 Jun 2014 20:06:27 -0400 Subject: [PATCH 07/64] Work on new feature unlocked cutscene, starting to work correctly, more testing (and art work) needed --- src/modes/cutscene_world.cpp | 24 +++++++++++- src/states_screens/feature_unlocked.cpp | 49 ++++++++----------------- src/states_screens/grand_prix_lose.cpp | 9 +++++ src/states_screens/grand_prix_win.cpp | 13 ++++++- src/states_screens/race_result_gui.cpp | 4 ++ 5 files changed, 63 insertions(+), 36 deletions(-) diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index 319f901e5..f59c1937c 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -413,7 +413,7 @@ void CutsceneWorld::enterRaceOverState() OverWorld::enterOverWorld(); } // TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably - else if (m_parts.size() == 1 && m_parts[0] == "gplose") + else if (m_parts.size() == 1 && m_parts[0] == "gplose") { race_manager->exitRace(); StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); @@ -438,6 +438,28 @@ void CutsceneWorld::enterRaceOverState() StateManager::get()->pushScreen( s ); } } + // TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably + else if (m_parts.size() == 1 && m_parts[0] == "featunlocked") + { + if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) + { + // in GP mode, continue GP after viewing this screen + StateManager::get()->popMenu(); + race_manager->next(); + } + else + { + // back to menu or overworld + race_manager->exitRace(); + StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); + //StateManager::get()->popMenu(); + + if (race_manager->raceWasStartedFromOverworld()) + { + OverWorld::enterOverWorld(); + } + } + } else { race_manager->exitRace(); diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index e414c06f3..624e99e0c 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -156,7 +156,7 @@ void FeatureUnlockedCutScene::onCutsceneEnd() irr_driver->removeNode(m_avoid_irrlicht_bug); m_avoid_irrlicht_bug = NULL; #endif - + m_unlocked_stuff.clearAndDeleteAll(); m_all_kart_models.clearAndDeleteAll(); @@ -353,7 +353,6 @@ void FeatureUnlockedCutScene::init() void FeatureUnlockedCutScene::tearDown() { Screen::tearDown(); - ((CutsceneWorld*)World::getWorld())->abortCutscene(); } // tearDown // ---------------------------------------------------------------------------- @@ -379,8 +378,6 @@ void FeatureUnlockedCutScene::onUpdate(float dt) float progress_factor = (m_global_time - GIFT_EXIT_FROM) / (GIFT_EXIT_TO - GIFT_EXIT_FROM); float smoothed_progress_factor = sin((progress_factor - 0.5f)*M_PI)/2.0f + 0.5f; - Log::info("smoothed_progress_factor", "%f", smoothed_progress_factor); - for (int n=0; nabortCutscene(); continueButtonPressed(); return false; // continueButtonPressed already pop'ed the menu } // onEscapePressed @@ -555,35 +551,20 @@ bool FeatureUnlockedCutScene::onEscapePressed() void FeatureUnlockedCutScene::continueButtonPressed() { - if (m_global_time < GIFT_EXIT_TO) - { - // If animation was not over yet, the button is used to skip the animation - while (m_global_time < GIFT_EXIT_TO) - { - // simulate all the steps of the animation until we reach the end - onUpdate(0.4f); - } - } - else - { - if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) - { - // in GP mode, continue GP after viewing this screen - StateManager::get()->popMenu(); - race_manager->next(); - } - else - { - // back to menu or overworld - race_manager->exitRace(); - StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); - - if (race_manager->raceWasStartedFromOverworld()) - { - OverWorld::enterOverWorld(); - } - } - } + //if (m_global_time < GIFT_EXIT_TO) + //{ + // // If animation was not over yet, the button is used to skip the animation + // while (m_global_time < GIFT_EXIT_TO) + // { + // // simulate all the steps of the animation until we reach the end + // onUpdate(0.4f); + // World::getWorld()->updateWorld(0.4f); + // } + //} + //else + //{ + ((CutsceneWorld*)World::getWorld())->abortCutscene(); + //} } // continueButtonPressed diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index e5d3fca69..26e55b51f 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -117,9 +117,18 @@ void GrandPrixLose::onCutsceneEnd() 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 parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); scene->addTrophy(race_manager->getDifficulty()); scene->findWhatWasUnlocked(race_manager->getDifficulty()); diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index 18bf4c927..eb5ee8fb2 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -127,7 +127,18 @@ void GrandPrixWin::onCutsceneEnd() PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); PlayerManager::getCurrentPlayer()->clearUnlocked(); - FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); + 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 parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); assert(unlocked.size() > 0); scene->addTrophy(race_manager->getDifficulty()); diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 8854a3d91..35afce0a5 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -275,6 +275,10 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget, { FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); + std::vector parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); + scene->addTrophy(race_manager->getDifficulty()); scene->findWhatWasUnlocked(race_manager->getDifficulty()); StateManager::get()->popMenu(); From 76d564f61f0aa16f49780f59061802709e0d7408 Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 6 Jun 2014 10:58:32 +1000 Subject: [PATCH 08/64] Try to fix compilation with pre opengl 4 drivers. --- src/graphics/post_processing.cpp | 8 ++++++++ src/graphics/rtts.cpp | 12 ++++++++++++ src/graphics/shaders.cpp | 10 ++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 3c8958050..bacc58700 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -417,12 +417,16 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a } else { +#if !defined(__linux__) || defined(GL_VERSION_4_2) glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program); glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0); glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 1); glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1); +#else + assert(false); +#endif } } { @@ -443,12 +447,16 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a } else { +#if !defined(__linux__) || defined(GL_VERSION_4_3) glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program); glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0); glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 1); glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1); +#else + assert(false); +#endif } } } diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 1858d2f6e..913e525e6 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -30,7 +30,13 @@ static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint i if (irr_driver->getGLSLVersion() < 420) glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0); else + { +#if !defined(__linux__) || defined(GL_VERSION_4_2) glTexStorage3D(target, 1, internalFormat, w, h, d); +#else + assert(false); +#endif + } return result; } @@ -42,7 +48,13 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G if (irr_driver->getGLSLVersion() < 420) glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0); else + { +#if !defined(__linux__) || defined(GL_VERSION_4_2) glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height); +#else + assert(false); +#endif + } return result; } diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 59cc101fb..285e1c264 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -277,11 +277,15 @@ 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(); @@ -2441,6 +2445,7 @@ namespace FullScreenShader vao = createFullScreenVAO(Program); } +#if !defined(__linux__) || defined(GL_VERSION_4_3) GLuint ComputeGaussian17TapHShader::Program; GLuint ComputeGaussian17TapHShader::uniform_source; GLuint ComputeGaussian17TapHShader::uniform_dest; @@ -2451,7 +2456,7 @@ namespace FullScreenShader uniform_source = glGetUniformLocation(Program, "source"); uniform_dest = glGetUniformLocation(Program, "dest"); } - +#endif GLuint Gaussian6HBlurShader::Program; GLuint Gaussian6HBlurShader::uniform_tex; GLuint Gaussian6HBlurShader::uniform_pixel; @@ -2497,6 +2502,7 @@ namespace FullScreenShader GLuint ComputeGaussian17TapVShader::Program; GLuint ComputeGaussian17TapVShader::uniform_source; GLuint ComputeGaussian17TapVShader::uniform_dest; +#if !defined(__linux__) || defined(GL_VERSION_4_3) void ComputeGaussian17TapVShader::init() { Program = LoadProgram( @@ -2504,7 +2510,7 @@ namespace FullScreenShader uniform_source = glGetUniformLocation(Program, "source"); uniform_dest = glGetUniformLocation(Program, "dest"); } - +#endif GLuint Gaussian6VBlurShader::Program; GLuint Gaussian6VBlurShader::uniform_tex; GLuint Gaussian6VBlurShader::uniform_pixel; From 52b4651b9e8d3bbea1547bd560840063264d4982 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Fri, 6 Jun 2014 11:04:50 +0300 Subject: [PATCH 09/64] Fix typo in 76d564f --- src/graphics/post_processing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index bacc58700..87653506e 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -417,7 +417,7 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a } else { -#if !defined(__linux__) || defined(GL_VERSION_4_2) +#if !defined(__linux__) || defined(GL_VERSION_4_3) glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program); glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); From de4e45280b093ddb9fc3a276f8b3b33a541bdf79 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Fri, 6 Jun 2014 11:31:52 +0200 Subject: [PATCH 10/64] Remember password better --- src/config/player_manager.cpp | 2 +- src/config/player_profile.cpp | 2 +- src/online/online_player_profile.cpp | 2 +- src/states_screens/user_screen.cpp | 67 +++++++++------------------- 4 files changed, 25 insertions(+), 48 deletions(-) diff --git a/src/config/player_manager.cpp b/src/config/player_manager.cpp index 31d553cb7..af4e0bc63 100644 --- a/src/config/player_manager.cpp +++ b/src/config/player_manager.cpp @@ -170,7 +170,7 @@ PlayerManager::~PlayerManager() PlayerProfile *player; for_in(player, m_all_players) { - if(player->rememberPassword()) + if(!player->rememberPassword()) player->clearSession(); } save(); diff --git a/src/config/player_profile.cpp b/src/config/player_profile.cpp index e8db49a39..c5fdcabe5 100644 --- a/src/config/player_profile.cpp +++ b/src/config/player_profile.cpp @@ -207,7 +207,7 @@ void PlayerProfile::save(UTFWriter &out) << 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"; - out << L" remember-password=\"" << m_remember_password << L"\">\n"; + out << L" remember-password=\"" << m_remember_password << L"\">\n"; { if(m_story_mode_status) m_story_mode_status->save(out); diff --git a/src/online/online_player_profile.cpp b/src/online/online_player_profile.cpp index 6617a2195..4559fa538 100644 --- a/src/online/online_player_profile.cpp +++ b/src/online/online_player_profile.cpp @@ -189,7 +189,7 @@ namespace Online m_online_state = OS_SIGNED_IN; if(rememberPassword()) { - saveSession(getOnlineId(), getToken() ); + saveSession(getOnlineId(), getToken()); } ProfileManager::get()->addPersistent(m_profile); std::string achieved_string(""); diff --git a/src/states_screens/user_screen.cpp b/src/states_screens/user_screen.cpp index 20011b4a7..266d73db6 100644 --- a/src/states_screens/user_screen.cpp +++ b/src/states_screens/user_screen.cpp @@ -73,8 +73,6 @@ void BaseUserScreen::init() m_info_widget = getWidget("message"); assert(m_info_widget); - getWidget("remember-user") - ->setState(false); m_sign_out_name = ""; m_sign_in_name = ""; @@ -87,7 +85,7 @@ void BaseUserScreen::init() Screen::init(); m_players->clearItems(); - std::string current_player_index=""; + int current_player_index = -1; for (unsigned int n=0; ngetNumPlayers(); n++) { @@ -96,40 +94,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() ); - getWidget("remember-user")->setState( - player->rememberPassword()); - 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 @@ -159,7 +137,8 @@ void BaseUserScreen::selectUser(int index) PlayerProfile *profile = PlayerManager::get()->getPlayer(index); assert(profile); - 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). @@ -255,21 +234,19 @@ void BaseUserScreen::eventCallback(Widget* widget, { // 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 == + if (m_online_cb->getState()) + { + 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); - } else - { - m_username_tb->setText(""); - m_password_tb->setText(""); - getWidget("remember-user")->setState(false); - makeEntryFieldsVisible(); + { + 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(); } else if (name == "options") { From d0879cf0750aa514e03c0c4fc3f970da2ea175ad Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 6 Jun 2014 21:53:57 +1000 Subject: [PATCH 11/64] Removed file that should never have been added in the first place ;) --- .../register_screen_with_message | 204 ------------------ 1 file changed, 204 deletions(-) delete mode 100644 src/states_screens/register_screen_with_message diff --git a/src/states_screens/register_screen_with_message b/src/states_screens/register_screen_with_message deleted file mode 100644 index aeaead587..000000000 --- a/src/states_screens/register_screen_with_message +++ /dev/null @@ -1,204 +0,0 @@ -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2014 Joerg Henrichs -// -// 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 "states_screens/register_screen.hpp" - -#include "audio/sfx_manager.hpp" -#include "guiengine/widgets/label_widget.hpp" -#include "guiengine/widgets/ribbon_widget.hpp" -#include "guiengine/widgets/text_box_widget.hpp" -#include "online/current_user.hpp" -#include "online/messages.hpp" -#include "states_screens/dialogs/registration_dialog.hpp" -#include "states_screens/dialogs/message_dialog.hpp" -#include "states_screens/guest_login_screen.hpp" -#include "states_screens/login_screen.hpp" -#include "states_screens/main_menu_screen.hpp" -#include "states_screens/state_manager.hpp" -#include "utils/log.hpp" -#include "utils/translation.hpp" - -using namespace GUIEngine; -using namespace Online; - -DEFINE_SCREEN_SINGLETON( RegisterScreen ); - -// ----------------------------------------------------------------------------- - -RegisterScreen::RegisterScreen() : Screen("online/register.stkgui") -{ -} // RegisterScreen - -// ----------------------------------------------------------------------------- -void RegisterScreen::init() -{ - // Make sure this tab is actually focused. - RibbonWidget* tabs = this->getWidget("login_tabs"); - if (tabs) tabs->select( "tab_register", PLAYER_ID_GAME_MASTER ); - - TextBoxWidget *password_widget = getWidget("password"); - password_widget->setPasswordBox(true,L'*'); - password_widget = getWidget("password_confirm"); - password_widget->setPasswordBox(true,L'*'); - - m_info_widget = getWidget("info"); - assert(m_info_widget); - m_options_widget = getWidget("options"); - assert(m_options_widget); - - m_signup_request = NULL; - m_info_message_shown = false; -} // init - -// ----------------------------------------------------------------------------- -void RegisterScreen::doRegister() -{ - core::stringw username = getWidget("username")->getText().trim(); - core::stringw password = getWidget("password")->getText().trim(); - core::stringw password_confirm = getWidget("password_confirm") - ->getText().trim(); - core::stringw email = getWidget("email")->getText().trim(); - core::stringw email_confirm = getWidget("email_confirm") - ->getText().trim(); - - m_info_widget->setErrorColor(); - - if (password != password_confirm) - { - m_info_widget->setText(_("Passwords don't match!"), false); - } - else if (email != email_confirm) - { - m_info_widget->setText(_("Emails don't match!"), false); - } - else if (username.size() < 4 || username.size() > 30) - { - m_info_widget->setText(_("Username has to be between 4 and 30 characters long!"), false); - } - else if (password.size() < 8 || password.size() > 30) - { - m_info_widget->setText(_("Password has to be between 8 and 30 characters long!"), false); - } - else if (email.size() < 4 || email.size() > 50) - { - m_info_widget->setText(_("Email has to be between 4 and 50 characters long!"), false); - } - else - { - m_info_widget->setDefaultColor(); - new MessageDialog( - _("=== STK Terms and Conditions ===\n" - "You must agree to these terms in order to register an account for STK." - "Still needs actual content. Preferably in an XML document which can then be parsed to be put here.\n\n" - "By checking the box below, you are confirming that you understand these terms." - "If you have any questions or comments regarding these terms," - "one of the members of the development team would gladly assist you." - ), - MessageDialog::MESSAGE_DIALOG_OK_CANCEL, NULL, false); - return; - } - - sfx_manager->quickSound( "anvil" ); - -} // doRegister - -// ----------------------------------------------------------------------------- -/** Called from the registration info dialog when 'accept' is clicked. - */ -void RegisterScreen::acceptTerms() -{ - m_options_widget->setDeactivated(); - - core::stringw username = getWidget("username")->getText().trim(); - core::stringw password = getWidget("password")->getText().trim(); - core::stringw password_confirm= getWidget("password_confirm")->getText().trim(); - core::stringw email = getWidget("email")->getText().trim(); - - m_signup_request = CurrentUser::get()->requestSignUp(username, password, - password_confirm, email); -} // acceptTerms - -// ----------------------------------------------------------------------------- - -void RegisterScreen::onUpdate(float dt, irr::video::IVideoDriver*) -{ - if(m_signup_request) - { - if(!m_options_widget->isActivated()) - m_info_widget->setText(Messages::validatingInfo(), false); - - if(m_signup_request->isDone()) - { - if(m_signup_request->isSuccess()) - { - new MessageDialog( - _("You will receive an email with further instructions " - "regarding account activation. Please be patient and be " - "sure to check your spam folder."), - MessageDialog::MESSAGE_DIALOG_OK, NULL, false); - // Set the flag that the message was shown, which will triger - // a pop of this menu and so a return to the main menu - m_info_message_shown = true; - } - else - { - // Error signing up, display error message - m_info_widget->setText(m_signup_request->getInfo(), false); - } - delete m_signup_request; - m_signup_request = NULL; - m_options_widget->setActivated(); - } - } - else if(m_info_message_shown && !ModalDialog::isADialogActive()) - { - // Once the info message was shown (signup was successful), but the - // message has been gone (user clicked on OK), go back to main menu - StateManager::get()->popMenu(); - } -} // onUpdate - -// ----------------------------------------------------------------------------- - -void RegisterScreen::eventCallback(Widget* widget, const std::string& name, - const int playerID) -{ - if (name == "login_tabs") - { - const std::string selection = - ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER); - StateManager *sm = StateManager::get(); - if (selection == "tab_login") - sm->replaceTopMostScreen(LoginScreen::getInstance()); - else if (selection == "tab_guest_login") - sm->replaceTopMostScreen(GuestLoginScreen::getInstance()); - } - else if (name=="options") - { - const std::string button = m_options_widget - ->getSelectionIDString(PLAYER_ID_GAME_MASTER); - if(button=="next") - { - doRegister(); - } - else if(button=="cancel") - StateManager::get()->escapePressed(); - } - -} // eventCallback - -// ----------------------------------------------------------------------------- From 9a37cd2c2bf8661b3bc93f6b65bdc94f68e82947 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Fri, 6 Jun 2014 22:23:52 +0200 Subject: [PATCH 12/64] Change focus cycle so invisible and deactivated widgets are skiped --- src/guiengine/event_handler.cpp | 205 +++++++------------------------- src/guiengine/event_handler.hpp | 3 +- 2 files changed, 46 insertions(+), 162 deletions(-) diff --git a/src/guiengine/event_handler.cpp b/src/guiengine/event_handler.cpp index cfcc0332c..5f493127f 100644 --- a/src/guiengine/event_handler.cpp +++ b/src/guiengine/event_handler.cpp @@ -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); } } diff --git a/src/guiengine/event_handler.hpp b/src/guiengine/event_handler.hpp index f4207f4e8..be31df84f 100644 --- a/src/guiengine/event_handler.hpp +++ b/src/guiengine/event_handler.hpp @@ -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 From 56896bab239922a1b94ed577f5c49cf5cd8c7d44 Mon Sep 17 00:00:00 2001 From: vlj Date: Fri, 6 Jun 2014 22:36:43 +0200 Subject: [PATCH 13/64] Minify ssao buffer. --- src/graphics/irr_driver.hpp | 4 ++++ src/graphics/render.cpp | 8 +++++--- src/graphics/rtts.cpp | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index dc06527bd..ff8c0f970 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -88,7 +88,9 @@ enum TypeFBO FBO_TMP4, FBO_LINEAR_DEPTH, FBO_HALF1, + FBO_HALF1_R, FBO_HALF2, + FBO_HALF2_R, FBO_QUARTER1, FBO_QUARTER2, FBO_EIGHTH1, @@ -139,6 +141,8 @@ enum TypeRTT RTT_HALF1, RTT_HALF2, + RTT_HALF1_R, + RTT_HALF2_R, RTT_QUARTER1, RTT_QUARTER2, diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 170972a1d..93ef66515 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -193,7 +193,7 @@ void IrrDriver::renderGLSL(float dt) if (irr_driver->getNormals()) irr_driver->getFBO(FBO_NORMAL_AND_DEPTHS).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); else if (irr_driver->getSSAOViz()) - irr_driver->getFBO(FBO_SSAO).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); + irr_driver->getFBO(FBO_HALF1_R).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); else if (irr_driver->getRSM()) { glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -600,7 +600,7 @@ void IrrDriver::renderSolidSecondPass() GroupedSM::reset(); setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST); setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST); - setTexture(2, m_rtts->getRenderTarget(RTT_SSAO), GL_NEAREST, GL_NEAREST); + setTexture(2, m_rtts->getRenderTarget(RTT_HALF1_R), GL_LINEAR, GL_LINEAR); { @@ -1045,7 +1045,9 @@ void IrrDriver::renderSSAO() glClear(GL_COLOR_BUFFER_BIT); m_post_processing->renderSSAO(); // Blur it to reduce noise. - m_post_processing->renderGaussian17TapBlur(irr_driver->getFBO(FBO_SSAO), irr_driver->getFBO(FBO_TMP4)); + FrameBuffer::Blit(m_rtts->getFBO(FBO_SSAO), m_rtts->getFBO(FBO_HALF1_R), GL_COLOR_BUFFER_BIT, GL_LINEAR); + m_post_processing->renderGaussian17TapBlur(irr_driver->getFBO(FBO_HALF1_R), irr_driver->getFBO(FBO_HALF2_R)); + } static void getXYZ(GLenum face, float i, float j, float &x, float &y, float &z) diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 913e525e6..384e1a617 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -123,10 +123,12 @@ RTT::RTT(size_t width, size_t height) RenderTargetTextures[RTT_HALF1] = generateRTT(half, GL_RGBA16F, GL_BGRA, GL_FLOAT); RenderTargetTextures[RTT_QUARTER1] = generateRTT(quarter, GL_RGBA16F, GL_BGRA, GL_FLOAT); RenderTargetTextures[RTT_EIGHTH1] = generateRTT(eighth, GL_RGBA16F, GL_BGRA, GL_FLOAT); + RenderTargetTextures[RTT_HALF1_R] = generateRTT(half, GL_R16F, GL_RED, GL_FLOAT); RenderTargetTextures[RTT_HALF2] = generateRTT(half, GL_RGBA16F, GL_BGRA, GL_FLOAT); RenderTargetTextures[RTT_QUARTER2] = generateRTT(quarter, GL_RGBA16F, GL_BGRA, GL_FLOAT); RenderTargetTextures[RTT_EIGHTH2] = generateRTT(eighth, GL_RGBA16F, GL_BGRA, GL_FLOAT); + RenderTargetTextures[RTT_HALF2_R] = generateRTT(half, GL_R16F, GL_RED, GL_FLOAT); RenderTargetTextures[RTT_BLOOM_1024] = generateRTT(shadowsize0, GL_RGBA16F, GL_BGR, GL_FLOAT); RenderTargetTextures[RTT_BLOOM_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT); @@ -177,9 +179,15 @@ RTT::RTT(size_t width, size_t height) somevector.push_back(RenderTargetTextures[RTT_HALF1]); FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); somevector.clear(); + somevector.push_back(RenderTargetTextures[RTT_HALF1_R]); + FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); + somevector.clear(); somevector.push_back(RenderTargetTextures[RTT_HALF2]); FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); somevector.clear(); + somevector.push_back(RenderTargetTextures[RTT_HALF2_R]); + FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); + somevector.clear(); somevector.push_back(RenderTargetTextures[RTT_QUARTER1]); FrameBuffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height)); somevector.clear(); From 559d4f3b9f45069d43788c5dc5529b98d98f7fc3 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 7 Jun 2014 01:49:23 +0200 Subject: [PATCH 14/64] Remove GI param test when reseting Ambient. --- src/graphics/render.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 93ef66515..162d34625 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -1020,7 +1020,7 @@ void IrrDriver::renderLights(unsigned pointlightcount) } m_rtts->getFBO(FBO_COMBINED_TMP1_TMP2).Bind(); - if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && SkyboxCubeMap && UserConfigParams::m_gi) + if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && SkyboxCubeMap) irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0)); // Render sunlight if and only if track supports shadow From b27b68f768d222db9c329ab79de7ea1780031e99 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 7 Jun 2014 02:04:15 +0200 Subject: [PATCH 15/64] Fix attempt for linux Actually remove the code block if not on windows. --- src/graphics/post_processing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 87653506e..5f87e76cf 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -417,7 +417,7 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a } else { -#if !defined(__linux__) || defined(GL_VERSION_4_3) +#if WIN32 glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program); glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); @@ -447,7 +447,7 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a } else { -#if !defined(__linux__) || defined(GL_VERSION_4_3) +#if WIN32 glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program); glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); From ed98c4c8ff3a173a74ec22acd5b124821c51316c Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 7 Jun 2014 02:16:00 +0200 Subject: [PATCH 16/64] Fix linux with 4.3+ context. --- src/graphics/post_processing.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 5f87e76cf..1f8d52e8e 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -400,7 +400,9 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight()); float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight(); { +#if WIN32 if (irr_driver->getGLSLVersion() < 430) +#endif { auxiliary.Bind(); glUseProgram(FullScreenShader::Gaussian17TapHShader::Program); @@ -415,22 +417,23 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a glDrawArrays(GL_TRIANGLES, 0, 3); } +#if WIN32 else { -#if WIN32 + glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program); glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0); glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 1); glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1); -#else - assert(false); -#endif } +#endif } { +#if WIN32 if (irr_driver->getGLSLVersion() < 430) +#endif { in_fbo.Bind(); glUseProgram(FullScreenShader::Gaussian17TapVShader::Program); @@ -445,19 +448,17 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a glDrawArrays(GL_TRIANGLES, 0, 3); } +#if WIN32 else { -#if WIN32 glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program); glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(1, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F); glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0); glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 1); glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1); -#else - assert(false); -#endif } +#endif } } From 94900fe2c834ea1af0446455a472c088f73de3c3 Mon Sep 17 00:00:00 2001 From: vlj Date: Sun, 8 Jun 2014 00:20:44 +0200 Subject: [PATCH 17/64] Add a performance counter for GUI --- src/graphics/irr_driver.hpp | 1 + src/graphics/render.cpp | 11 +++++++---- src/utils/profiler.cpp | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index ff8c0f970..88c9c9c5b 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -125,6 +125,7 @@ enum QueryPerf Q_BLOOM, Q_TONEMAP, Q_MOTIONBLUR, + Q_GUI, Q_LAST }; diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 162d34625..95cb4cac8 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -235,10 +235,13 @@ void IrrDriver::renderGLSL(float dt) PROFILER_POP_CPU_MARKER(); } // for i Date: Sun, 8 Jun 2014 00:25:34 +0200 Subject: [PATCH 18/64] Add a performance counter for MLAA --- src/graphics/irr_driver.hpp | 1 + src/graphics/post_processing.cpp | 1 + src/utils/profiler.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index 88c9c9c5b..ac2e0bc21 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -125,6 +125,7 @@ enum QueryPerf Q_BLOOM, Q_TONEMAP, Q_MOTIONBLUR, + Q_MLAA, Q_GUI, Q_LAST }; diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 1f8d52e8e..45ff6fb26 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -862,6 +862,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode) if (UserConfigParams::m_mlaa) // MLAA. Must be the last pp filter. { PROFILER_PUSH_CPU_MARKER("- MLAA", 0xFF, 0x00, 0x00); + ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MLAA)); glEnable(GL_FRAMEBUFFER_SRGB); irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); renderPassThrough(in_fbo->getRTT()[0]); diff --git a/src/utils/profiler.cpp b/src/utils/profiler.cpp index 7320ea8d8..af2010f2e 100644 --- a/src/utils/profiler.cpp +++ b/src/utils/profiler.cpp @@ -408,6 +408,7 @@ void Profiler::draw() "Bloom", "Tonemap", "Motion Blur", + "MLAA", "GUI", }; std::ostringstream oss; From 61d6caa52103e804a9334457d38abed18b2c7001 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Sat, 7 Jun 2014 19:51:34 -0400 Subject: [PATCH 19/64] Work on feature unlocked scene --- src/states_screens/race_result_gui.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 35afce0a5..d5ee36159 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -273,18 +273,27 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget, } else { + StateManager::get()->popMenu(); + World::deleteWorld(); + + 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 parts; - parts.push_back("featunlocked"); - ((CutsceneWorld*)World::getWorld())->setParts(parts); scene->addTrophy(race_manager->getDifficulty()); scene->findWhatWasUnlocked(race_manager->getDifficulty()); - StateManager::get()->popMenu(); - World::deleteWorld(); StateManager::get()->pushScreen(scene); race_manager->setAIKartOverride(""); + + std::vector parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); } return; } @@ -368,7 +377,7 @@ 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(); + KartSelectionScreen::getRunningInstance()->tearDown(); StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); if (race_manager->raceWasStartedFromOverworld()) From 59ad95b93f5da7957e1ad07fd316be3902059b39 Mon Sep 17 00:00:00 2001 From: vlj Date: Sun, 8 Jun 2014 02:26:40 +0200 Subject: [PATCH 20/64] Fix ribbon not using ambient. --- src/graphics/shaders.cpp | 5 ++++- src/graphics/shaders.hpp | 4 ++-- src/graphics/stkmesh.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 285e1c264..f33f11c49 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -1201,6 +1201,7 @@ namespace MeshShader GLuint SphereMapShader::attrib_normal; GLuint SphereMapShader::uniform_MM; GLuint SphereMapShader::uniform_IMM; + GLuint SphereMapShader::uniform_ambient; GLuint SphereMapShader::TU_tex; void SphereMapShader::init() @@ -1214,6 +1215,7 @@ namespace MeshShader attrib_normal = glGetAttribLocation(Program, "Normal"); uniform_MM = glGetUniformLocation(Program, "ModelMatrix"); uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix"); + uniform_ambient = glGetUniformLocation(Program, "ambient"); GLuint uniform_tex = glGetUniformLocation(Program, "tex"); GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo"); GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap"); @@ -1234,12 +1236,13 @@ namespace MeshShader glUseProgram(0); } - void SphereMapShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix) + void SphereMapShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const SColorf &ambient) { if (UserConfigParams::m_ubo_disabled) bypassUBO(Program); glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer()); glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer()); + glUniform3f(uniform_ambient, ambient.r, ambient.g, ambient.b); } GLuint SplattingShader::Program; diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index 1c7548174..551275678 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -250,11 +250,11 @@ class SphereMapShader public: static GLuint Program; static GLuint attrib_position, attrib_normal; - static GLuint uniform_MM, uniform_IMM; + static GLuint uniform_MM, uniform_IMM, uniform_ambient; static GLuint TU_tex; static void init(); - static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix); + static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const video::SColorf &ambient); }; class SplattingShader diff --git a/src/graphics/stkmesh.cpp b/src/graphics/stkmesh.cpp index f99786ad1..ed85b16e8 100644 --- a/src/graphics/stkmesh.cpp +++ b/src/graphics/stkmesh.cpp @@ -249,7 +249,7 @@ void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelMatrix, const c } setTexture(MeshShader::SphereMapShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true); - MeshShader::SphereMapShader::setUniforms(ModelMatrix, InverseModelMatrix); + MeshShader::SphereMapShader::setUniforms(ModelMatrix, InverseModelMatrix, irr_driver->getSceneManager()->getAmbientLight()); assert(mesh.vao_second_pass); glBindVertexArray(mesh.vao_second_pass); glDrawElements(ptype, count, itype, 0); From f4ca8f1f396b34b05504841321bb95b00e276b9d Mon Sep 17 00:00:00 2001 From: vlj Date: Sun, 8 Jun 2014 02:32:56 +0200 Subject: [PATCH 21/64] Fix low brightness without mlaa. --- src/graphics/render.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 95cb4cac8..fe021a16d 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -187,9 +187,6 @@ void IrrDriver::renderGLSL(float dt) { FrameBuffer *fbo = m_post_processing->render(camnode); - if (!UserConfigParams::m_mlaa) // MLAA_COLORS already in srgb space - glEnable(GL_FRAMEBUFFER_SRGB); - if (irr_driver->getNormals()) irr_driver->getFBO(FBO_NORMAL_AND_DEPTHS).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); else if (irr_driver->getSSAOViz()) @@ -201,10 +198,18 @@ void IrrDriver::renderGLSL(float dt) m_post_processing->renderPassThrough(m_rtts->getRSM().getRTT()[0]); } else - fbo->BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); + { + if (UserConfigParams::m_mlaa) // MLAA_COLORS already in srgb space + fbo->BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); + else + { + glEnable(GL_FRAMEBUFFER_SRGB); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + m_post_processing->renderPassThrough(fbo->getRTT()[0]); + glDisable(GL_FRAMEBUFFER_SRGB); + } + } - if (!UserConfigParams::m_mlaa) - glDisable(GL_FRAMEBUFFER_SRGB); } else glDisable(GL_FRAMEBUFFER_SRGB); From 877bf938bd416d703e775dc7752c183c3336c660 Mon Sep 17 00:00:00 2001 From: vlj Date: Sun, 8 Jun 2014 02:50:02 +0200 Subject: [PATCH 22/64] Fix different color with/without mlaa. --- src/graphics/post_processing.cpp | 11 ++++++----- src/graphics/render.cpp | 13 +------------ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 45ff6fb26..108e07b78 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -859,16 +859,17 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode) PROFILER_POP_CPU_MARKER(); } + glEnable(GL_FRAMEBUFFER_SRGB); + irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); + renderPassThrough(in_fbo->getRTT()[0]); + glDisable(GL_FRAMEBUFFER_SRGB); + out_fbo = &irr_driver->getFBO(FBO_MLAA_COLORS); + if (UserConfigParams::m_mlaa) // MLAA. Must be the last pp filter. { PROFILER_PUSH_CPU_MARKER("- MLAA", 0xFF, 0x00, 0x00); ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MLAA)); - glEnable(GL_FRAMEBUFFER_SRGB); - irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); - renderPassThrough(in_fbo->getRTT()[0]); - glDisable(GL_FRAMEBUFFER_SRGB); applyMLAA(); - out_fbo = &irr_driver->getFBO(FBO_MLAA_COLORS); PROFILER_POP_CPU_MARKER(); } diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index fe021a16d..b7647a38c 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -198,18 +198,7 @@ void IrrDriver::renderGLSL(float dt) m_post_processing->renderPassThrough(m_rtts->getRSM().getRTT()[0]); } else - { - if (UserConfigParams::m_mlaa) // MLAA_COLORS already in srgb space - fbo->BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); - else - { - glEnable(GL_FRAMEBUFFER_SRGB); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - m_post_processing->renderPassThrough(fbo->getRTT()[0]); - glDisable(GL_FRAMEBUFFER_SRGB); - } - } - + fbo->BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y); } else glDisable(GL_FRAMEBUFFER_SRGB); From 9bc89e0f4026a69202623d3b7654ac60a5e8ddb5 Mon Sep 17 00:00:00 2001 From: vlj Date: Sun, 8 Jun 2014 03:06:20 +0200 Subject: [PATCH 23/64] Lower MLAA threshold. --- data/shaders/mlaa_color1.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/shaders/mlaa_color1.frag b/data/shaders/mlaa_color1.frag index 81d4642b5..17a8c6276 100644 --- a/data/shaders/mlaa_color1.frag +++ b/data/shaders/mlaa_color1.frag @@ -3,7 +3,7 @@ uniform sampler2D colorMapG; in vec4 offset[2]; in vec2 uv; -const float threshold = 0.1; +const float threshold = 0.006; out vec4 FragColor; From e959d6c857cd63e2f48eaf687d3905685f0c82e3 Mon Sep 17 00:00:00 2001 From: vlj Date: Sun, 8 Jun 2014 03:28:24 +0200 Subject: [PATCH 24/64] MLAA: Use srgb for auxiliary buffer. --- data/shaders/mlaa_color1.frag | 2 +- src/graphics/irr_driver.hpp | 4 ++++ src/graphics/post_processing.cpp | 15 +++++++-------- src/graphics/rtts.cpp | 8 ++++++++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/data/shaders/mlaa_color1.frag b/data/shaders/mlaa_color1.frag index 17a8c6276..81d4642b5 100644 --- a/data/shaders/mlaa_color1.frag +++ b/data/shaders/mlaa_color1.frag @@ -3,7 +3,7 @@ uniform sampler2D colorMapG; in vec4 offset[2]; in vec2 uv; -const float threshold = 0.006; +const float threshold = 0.1; out vec4 FragColor; diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index ac2e0bc21..bfffa6c3c 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -83,6 +83,8 @@ enum TypeFBO FBO_COLORS, FBO_LOG_LUMINANCE, FBO_MLAA_COLORS, + FBO_MLAA_BLEND, + FBO_MLAA_TMP, FBO_TMP1_WITH_DS, FBO_TMP2_WITH_DS, FBO_TMP4, @@ -171,6 +173,8 @@ enum TypeRTT RTT_DISPLACE, RTT_MLAA_COLORS, + RTT_MLAA_BLEND, + RTT_MLAA_TMP, RTT_BLOOM_1024, RTT_BLOOM_512, diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 108e07b78..fd4fc0eed 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -648,7 +648,7 @@ void PostProcessing::applyMLAA() { const core::vector2df &PIXEL_SIZE = core::vector2df(1.0f / UserConfigParams::m_width, 1.0f / UserConfigParams::m_height); IVideoDriver *const drv = irr_driver->getVideoDriver(); - irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind(); + irr_driver->getFBO(FBO_MLAA_TMP).Bind(); glEnable(GL_STENCIL_TEST); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); @@ -667,11 +667,11 @@ void PostProcessing::applyMLAA() glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // Pass 2: blend weights - irr_driver->getFBO(FBO_TMP2_WITH_DS).Bind(); + irr_driver->getFBO(FBO_MLAA_BLEND).Bind(); glClear(GL_COLOR_BUFFER_BIT); glUseProgram(FullScreenShader::MLAABlendWeightSHader::Program); - setTexture(0, irr_driver->getRenderTargetTexture(RTT_TMP1), GL_LINEAR, GL_LINEAR); + setTexture(0, irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), GL_LINEAR, GL_LINEAR); setTexture(1, getTextureGLuint(m_areamap), GL_NEAREST, GL_NEAREST); FullScreenShader::MLAABlendWeightSHader::setUniforms(PIXEL_SIZE, 0, 1); @@ -679,14 +679,14 @@ void PostProcessing::applyMLAA() glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // Blit in to tmp1 - FrameBuffer::Blit(irr_driver->getFBO(FBO_MLAA_COLORS), irr_driver->getFBO(FBO_TMP1_WITH_DS)); + FrameBuffer::Blit(irr_driver->getFBO(FBO_MLAA_COLORS), irr_driver->getFBO(FBO_MLAA_TMP)); // Pass 3: gather irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); glUseProgram(FullScreenShader::MLAAGatherSHader::Program); - setTexture(0, irr_driver->getRenderTargetTexture(RTT_TMP1), GL_NEAREST, GL_NEAREST); - setTexture(1, irr_driver->getRenderTargetTexture(RTT_TMP2), GL_NEAREST, GL_NEAREST); + setTexture(0, irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), GL_NEAREST, GL_NEAREST); + setTexture(1, irr_driver->getRenderTargetTexture(RTT_MLAA_BLEND), GL_NEAREST, GL_NEAREST); FullScreenShader::MLAAGatherSHader::setUniforms(PIXEL_SIZE, 0, 1); glBindVertexArray(FullScreenShader::MLAAGatherSHader::vao); @@ -694,7 +694,6 @@ void PostProcessing::applyMLAA() // Done. glDisable(GL_STENCIL_TEST); - } // ---------------------------------------------------------------------------- @@ -862,7 +861,6 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode) glEnable(GL_FRAMEBUFFER_SRGB); irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); renderPassThrough(in_fbo->getRTT()[0]); - glDisable(GL_FRAMEBUFFER_SRGB); out_fbo = &irr_driver->getFBO(FBO_MLAA_COLORS); if (UserConfigParams::m_mlaa) // MLAA. Must be the last pp filter. @@ -872,6 +870,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode) applyMLAA(); PROFILER_POP_CPU_MARKER(); } + glDisable(GL_FRAMEBUFFER_SRGB); return out_fbo; } // render diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 384e1a617..4eaa8b659 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -117,6 +117,8 @@ RTT::RTT(size_t width, size_t height) RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT); RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT); RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB8_ALPHA8, GL_BGR, GL_UNSIGNED_BYTE); + RenderTargetTextures[RTT_MLAA_TMP] = generateRTT(res, GL_SRGB8_ALPHA8, GL_BGR, GL_UNSIGNED_BYTE); + RenderTargetTextures[RTT_MLAA_BLEND] = generateRTT(res, GL_SRGB8_ALPHA8, GL_BGR, GL_UNSIGNED_BYTE); RenderTargetTextures[RTT_SSAO] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT); RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT); @@ -164,6 +166,12 @@ RTT::RTT(size_t width, size_t height) somevector.push_back(RenderTargetTextures[RTT_MLAA_COLORS]); FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); somevector.clear(); + somevector.push_back(RenderTargetTextures[RTT_MLAA_BLEND]); + FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(RenderTargetTextures[RTT_MLAA_TMP]); + FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); somevector.push_back(RenderTargetTextures[RTT_TMP1]); FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); somevector.clear(); From 02b0cfd069fd62571e5a2725047132cb531082c2 Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 9 Jun 2014 22:38:19 +1000 Subject: [PATCH 25/64] Use big digit font to display the kart rank inside of the speedometer. --- src/guiengine/engine.cpp | 17 ++++---- src/guiengine/scalable_font.cpp | 9 ++-- src/guiengine/scalable_font.hpp | 2 +- src/states_screens/race_gui.cpp | 75 +++++++++++++++------------------ 4 files changed, 46 insertions(+), 57 deletions(-) diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index 63ec09d8e..5c12232c1 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -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,12 @@ 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 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 +1096,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; diff --git a/src/guiengine/scalable_font.cpp b/src/guiengine/scalable_font.cpp index 8f4701847..f31a933fe 100644 --- a/src/guiengine/scalable_font.cpp +++ b/src/guiengine/scalable_font.cpp @@ -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(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y), core::position2d(dest.UpperLeftCorner.X, dest.LowerRightCorner.Y), diff --git a/src/guiengine/scalable_font.hpp b/src/guiengine/scalable_font.hpp index 431dad384..7cf893c46 100644 --- a/src/guiengine/scalable_font.hpp +++ b/src/guiengine/scalable_font.hpp @@ -72,7 +72,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 diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index 5486589d4..ceb5d313c 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -219,6 +219,8 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt) } // renderPlayerView //----------------------------------------------------------------------------- +/** Shows the current soccer result. + */ void RaceGUI::drawScores() { SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld(); @@ -271,7 +273,8 @@ void RaceGUI::drawScores() numLeader++; offsetX += position.LowerRightCorner.X; } -} +} // drawScores + //----------------------------------------------------------------------------- /** Displays the racing time on the screen.s */ @@ -388,10 +391,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(); @@ -581,10 +584,8 @@ 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 //----------------------------------------------------------------------------- @@ -593,10 +594,10 @@ void RaceGUI::drawSpeedAndEnergy(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), @@ -699,30 +700,35 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart, index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN); - // Draw Speed in Numbers + // Draw rank + WorldWithRank *world = dynamic_cast(World::getWorld()); - 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); + if (world && world->displayRank()) + { + 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; + gui::ScalableFont* font; - if (pos.getWidth() > 55) - font = GUIEngine::getLargeFont(); - else if (pos.getWidth() > 40) - font = GUIEngine::getFont(); - else - font = GUIEngine::getSmallFont(); + font = GUIEngine::getHighresDigitFont(); + font->setScale(min_ratio * 0.7f); + font->setShadow(video::SColor(255, 128, 0, 0)); + static video::SColor color = video::SColor(255, 255, 255, 255); + std::ostringstream oss; + oss << kart->getPosition(); // the current font has no . :( << "."; - static video::SColor color = video::SColor(255, 255, 255, 255); - std::ostringstream oss; - oss << (int)(speed*10); + pos.LowerRightCorner = core::vector2di(offset.X+int(0.6f*meter_width), + offset.Y-0.5f*meter_height); + pos.UpperLeftCorner = core::vector2di(offset.X+int(0.6f*meter_width), + offset.Y-0.5f*meter_height); - font->draw(oss.str().c_str(), pos, color); + font->draw(oss.str().c_str(), pos, color, true, true); + } -} +} // drawSpeedAndEnergy //----------------------------------------------------------------------------- /** Displays the rank and the lap of the kart. @@ -755,21 +761,6 @@ void RaceGUI::drawRankLap(const AbstractKart* kart, static video::SColor color = video::SColor(255, 255, 255, 255); WorldWithRank *world = (WorldWithRank*)(World::getWorld()); - if (world->displayRank()) - { - const int rank = kart->getPosition(); - - 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()) From 77400211ca3c06be4d9b7828b4a26d8633dd4062 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 10 Jun 2014 09:19:02 +1000 Subject: [PATCH 26/64] Added some tests to avoid NAN values (which I have seen once). --- src/items/flyable.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/items/flyable.cpp b/src/items/flyable.cpp index 4f043a7cd..e7b5d3ea1 100644 --- a/src/items/flyable.cpp +++ b/src/items/flyable.cpp @@ -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()); From e55d976aa272fdeeecbf3457c188bcb90d658bc9 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 10 Jun 2014 16:58:43 +1000 Subject: [PATCH 27/64] Added simple animation when the player rank changes. --- src/modes/world_with_rank.hpp | 2 +- src/states_screens/race_gui.cpp | 95 +++++++++++++++++++++++++++------ src/states_screens/race_gui.hpp | 13 ++++- 3 files changed, 91 insertions(+), 19 deletions(-) diff --git a/src/modes/world_with_rank.hpp b/src/modes/world_with_rank.hpp index 100802d7c..d51bf9352 100644 --- a/src/modes/world_with_rank.hpp +++ b/src/modes/world_with_rank.hpp @@ -77,6 +77,6 @@ public: - }; // WorldWithRank +}; // WorldWithRank #endif diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index ceb5d313c..681e8e649 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -123,6 +123,13 @@ RaceGUI::RaceGUI() 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 +137,19 @@ RaceGUI::~RaceGUI() { } // ~Racegui +//----------------------------------------------------------------------------- +/** Reset the gui before a race. It initialised all rank animation related + * values back to the default. + */ +void RaceGUI::reset() +{ + for(unsigned int i=0; igetNumberOfKarts(); 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,7 +221,7 @@ 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 @@ -407,14 +427,13 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart, // Background - draw2DImage(m_gauge_empty, - core::rect((int)offset.X, - (int) offset.Y-gauge_height, - (int) offset.X + gauge_width, - (int)offset.Y) /* dest rect */, - core::rect(0, 0, 256, 256) /* source rect */, - NULL /* clip rect */, NULL /* colors */, - true /* alpha */); + draw2DImage(m_gauge_empty, core::rect((int)offset.X, + (int)offset.Y-gauge_height, + (int)offset.X + gauge_width, + (int)offset.Y) /* dest rect */, + core::rect(0, 0, 256, 256) /* source rect */, + NULL /* clip rect */, NULL /* colors */, + true /* alpha */); // Target @@ -605,8 +624,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; @@ -711,19 +728,63 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart, pos.LowerRightCorner.X = (int)(offset.X + 0.8f*meter_width); pos.LowerRightCorner.Y = (int)(offset.X - 0.5f*meter_height); - gui::ScalableFont* font; + gui::ScalableFont* font = GUIEngine::getHighresDigitFont(); - font = GUIEngine::getHighresDigitFont(); - font->setScale(min_ratio * 0.7f); + 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.8f; + 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<0) + { + 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 = 0.0f; + } + } + else if(m_animation_states[id] == AS_BIGGER) + { + scale = (world->getTime() - m_rank_animation_start_times[id]) + / DURATION; + 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(); + } + + font->setScale(min_ratio * scale * 0.7f); font->setShadow(video::SColor(255, 128, 0, 0)); static video::SColor color = video::SColor(255, 255, 255, 255); std::ostringstream oss; - oss << kart->getPosition(); // the current font has no . :( << "."; + oss << rank; // the current font has no . :( << "."; pos.LowerRightCorner = core::vector2di(offset.X+int(0.6f*meter_width), - offset.Y-0.5f*meter_height); + int(offset.Y-0.5f*meter_height)); pos.UpperLeftCorner = core::vector2di(offset.X+int(0.6f*meter_width), - offset.Y-0.5f*meter_height); + int(offset.Y-0.5f*meter_height)); font->draw(oss.str().c_str(), pos, color, true, true); } diff --git a/src/states_screens/race_gui.hpp b/src/states_screens/race_gui.hpp index 2a76ed23a..9e4f08c95 100644 --- a/src/states_screens/race_gui.hpp +++ b/src/states_screens/race_gui.hpp @@ -88,8 +88,18 @@ private: /** Maximum string length for the timer */ int m_timer_width; + /** Animation state: none, getting smaller (old value), + * getting bigger (new number). */ + enum AnimationState {AS_NONE, AS_SMALLER, AS_BIGGER}; + std::vector m_animation_states; - bool m_is_tutorial; + /** When the animation state was changed. */ + std::vector m_rank_animation_start_times; + + /** Stores the previous rank for each kart. Used for the rank animation. */ + std::vector m_last_ranks; + + bool m_is_tutorial; /* Display informat for one player on the screen. */ void drawEnergyMeter (int x, int y, const AbstractKart *kart, @@ -111,6 +121,7 @@ public: RaceGUI(); ~RaceGUI(); + virtual void reset(); virtual void renderGlobal(float dt); virtual void renderPlayerView(const Camera *camera, float dt); From a5c7b295be2f5b6fc848d6321381fe0b74e5104b Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 11 Jun 2014 08:18:35 +1000 Subject: [PATCH 28/64] Don't add the index offset for Asian fonts if no pot files are given. --- tools/font_tool/CFontTool.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/font_tool/CFontTool.cpp b/tools/font_tool/CFontTool.cpp index 587827d84..d616f8855 100644 --- a/tools/font_tool/CFontTool.cpp +++ b/tools/font_tool/CFontTool.cpp @@ -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){ @@ -762,7 +767,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 Date: Tue, 10 Jun 2014 18:59:36 -0400 Subject: [PATCH 29/64] Add support to load new style glossmap (more work remains to do before this is complete) --- src/graphics/material.cpp | 2 +- src/graphics/material.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graphics/material.cpp b/src/graphics/material.cpp index ad2be7b1a..821654cb1 100644 --- a/src/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -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 ); diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index ab1ec0a17..7de754e6e 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -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); From 89d8a19dabfd1fb9b1322ffe704e8c11d8a33377 Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 11 Jun 2014 09:11:07 +1000 Subject: [PATCH 30/64] Fixed shader compilation errors. --- data/shaders/fog.frag | 1 + data/shaders/sunlight.frag | 1 + 2 files changed, 2 insertions(+) diff --git a/data/shaders/fog.frag b/data/shaders/fog.frag index 75101c7a1..fc6380e65 100644 --- a/data/shaders/fog.frag +++ b/data/shaders/fog.frag @@ -12,6 +12,7 @@ uniform mat4 ViewMatrix; uniform mat4 ProjectionMatrix; uniform mat4 InverseViewMatrix; uniform mat4 InverseProjectionMatrix; +uniform vec2 screen; #else layout (std140) uniform MatrixesData { diff --git a/data/shaders/sunlight.frag b/data/shaders/sunlight.frag index df21bd238..5ec6061e7 100644 --- a/data/shaders/sunlight.frag +++ b/data/shaders/sunlight.frag @@ -13,6 +13,7 @@ uniform mat4 ViewMatrix; uniform mat4 ProjectionMatrix; uniform mat4 InverseViewMatrix; uniform mat4 InverseProjectionMatrix; +uniform vec2 screen; #else layout (std140) uniform MatrixesData { From 8a4b4ae213c6b36e2b0789395ed3c2c0773de713 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Tue, 10 Jun 2014 19:59:30 -0400 Subject: [PATCH 31/64] Update cutscene shortcuts --- src/config/player_profile.hpp | 2 ++ src/states_screens/main_menu_screen.cpp | 31 ++++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/config/player_profile.hpp b/src/config/player_profile.hpp index a4c5ab3c7..cb68dd81a 100644 --- a/src/config/player_profile.hpp +++ b/src/config/player_profile.hpp @@ -248,6 +248,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 { diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index 956b902a3..93c672d08 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -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(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 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 From 9ae8446faeb418fb40a33f820566310ec7401d50 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 12 Jun 2014 08:11:51 +1000 Subject: [PATCH 32/64] Added -c CHARLIST option which will only export the characters specified in the character list. Fixed auto-selection of export used characters only. --- tools/font_tool/CFontTool.cpp | 11 +++++++++++ tools/font_tool/CFontTool.h | 1 + tools/font_tool/main.cpp | 34 +++++++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/tools/font_tool/CFontTool.cpp b/tools/font_tool/CFontTool.cpp index d616f8855..a13a962b3 100644 --- a/tools/font_tool/CFontTool.cpp +++ b/tools/font_tool/CFontTool.cpp @@ -62,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; iaddCheckBox(false, core::rect(xp,yp,xp+150,yp+h),win, 201, L"Export used characters only")->setEnabled(false); + env->addCheckBox(false, core::rect(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(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(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(device->getGUIEnvironment() + ->getRootGUIElement() + ->getElementFromId(201, true)); + box->setChecked(true); + } + } + } // for i run()) { From 1dc63849c9eda5faf0c4ef62286b381e497a3cb6 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 12 Jun 2014 09:27:45 +1000 Subject: [PATCH 33/64] Use a sigmar as big digit font and display time and lap using this font (temporarily till we agree on a font). --- data/fonts/BigDigitFont.xml | Bin 1696 -> 1330 bytes data/fonts/sigmar0.png | Bin 0 -> 2922 bytes src/guiengine/engine.cpp | 1 + src/states_screens/race_gui.cpp | 106 ++++++++++++-------------------- src/states_screens/race_gui.hpp | 21 +++---- 5 files changed, 50 insertions(+), 78 deletions(-) mode change 100644 => 100755 data/fonts/BigDigitFont.xml create mode 100755 data/fonts/sigmar0.png diff --git a/data/fonts/BigDigitFont.xml b/data/fonts/BigDigitFont.xml old mode 100644 new mode 100755 index 41536824d498e77ce15cc7648d01d6e17a4e1161..8ae41eeeb1df8a4e0f9d6349a650a6cedfc7411b GIT binary patch literal 1330 zcmbu9-A=+l5QWdJCcXpV+5p?qmYNFj9ee>q)Fuj~v<6>ZJ-f3Tr(`c0ynyb{%(rJx zXZrJ9VTBVu@Qx8au|tIfNY-QLXSz%Ff~}Q)bqv*=_t>TPAk_G)QAhGs+wcdbYjDBke0} z&kR*KY<#h*l29?$1cpe02@7rxi3JNR1H7t@Z zU=&rr6c9*7wPc)V+yG()v11gRLO3H0r*K2K5>*IP zdCEqVw4_AQ3=Gex1dUnmYRcitrk=5sazz8cYuUge66jKkf$(_b-_|dXj*Vl zioAiTh*~hyndctvXQxnTU7vP3>-9P!j*qZwkzRMan)Q$7mZehMQ1*t9>-p^E$d~6v zK&vIqGRAYDo0QhJ`7V@g@}wqdLECZEh0?c6`82j^7Y%%4g#W-Bt_be8JM3h?Q~u2m z{uhI}6i+nOSO?dVEsYk^2bhYwkt{DX983=(?skW5e2n0Y{TG7B%vvImMrlgl2r>Y; z79uYxCX}_1Zf=27oD}E>S8s}12;+cGLatz(DhjpXsW#g=uc@TKDh!~}J1Z$Fc&KRG zy2i!A+F$8U51}_2b*=s*_)ao{4qDpWLN+buxd+bNG0=@GK|D9Y57c(?mupg%;M!un ztEhaT+tDNSYf78VraXqr5<4sfN9Q2GR5*`PNS!~VDigE$LZpTj zEAeB52R$**W=S$}pr4o7VbE^dPnQh}x~b_nTrypeI>dk9oh5XmjkOGZWj5om8@e!@ zRLH&hB3-cj6U!OOs(BtlLDZzI3o;J1G&Jm-2k$Ue3aN`A$6>#PQy<`?Kg7rIBm_Xl z6TJ|S7{s_>iC&Cvj<8`o5<8@KgewjiVw64P$Ri_Mw@BRY{s%dBh?6qHRVSr)f?9To z`VKj> z4GY!M?UQQk4lBXKw_*#4`zXSkTe`zp#I~{`dGU(Yw+}@6;o^&;#|!oZE4TR8fEC08 z{3*Dr?@srZ77~ThwVPC?v#Mn6>!5f_k;M_U@&~w&q>CD)ob|t1G;Im$T3@J(_kE9u(maW z)y6|Kj*0sY9=dYw@sc$a;b#1a)7Ap)73NCIX;-kkZb6}CIW9b=thJ74jrOTd5|_Ry zI0TQKGCF%(_v0fbiyy1?VQQl(O`Iw*{*i;J;h6eb;~ax{93(jM>7knD8)NgNFHii6 z4O;HB6%0t=S{7iiP~1o1(wtYI<%Y)mxGjA5_vFay&pTuy*O&d-ss%qk?#oHhj&}`R zbLMq8%^_uk!mC*@^nLV++TuBesxh??gV`H(NX2qFm&?KoeF}IC6RE^~-2t;PWG=dw zUeAe=_+`Zu6VSd2fTeKt&&ckdgqWMto4Ru+PCbT_7E5!)KTUSc9STCRkI+tBIk$UoO-%@}um=Y`Zt z7&(S*CM&0zZ!fGQY-Bs3dIL?5Nf;lPI-&Lp7aFE3y9le@SB;$+>v8jIanCX|bJ11r zdJ5v@>mkN&j5oylM=dJt(S-E_Whk}elHQ32%`#v7A2w;Z-KvM~Zov=FAEQZgo`~0H z8M*n`B~84WK$r~9Zo#KyC2vmcGcLN+pC=aNOOg!vvosks8l%rPz#a|BAz9c!{p$~< z*f)H2!EBbvt73+7@1Y!ar~t?7YWNDpLC#bFm4_=;>6U;CS{a_Q^g0AnHdO5_HH>V) zdOqpgjH8*)QEzPNM)_%0oWkn`~y*EQzbiL_1fD1REo@ufH;2B3tfX3Q# zeWBYbQ6QS2h%py|zcg9(0==m+3^#D0kXZ*7MdLBD;RxxclVzB3T`o=1D9c&P+3<_a z7tcXcpri=p^Edn4Aag>w<=G`LW53B zul$a_z&7HL%JP- z!PCdFnq7D7eL3CfFm6?Ljwxqo{18j-x@z&h(J#W$KD+L7p1pYa;IG(5y}nD8%?W4~ z7iWW%6eu)iB4@<$UHm{m$KC=X6O37_$YLE@a6ZDBE`1UeNkgru1a0cdOLQ!VoM#Lh zTyCh2rhAl^uZgj|WqH%_(1ghbcJ$#oC*vkSn^FAH)PWk{VZ&pqQ$DT*j6rUAXq~9s=ZF-X)|oRx6y&PCljUwyY>YaGe&#DKHNYoodTbzfykilKy)&7iP1R%@tUvE{on3%AWSVy}yF)z-+=_i%fs*U^5Bm9h zabjBZ^k>4e&C(6arQg3w9Dnrg9_T(gR?q|Vr*JB%q;@T^Mx*aTdwSH69qXIcUzB#d z@=1;cTKs1zXHBn01~cl>M^;ZLQvb45?}D<#BvBAE6^3wXWZ^)V};@%^J2 z74@y#Oa*K|W=G)|9_jeGR0l#4aJK~m8`LI}DDCSCN`d@)w6|$lC?%HdNXWgPU`pZl z{xy}8M44Oq<~)Fo&cTJb!YCN(rP{we!2cOvKRA&8rrrP0Kaj8bf2C|J>><_H?j`&e D<6oRy literal 0 HcmV?d00001 diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index 5c12232c1..2126d1f19 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -1072,6 +1072,7 @@ namespace GUIEngine file_manager->getAssetChecked(FileManager::FONT, "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; diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index 681e8e649..ec0d2f4b3 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -89,39 +89,19 @@ 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; - - // 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; + m_lap_width = font->getDimension(L"9/9").Width; // Technically we only need getNumLocalPlayers, but using the // global kart id to find the data for a specific kart. @@ -225,15 +205,15 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt) 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 @@ -344,7 +324,9 @@ void RaceGUI::drawGlobalTimer() pos += core::vector2d(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 */); @@ -609,7 +591,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart, //----------------------------------------------------------------------------- -void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart, +void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart, const core::recti &viewport, const core::vector2df &scaling) { @@ -775,31 +757,40 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart, m_last_ranks[id] = kart->getPosition(); } - font->setScale(min_ratio * scale * 0.7f); + font->setScale(min_ratio * scale); font->setShadow(video::SColor(255, 128, 0, 0)); static video::SColor color = video::SColor(255, 255, 255, 255); std::ostringstream oss; oss << rank; // the current font has no . :( << "."; - pos.LowerRightCorner = core::vector2di(offset.X+int(0.6f*meter_width), + pos.LowerRightCorner = core::vector2di(int(offset.X+0.6f*meter_width), int(offset.Y-0.5f*meter_height)); - pos.UpperLeftCorner = core::vector2di(offset.X+int(0.6f*meter_width), + pos.UpperLeftCorner = core::vector2di(int(offset.X+0.6f*meter_width), int(offset.Y-0.5f*meter_height)); font->draw(oss.str().c_str(), pos, color, true, true); + font->setScale(1.0f); } -} // drawSpeedAndEnergy +} // 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; @@ -809,37 +800,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(); + 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); - // 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 diff --git a/src/states_screens/race_gui.hpp b/src/states_screens/race_gui.hpp index 9e4f08c95..638c86593 100644 --- a/src/states_screens/race_gui.hpp +++ b/src/states_screens/race_gui.hpp @@ -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,13 +75,15 @@ 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; + /** Animation state: none, getting smaller (old value), * getting bigger (new number). */ enum AnimationState {AS_NONE, AS_SMALLER, AS_BIGGER}; @@ -105,11 +101,12 @@ private: 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 drawLap (const AbstractKart* kart, const core::recti &viewport, const core::vector2df &scaling); - void drawRankLap (const AbstractKart* kart, - const core::recti &viewport); /** Display items that are shown once only (for all karts). */ void drawGlobalMiniMap (); From 60f707b55d3a0819dadc455ad32b2c0fab91c54b Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 12 Jun 2014 09:33:52 +1000 Subject: [PATCH 34/64] Fixed gcc compiler warning. --- tools/font_tool/CFontTool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/font_tool/CFontTool.cpp b/tools/font_tool/CFontTool.cpp index a13a962b3..b75a84f4f 100644 --- a/tools/font_tool/CFontTool.cpp +++ b/tools/font_tool/CFontTool.cpp @@ -68,7 +68,7 @@ bool setUsedCharacters(const char* characters) { int n = strlen(characters); for(int i=0; i Date: Wed, 11 Jun 2014 19:37:04 -0400 Subject: [PATCH 35/64] Improve code to switch between GUI-cutscenes. Still not fully functional, but better --- src/guiengine/abstract_state_manager.cpp | 5 +- src/modes/cutscene_world.cpp | 69 ++++++++++++++++++++---- src/modes/world.cpp | 5 ++ src/states_screens/grand_prix_lose.cpp | 2 + src/states_screens/grand_prix_win.cpp | 37 ------------- 5 files changed, 68 insertions(+), 50 deletions(-) diff --git a/src/guiengine/abstract_state_manager.cpp b/src/guiengine/abstract_state_manager.cpp index f3fd29fe6..69c4b3cb3 100644 --- a/src/guiengine/abstract_state_manager.cpp +++ b/src/guiengine/abstract_state_manager.cpp @@ -140,7 +140,7 @@ void AbstractStateManager::pushScreen(Screen* screen) void AbstractStateManager::replaceTopMostScreen(Screen* screen) { - assert(m_game_mode != GAME); + //assert(m_game_mode != GAME); // you need to close any dialog before calling this assert(!ModalDialog::isADialogActive()); @@ -156,7 +156,8 @@ 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; switchToScreen(name.c_str()); diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index f59c1937c..ce878bf10 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -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::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::getCurrentScreen()); + // if (cs != NULL) + // cs->onCutsceneEnd(); + //} } // update //----------------------------------------------------------------------------- void CutsceneWorld::enterRaceOverState() { + GUIEngine::CutsceneScreen* cs = dynamic_cast( + GUIEngine::getCurrentScreen()); + if (cs != NULL) + cs->onCutsceneEnd(); + + int partId = -1; for (int i=0; i<(int)m_parts.size(); i++) { @@ -408,9 +415,49 @@ 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); + + if (PlayerManager::getCurrentPlayer() + ->getRecentlyCompletedChallenges().size() > 0) + { + std::vector 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 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 + { + if (race_manager->raceWasStartedFromOverworld()) + { + 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") diff --git a/src/modes/world.cpp b/src/modes/world.cpp index 1b86b76a7..facd390a1 100644 --- a/src/modes/world.cpp +++ b/src/modes/world.cpp @@ -794,6 +794,11 @@ void World::updateWorld(float dt) return; update(dt); + +#ifdef DEBUG + assert(m_magic_number == 0xB01D6543); +#endif + if( (!isFinishPhase()) && isRaceOver()) { enterRaceOverState(); diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index 26e55b51f..80ba7bfe9 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -117,6 +117,8 @@ void GrandPrixLose::onCutsceneEnd() PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); if (unlocked.size() > 0) { + race_manager->exitRace(); + StateManager::get()->enterGameState(); race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE); race_manager->setNumKarts(0); diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index eb5ee8fb2..97a0b835f 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -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 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 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(); - } } // ------------------------------------------------------------------------------------- From 540df391286283c4ae0acdfd3eb65778e171941c Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Wed, 11 Jun 2014 20:50:53 -0400 Subject: [PATCH 36/64] fix crash when using track debug. unfortunately, visual aids are not yet functional --- src/graphics/stkmesh.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graphics/stkmesh.cpp b/src/graphics/stkmesh.cpp index ed85b16e8..245180270 100644 --- a/src/graphics/stkmesh.cpp +++ b/src/graphics/stkmesh.cpp @@ -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); From cfe93f96f27eff38de3b4bc050f362651a48ffa7 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 12 Jun 2014 15:58:40 +1000 Subject: [PATCH 37/64] Speed up the rank animation, and don't make the old value completely disappear (which makes the animation even faster). --- src/states_screens/race_gui.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index ec0d2f4b3..652f97cba 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -723,27 +723,28 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart, } } - float scale = 1.0f; - int rank = kart->getPosition(); - const float DURATION = 0.8f; + 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<0) + if(scalegetTime(); // Store the new rank m_last_ranks[id] = kart->getPosition(); - scale = 0.0f; + scale = MIN_SHRINK; } } else if(m_animation_states[id] == AS_BIGGER) { scale = (world->getTime() - m_rank_animation_start_times[id]) - / DURATION; + / DURATION + MIN_SHRINK; rank = m_last_ranks[id]; if(scale>1.0f) { From d72decfa651af37137538be81e8d78ae01ffc0e8 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 12 Jun 2014 16:54:09 +1000 Subject: [PATCH 38/64] Fixed using the last used track when specifying -N. --- src/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 922be5db5..cac5404f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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); From 025d7fa114452a87b8c518502d62abe20bd85458 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 12 Jun 2014 22:00:00 +1000 Subject: [PATCH 39/64] Tweaked position of font somewhat. Fixed missing rank display when kart is standing still. --- src/states_screens/race_gui.cpp | 158 +++++++++++++++++--------------- src/states_screens/race_gui.hpp | 4 + 2 files changed, 87 insertions(+), 75 deletions(-) diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index 652f97cba..be49e2834 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -590,7 +590,86 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart, } // 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(World::getWorld()); + if (!world || !world->displayRank()) + return; + 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) @@ -621,6 +700,10 @@ void RaceGUI::drawSpeedEnergyRank(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,81 +781,6 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart, irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count, index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN); - - // Draw rank - WorldWithRank *world = dynamic_cast(World::getWorld()); - - if (world && world->displayRank()) - { - 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 = GUIEngine::getHighresDigitFont(); - - 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(scalegetTime(); - // 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(); - } - - font->setScale(min_ratio * scale); - font->setShadow(video::SColor(255, 128, 0, 0)); - static video::SColor color = video::SColor(255, 255, 255, 255); - std::ostringstream oss; - oss << rank; // the current font has no . :( << "."; - - pos.LowerRightCorner = core::vector2di(int(offset.X+0.6f*meter_width), - int(offset.Y-0.5f*meter_height)); - pos.UpperLeftCorner = core::vector2di(int(offset.X+0.6f*meter_width), - int(offset.Y-0.5f*meter_height)); - - font->draw(oss.str().c_str(), pos, color, true, true); - font->setScale(1.0f); - } - } // drawSpeedEnergyRank //----------------------------------------------------------------------------- diff --git a/src/states_screens/race_gui.hpp b/src/states_screens/race_gui.hpp index 638c86593..7c26ea2fe 100644 --- a/src/states_screens/race_gui.hpp +++ b/src/states_screens/race_gui.hpp @@ -107,6 +107,10 @@ private: 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 (); From bc2209284bc9bef1906e315aeff20cb266d3969a Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Thu, 12 Jun 2014 18:25:54 -0400 Subject: [PATCH 40/64] Some fixes with menu-cutscenes --- src/guiengine/abstract_state_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/guiengine/abstract_state_manager.cpp b/src/guiengine/abstract_state_manager.cpp index 69c4b3cb3..90ca4068f 100644 --- a/src/guiengine/abstract_state_manager.cpp +++ b/src/guiengine/abstract_state_manager.cpp @@ -160,6 +160,7 @@ void AbstractStateManager::replaceTopMostScreen(Screen* screen) getCurrentScreen()->tearDown(); m_menu_stack[m_menu_stack.size()-1] = name; + setGameState(MENU); switchToScreen(name.c_str()); // Send init event to new menu From e3a2246e25d33b21ccd327960073b248167b8630 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Thu, 12 Jun 2014 18:43:20 -0400 Subject: [PATCH 41/64] More work on cutscene screens --- src/config/player_profile.hpp | 5 +- src/guiengine/abstract_state_manager.cpp | 4 +- src/guiengine/abstract_state_manager.hpp | 2 +- src/modes/cutscene_world.cpp | 62 ++++++++++++++++++++---- src/states_screens/feature_unlocked.cpp | 2 + src/states_screens/grand_prix_lose.cpp | 42 ---------------- 6 files changed, 62 insertions(+), 55 deletions(-) diff --git a/src/config/player_profile.hpp b/src/config/player_profile.hpp index a294d0a70..6625e211f 100644 --- a/src/config/player_profile.hpp +++ b/src/config/player_profile.hpp @@ -215,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 diff --git a/src/guiengine/abstract_state_manager.cpp b/src/guiengine/abstract_state_manager.cpp index 90ca4068f..3b7989370 100644 --- a/src/guiengine/abstract_state_manager.cpp +++ b/src/guiengine/abstract_state_manager.cpp @@ -138,7 +138,7 @@ void AbstractStateManager::pushScreen(Screen* screen) // ---------------------------------------------------------------------------- -void AbstractStateManager::replaceTopMostScreen(Screen* screen) +void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState) { //assert(m_game_mode != GAME); // you need to close any dialog before calling this @@ -160,7 +160,7 @@ void AbstractStateManager::replaceTopMostScreen(Screen* screen) getCurrentScreen()->tearDown(); m_menu_stack[m_menu_stack.size()-1] = name; - setGameState(MENU); + setGameState(gameState); switchToScreen(name.c_str()); // Send init event to new menu diff --git a/src/guiengine/abstract_state_manager.hpp b/src/guiengine/abstract_state_manager.hpp index e280103ac..b8ace0901 100644 --- a/src/guiengine/abstract_state_manager.hpp +++ b/src/guiengine/abstract_state_manager.hpp @@ -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 diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index ce878bf10..a998896e8 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -419,12 +419,11 @@ void CutsceneWorld::enterRaceOverState() // 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 unlocked = + PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); + if (unlocked.size() > 0) { - std::vector unlocked = - PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); - PlayerManager::getCurrentPlayer()->clearUnlocked(); + //PlayerManager::getCurrentPlayer()->clearUnlocked(); StateManager::get()->enterGameState(); race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE); @@ -443,12 +442,13 @@ void CutsceneWorld::enterRaceOverState() scene->addTrophy(race_manager->getDifficulty()); scene->findWhatWasUnlocked(race_manager->getDifficulty()); - StateManager::get()->replaceTopMostScreen(scene); + StateManager::get()->replaceTopMostScreen(scene, GUIEngine::INGAME_MENU); } else { if (race_manager->raceWasStartedFromOverworld()) { + //StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); OverWorld::enterOverWorld(); } else @@ -462,10 +462,54 @@ void CutsceneWorld::enterRaceOverState() // 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 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 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" || diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index 624e99e0c..ab7c2df9f 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -346,6 +346,8 @@ void FeatureUnlockedCutScene::init() std::cerr << "Malformed unlocked goody!!!\n"; } } + + PlayerManager::getCurrentPlayer()->clearUnlocked(); } // init // ---------------------------------------------------------------------------- diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index 80ba7bfe9..f9bc459fd 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -109,48 +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 unlocked = - PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); - if (unlocked.size() > 0) - { - race_manager->exitRace(); - - 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 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(); - } - } } // ------------------------------------------------------------------------------------- From d36ff8b6db89f1fb339409e9e3f09f5e68c4ea7b Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 13 Jun 2014 09:07:52 +1000 Subject: [PATCH 42/64] Call reset function of RaceGUIBase, which fixes #1363 (missing thunderbird). --- src/states_screens/race_gui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index be49e2834..ae03ffe7e 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -123,6 +123,7 @@ RaceGUI::~RaceGUI() */ void RaceGUI::reset() { + RaceGUIBase::reset(); for(unsigned int i=0; igetNumberOfKarts(); i++) { m_animation_states[i] = AS_NONE; From 698d892f739e10b80869a8ddf8d0d8aa2fe026e1 Mon Sep 17 00:00:00 2001 From: vlj Date: Fri, 13 Jun 2014 13:39:23 +0200 Subject: [PATCH 43/64] Fix for OSX compilation OSX supports GL up to 4.0 and is unlikely to ship gl header for later version. --- src/graphics/shaders.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index f33f11c49..39f578b1d 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -277,15 +277,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(); @@ -2448,18 +2444,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; @@ -2505,15 +2502,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; From 1a9f0a83b42b16f08044ee5d57206d1074fe57d6 Mon Sep 17 00:00:00 2001 From: vlj Date: Fri, 13 Jun 2014 13:41:07 +0200 Subject: [PATCH 44/64] Add bypassUBO for ColoredLine --- src/graphics/shaders.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 39f578b1d..3e2cb6224 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -415,6 +415,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()); } From 4daa239c5c28842e8dad75afc46c827f29a7059a Mon Sep 17 00:00:00 2001 From: vlj Date: Fri, 13 Jun 2014 13:45:37 +0200 Subject: [PATCH 45/64] Fix light with ssao disabled. --- src/graphics/rtts.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 4eaa8b659..3816888cd 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -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)); From 6425befc5ef8198090c827aa7d7769468ddb6480 Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 13 Jun 2014 23:27:52 +1000 Subject: [PATCH 46/64] Synchronise achievements from a local account to an online account. --- src/achievements/achievements_status.cpp | 27 ++++++++++++++++++++++++ src/online/online_player_profile.cpp | 12 +++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/achievements/achievements_status.cpp b/src/achievements/achievements_status.cpp index 3c883bbd4..1b180aff9 100644 --- a/src/achievements/achievements_status.cpp +++ b/src/achievements/achievements_status.cpp @@ -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,39 @@ 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 & achieved_ids) { + std::vector 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::iterator i; + + for(i=m_achievements.begin(); i!=m_achievements.end(); i++) + { + int id = i->second->getID(); + if(i->second->isAchieved() && (id>=done.size() || !done[id]) ) + { + Log::info("Achievements", "Synching achievement %d to server.", + i->first); + Online::HTTPRequest * request = new Online::HTTPRequest(true,2); + PlayerManager::setUserDetails(request, "achieving"); + request->addParameter("achievementid", i->second->getID()); + request->queue(); + } + } } // sync // ---------------------------------------------------------------------------- @@ -132,6 +158,7 @@ void AchievementsStatus::onRaceEnd() } } // onRaceEnd +// ---------------------------------------------------------------------------- void AchievementsStatus::onLapEnd() { //reset all values that need to be reset diff --git a/src/online/online_player_profile.cpp b/src/online/online_player_profile.cpp index 4559fa538..28e955fe0 100644 --- a/src/online/online_player_profile.cpp +++ b/src/online/online_player_profile.cpp @@ -193,12 +193,12 @@ namespace Online } ProfileManager::get()->addPersistent(m_profile); std::string achieved_string(""); - if(input->get("achieved", &achieved_string) == 1) - { - std::vector 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 achieved_ids = + StringUtils::splitToUInt(achieved_string, ' '); + PlayerManager::getCurrentAchievementsStatus()->sync(achieved_ids); m_profile->fetchFriends(); } // if success else From 08369d1fcbd2d4e003bc40cd3d404fd7e98e28de Mon Sep 17 00:00:00 2001 From: samuncle Date: Sat, 14 Jun 2014 00:42:57 +0200 Subject: [PATCH 47/64] Added a new particle system for the torches and bring back the vignette --- data/gfx/gfx_sparkFire_a.xml | 35 +++++++++++++++++++++++++++++++++++ data/shaders/tonemap.frag | 9 ++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 data/gfx/gfx_sparkFire_a.xml diff --git a/data/gfx/gfx_sparkFire_a.xml b/data/gfx/gfx_sparkFire_a.xml new file mode 100644 index 000000000..af9f4d14d --- /dev/null +++ b/data/gfx/gfx_sparkFire_a.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/shaders/tonemap.frag b/data/shaders/tonemap.frag index fe2fc5ea7..c0a183da8 100644 --- a/data/shaders/tonemap.frag +++ b/data/shaders/tonemap.frag @@ -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); } From e1a750672f1219a4fe06fcdd65a3e7a58ed17f48 Mon Sep 17 00:00:00 2001 From: hiker Date: Sun, 15 Jun 2014 22:01:52 +1000 Subject: [PATCH 48/64] Fix #1364. --- src/guiengine/scalable_font.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/guiengine/scalable_font.hpp b/src/guiengine/scalable_font.hpp index 7cf893c46..98962e6d3 100644 --- a/src/guiengine/scalable_font.hpp +++ b/src/guiengine/scalable_font.hpp @@ -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 -#include "utils/leak_check.hpp" + +#include +#include namespace irr { From f1c8fcc6d427b2ca81494de612958b7579269f63 Mon Sep 17 00:00:00 2001 From: hiker Date: Sun, 15 Jun 2014 22:14:50 +1000 Subject: [PATCH 49/64] Fix 1366. --- data/shaders/sunlightshadow.frag | 1 + 1 file changed, 1 insertion(+) diff --git a/data/shaders/sunlightshadow.frag b/data/shaders/sunlightshadow.frag index 311889ab0..194a68333 100644 --- a/data/shaders/sunlightshadow.frag +++ b/data/shaders/sunlightshadow.frag @@ -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 { From 9cc34fd76b984df77ae57ddda1b9bce511448547 Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 16 Jun 2014 09:39:37 +1000 Subject: [PATCH 50/64] Changed order of libraries to hopefully make font_tool compile for Arthur. --- tools/font_tool/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/font_tool/CMakeLists.txt b/tools/font_tool/CMakeLists.txt index a0e58f792..1073b9185 100644 --- a/tools/font_tool/CMakeLists.txt +++ b/tools/font_tool/CMakeLists.txt @@ -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)") From f8f0a46ed4aa92dda815674bf412d52acc0a6a5c Mon Sep 17 00:00:00 2001 From: samuncle Date: Mon, 16 Jun 2014 02:45:39 +0200 Subject: [PATCH 51/64] Now if a not instancied object use the grass vert it will use grass frag too --- src/graphics/shaders.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 3e2cb6224..14cd9035d 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -1094,7 +1094,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"); From a50177c96ac7422b7b8e635725fd4a27fe6bd03f Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 16 Jun 2014 17:16:36 +1000 Subject: [PATCH 52/64] Removed messages.?pp files (and used the strings directly where they are needed). --- src/online/messages.cpp | 109 ------------------ src/online/messages.hpp | 49 -------- src/states_screens/create_server_screen.cpp | 4 +- .../dialogs/change_password_dialog.cpp | 4 +- .../dialogs/recovery_dialog.cpp | 4 +- .../dialogs/registration_dialog.cpp | 1 - .../dialogs/server_info_dialog.cpp | 4 +- .../dialogs/user_info_dialog.cpp | 4 +- src/states_screens/dialogs/vote_dialog.cpp | 9 +- .../online_profile_achievements.cpp | 7 +- src/states_screens/online_profile_friends.cpp | 6 +- src/states_screens/online_screen.cpp | 7 +- src/states_screens/online_user_search.cpp | 6 +- src/states_screens/register_screen.cpp | 4 +- src/states_screens/server_selection.cpp | 7 +- src/states_screens/user_screen.cpp | 5 +- src/utils/string_utils.cpp | 24 ++++ src/utils/string_utils.hpp | 2 + 18 files changed, 61 insertions(+), 195 deletions(-) delete mode 100644 src/online/messages.cpp delete mode 100644 src/online/messages.hpp diff --git a/src/online/messages.cpp b/src/online/messages.cpp deleted file mode 100644 index 9bdfce9b9..000000000 --- a/src/online/messages.cpp +++ /dev/null @@ -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 */ diff --git a/src/online/messages.hpp b/src/online/messages.hpp deleted file mode 100644 index 9349caf91..000000000 --- a/src/online/messages.hpp +++ /dev/null @@ -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 -#include - -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 */ diff --git a/src/states_screens/create_server_screen.cpp b/src/states_screens/create_server_screen.cpp index cf3f49fd4..7189302e7 100644 --- a/src/states_screens/create_server_screen.cpp +++ b/src/states_screens/create_server_screen.cpp @@ -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 diff --git a/src/states_screens/dialogs/change_password_dialog.cpp b/src/states_screens/dialogs/change_password_dialog.cpp index 632414d19..16aaf3b63 100644 --- a/src/states_screens/dialogs/change_password_dialog.cpp +++ b/src/states_screens/dialogs/change_password_dialog.cpp @@ -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) diff --git a/src/states_screens/dialogs/recovery_dialog.cpp b/src/states_screens/dialogs/recovery_dialog.cpp index 7d396e3d5..b8ba2d12b 100644 --- a/src/states_screens/dialogs/recovery_dialog.cpp +++ b/src/states_screens/dialogs/recovery_dialog.cpp @@ -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 diff --git a/src/states_screens/dialogs/registration_dialog.cpp b/src/states_screens/dialogs/registration_dialog.cpp index 2ebfbdc95..61533f9ff 100644 --- a/src/states_screens/dialogs/registration_dialog.cpp +++ b/src/states_screens/dialogs/registration_dialog.cpp @@ -24,7 +24,6 @@ #include "states_screens/register_screen.hpp" #include "utils/translation.hpp" #include "utils/string_utils.hpp" -#include "online/messages.hpp" #include diff --git a/src/states_screens/dialogs/server_info_dialog.cpp b/src/states_screens/dialogs/server_info_dialog.cpp index 0dbe551a4..3887ca1b9 100644 --- a/src/states_screens/dialogs/server_info_dialog.cpp +++ b/src/states_screens/dialogs/server_info_dialog.cpp @@ -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); } } diff --git a/src/states_screens/dialogs/user_info_dialog.cpp b/src/states_screens/dialogs/user_info_dialog.cpp index 22a937561..71ec898fa 100644 --- a/src/states_screens/dialogs/user_info_dialog.cpp +++ b/src/states_screens/dialogs/user_info_dialog.cpp @@ -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; diff --git a/src/states_screens/dialogs/vote_dialog.cpp b/src/states_screens/dialogs/vote_dialog.cpp index f0efb36de..8fb5895d6 100644 --- a/src/states_screens/dialogs/vote_dialog.cpp +++ b/src/states_screens/dialogs/vote_dialog.cpp @@ -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 } diff --git a/src/states_screens/online_profile_achievements.cpp b/src/states_screens/online_profile_achievements.cpp index 44c89b3ee..07e0c4bb3 100644 --- a/src/states_screens/online_profile_achievements.cpp +++ b/src/states_screens/online_profile_achievements.cpp @@ -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; } diff --git a/src/states_screens/online_profile_friends.cpp b/src/states_screens/online_profile_friends.cpp index 4ffe2c1f3..c925ce85c 100644 --- a/src/states_screens/online_profile_friends.cpp +++ b/src/states_screens/online_profile_friends.cpp @@ -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 diff --git a/src/states_screens/online_screen.cpp b/src/states_screens/online_screen.cpp index 2423d3ce8..bcfc746e0 100644 --- a/src/states_screens/online_screen.cpp +++ b/src/states_screens/online_screen.cpp @@ -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 diff --git a/src/states_screens/online_user_search.cpp b/src/states_screens/online_user_search.cpp index c24cc1959..71bc6ba3b 100644 --- a/src/states_screens/online_user_search.cpp +++ b/src/states_screens/online_user_search.cpp @@ -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 diff --git a/src/states_screens/register_screen.cpp b/src/states_screens/register_screen.cpp index 30b634fdb..941943dfa 100644 --- a/src/states_screens/register_screen.cpp +++ b/src/states_screens/register_screen.cpp @@ -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()) { diff --git a/src/states_screens/server_selection.cpp b/src/states_screens/server_selection.cpp index 985e26dea..08bd94c97 100644 --- a/src/states_screens/server_selection.cpp +++ b/src/states_screens/server_selection.cpp @@ -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) diff --git a/src/states_screens/user_screen.cpp b/src/states_screens/user_screen.cpp index 266d73db6..de5b1fa72 100644 --- a/src/states_screens/user_screen.cpp +++ b/src/states_screens/user_screen.cpp @@ -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" @@ -395,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) diff --git a/src/utils/string_utils.cpp b/src/utils/string_utils.cpp index 8c61bc40b..734dcdce9 100644 --- a/src/utils/string_utils.cpp +++ b/src/utils/string_utils.cpp @@ -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 diff --git a/src/utils/string_utils.hpp b/src/utils/string_utils.hpp index b1e70eeec..19d9f3fe5 100644 --- a/src/utils/string_utils.hpp +++ b/src/utils/string_utils.hpp @@ -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 split(const std::string& s, char c, From fa2913c9378d3537a42f9595940f9ef3d6cbfa73 Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 16 Jun 2014 22:09:25 +1000 Subject: [PATCH 53/64] Try to force an automatic rerun of cmake by a dummy modification of this file. --- sources.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources.cmake b/sources.cmake index fd74b86e3..595e1c12f 100644 --- a/sources.cmake +++ b/sources.cmake @@ -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/*") From 6dd4c6f8030d3964ae66bb06df2ef0a8d392ed57 Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 16 Jun 2014 23:22:27 +1000 Subject: [PATCH 54/64] Use the new stkaddons feeature to allow more than one achievements to be sent at a time. This means only one server request when local achievements are synched to the online account. --- src/achievements/achievements_status.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/achievements/achievements_status.cpp b/src/achievements/achievements_status.cpp index 1b180aff9..36e72d8ca 100644 --- a/src/achievements/achievements_status.cpp +++ b/src/achievements/achievements_status.cpp @@ -133,19 +133,28 @@ void AchievementsStatus::sync(const std::vector & achieved_ids) std::map::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++) { - int id = i->second->getID(); + unsigned int id = i->second->getID(); if(i->second->isAchieved() && (id>=done.size() || !done[id]) ) { - Log::info("Achievements", "Synching achievement %d to server.", - i->first); - Online::HTTPRequest * request = new Online::HTTPRequest(true,2); - PlayerManager::setUserDetails(request, "achieving"); - request->addParameter("achievementid", i->second->getID()); - request->queue(); + ids=ids+StringUtils::toString(id)+","; } } + + if(ids.size()>0) + { + ids.pop_back(); // 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 // ---------------------------------------------------------------------------- From a31ed23bc0512baca2b51a49a7f94484da7a1e55 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Mon, 16 Jun 2014 19:12:48 -0400 Subject: [PATCH 55/64] Fix compilation. Hopefully I broke nothing --- src/achievements/achievements_status.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/achievements/achievements_status.cpp b/src/achievements/achievements_status.cpp index 36e72d8ca..400f9a6cd 100644 --- a/src/achievements/achievements_status.cpp +++ b/src/achievements/achievements_status.cpp @@ -147,7 +147,7 @@ void AchievementsStatus::sync(const std::vector & achieved_ids) if(ids.size()>0) { - ids.pop_back(); // delete the last "," in the string + 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); From bc83bb133966f3c18a6be7b32796e007eaf2c56a Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Tue, 17 Jun 2014 22:24:02 +0200 Subject: [PATCH 56/64] Fix attempt for OS X --- src/graphics/rtts.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 3816888cd..345841d6e 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -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); From 6a4e46af5cdea27abb1fe06851f65402dcbc042c Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Tue, 17 Jun 2014 18:13:40 -0400 Subject: [PATCH 57/64] Fix more issues on feature unlocked screen --- src/states_screens/feature_unlocked.cpp | 32 +++++++++++++++++++++---- src/states_screens/feature_unlocked.hpp | 3 +++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index ab7c2df9f..2fc48313d 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -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 @@ -432,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); @@ -443,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 diff --git a/src/states_screens/feature_unlocked.hpp b/src/states_screens/feature_unlocked.hpp index 5ac512e53..70589ab05 100644 --- a/src/states_screens/feature_unlocked.hpp +++ b/src/states_screens/feature_unlocked.hpp @@ -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; From b9c45b7e0f741f0a93a4ed62a899f8b1c6e38367 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Tue, 17 Jun 2014 18:14:24 -0400 Subject: [PATCH 58/64] Undo dubious code that causes crashes --- src/states_screens/race_result_gui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index d5ee36159..b8a6e88da 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -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()) From 76b76c6872577a8a3371450234d0b7f4a84274de Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Wed, 18 Jun 2014 20:50:30 +0200 Subject: [PATCH 59/64] Try to fix crash on linux with proprietary drivers --- src/graphics/rtts.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 345841d6e..907394453 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -27,16 +27,12 @@ static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint i GLuint result; glGenTextures(1, &result); glBindTexture(target, result); - if (irr_driver->getGLSLVersion() < 420) - glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0); - else - { #if WIN32 + if (irr_driver->getGLSLVersion() >= 420) glTexStorage3D(target, 1, internalFormat, w, h, d); -#else - assert(false); + else #endif - } + glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0); return result; } @@ -45,16 +41,12 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G GLuint result; glGenTextures(1, &result); glBindTexture(GL_TEXTURE_2D, result); - if (irr_driver->getGLSLVersion() < 420) - glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0); - else - { #if WIN32 + if (irr_driver->getGLSLVersion() < 420) glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height); -#else - assert(false); + else #endif - } + glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0); return result; } From e16a7de617268185ad116ee78c6a1bde3704f80a Mon Sep 17 00:00:00 2001 From: Flakebi Date: Thu, 19 Jun 2014 09:49:36 +0200 Subject: [PATCH 60/64] Change xml style of screens and fix some issues with screens --- data/gui/addons_loading.stkgui | 90 ++--- data/gui/addons_screen.stkgui | 65 ++-- data/gui/arenas.stkgui | 41 ++- data/gui/challenges.stkgui | 18 +- data/gui/confirm_dialog.stkgui | 21 +- data/gui/confirm_resolution_dialog.stkgui | 25 +- data/gui/credits.stkgui | 12 +- data/gui/custom_video_settings.stkgui | 358 +++++++++---------- data/gui/debug_slider.stkgui | 1 + data/gui/easter_egg.stkgui | 39 +- data/gui/edit_track.stkgui | 79 ++-- data/gui/enter_gp_name_dialog.stkgui | 25 +- data/gui/enter_player_name_dialog.stkgui | 27 +- data/gui/feature_unlocked.stkgui | 8 +- data/gui/gpedit.stkgui | 54 ++- data/gui/gpeditor.stkgui | 69 ++-- data/gui/grand_prix_lose.stkgui | 3 +- data/gui/grand_prix_win.stkgui | 3 +- data/gui/help1.stkgui | Bin 6768 -> 7162 bytes data/gui/help2.stkgui | Bin 9030 -> 9390 bytes data/gui/help3.stkgui | Bin 8212 -> 8564 bytes data/gui/help4.stkgui | Bin 5644 -> 5858 bytes data/gui/karts.stkgui | 47 ++- data/gui/karts_online.stkgui | 47 ++- data/gui/main.stkgui | 6 +- data/gui/online/change_password.stkgui | 29 +- data/gui/online/create_server.stkgui | 53 ++- data/gui/online/guest_login.stkgui | 74 ++-- data/gui/online/lobby.stkgui | 32 +- data/gui/online/lobby_settings.stkgui | 25 +- data/gui/online/main.stkgui | 30 +- data/gui/online/notification_dialog.stkgui | 13 +- data/gui/online/profile_achievements.stkgui | 33 +- data/gui/online/profile_friends.stkgui | 60 ++-- data/gui/online/profile_overview.stkgui | 35 +- data/gui/online/profile_settings.stkgui | 45 ++- data/gui/online/recovery_info.stkgui | 31 +- data/gui/online/recovery_input.stkgui | 46 ++- data/gui/online/register.stkgui | 144 ++++---- data/gui/online/registration_terms.stkgui | 27 +- data/gui/online/server_info_dialog.stkgui | 23 +- data/gui/online/server_selection.stkgui | 22 +- data/gui/online/user_info_dialog.stkgui | 30 +- data/gui/online/user_search.stkgui | 42 ++- data/gui/online/vote_dialog.stkgui | 21 +- data/gui/options_audio.stkgui | 127 ++++--- data/gui/options_device.stkgui | 85 +++-- data/gui/options_input.stkgui | 65 ++-- data/gui/options_players.stkgui | 89 +++-- data/gui/options_ui.stkgui | 105 +++--- data/gui/options_video.stkgui | 149 ++++---- data/gui/overworld_dialog.stkgui | 3 +- data/gui/press_a_key_dialog.stkgui | 17 +- data/gui/race_paused_dialog.stkgui | 4 +- data/gui/race_result.stkgui | 1 + data/gui/racesetup.stkgui | 73 ++-- data/gui/select_challenge.stkgui | 79 ++-- data/gui/soccer_setup.stkgui | 16 +- data/gui/track_info_dialog.stkgui | 122 +++---- data/gui/tracks.stkgui | 47 ++- data/gui/tutorial.stkgui | 18 +- data/gui/tutorial_message_dialog.stkgui | 14 +- data/gui/user_screen.stkgui | 3 +- data/gui/user_screen_tab.stkgui | 8 +- src/states_screens/options_screen_input2.cpp | 27 +- 65 files changed, 1413 insertions(+), 1492 deletions(-) diff --git a/data/gui/addons_loading.stkgui b/data/gui/addons_loading.stkgui index 66d721b87..98c4eb543 100644 --- a/data/gui/addons_loading.stkgui +++ b/data/gui/addons_loading.stkgui @@ -1,45 +1,45 @@ - - -
- - -
-
- - -
- -
-
-
- - - -
- - - - - - -
-
-
+ + +
+ + +
+
+ + +
+ +
+
+
+ + + +
+ + + + + + +
+
+
diff --git a/data/gui/addons_screen.stkgui b/data/gui/addons_screen.stkgui index acec405f6..708f6bff9 100644 --- a/data/gui/addons_screen.stkgui +++ b/data/gui/addons_screen.stkgui @@ -1,40 +1,39 @@ + +
-
- -
- -
- -
- - -
- - -
+ + + + + + + + + + + +
diff --git a/data/gui/arenas.stkgui b/data/gui/arenas.stkgui index 74fd7ff20..174bf2d2b 100644 --- a/data/gui/arenas.stkgui +++ b/data/gui/arenas.stkgui @@ -1,28 +1,27 @@ + + - +
-
+
-
- - - - - - - + - -
+ +
+
diff --git a/data/gui/challenges.stkgui b/data/gui/challenges.stkgui index a006bb26d..a109ad5a8 100644 --- a/data/gui/challenges.stkgui +++ b/data/gui/challenges.stkgui @@ -1,20 +1,20 @@ + - - +
- +
- + - + - + - - + +
-
\ No newline at end of file + diff --git a/data/gui/confirm_dialog.stkgui b/data/gui/confirm_dialog.stkgui index ecf5f40bf..b1f57e61d 100644 --- a/data/gui/confirm_dialog.stkgui +++ b/data/gui/confirm_dialog.stkgui @@ -1,19 +1,16 @@ + +
+
diff --git a/data/gui/confirm_resolution_dialog.stkgui b/data/gui/confirm_resolution_dialog.stkgui index 988680b42..f0fdf2d15 100644 --- a/data/gui/confirm_resolution_dialog.stkgui +++ b/data/gui/confirm_resolution_dialog.stkgui @@ -1,21 +1,18 @@ + +
+
diff --git a/data/gui/credits.stkgui b/data/gui/credits.stkgui index 0c1afd656..988f09c14 100644 --- a/data/gui/credits.stkgui +++ b/data/gui/credits.stkgui @@ -1,18 +1,14 @@ -
- +
- -
\ No newline at end of file + diff --git a/data/gui/custom_video_settings.stkgui b/data/gui/custom_video_settings.stkgui index 2a5a4ecee..2942c4312 100644 --- a/data/gui/custom_video_settings.stkgui +++ b/data/gui/custom_video_settings.stkgui @@ -1,190 +1,188 @@ + +
+
-
+ -
- - - - - -
- - -
- - - -
- -
- - - -
- - -
- - -
- - - -
- - -
-
- - - -
- - -
- - -
- - - -
- - -
-
- - - -
-
- - -
- - - -
- - -
-
- - - -
-
- - -
- - - -
- - -
-
- - - -
-
- - -
- - - -
- - -
-
- - - -
-
- - -
- - - -
- - -
-
- - - -
-
- - -
- - -
- - - -
-
- - - -
-
- - -
+
+ + +
+ + +
+ +
+ + + +
+ + +
+ + +
+ + + +
+ + +
+
+ + + +
+ + +
+ + +
+ + + +
+ + +
+
+ + + +
+
+ + +
+ + + +
+ + +
+
+ + + +
+
+ + +
+ + + +
+ + +
+
+ + + +
+
+ + +
+ + + +
+ + +
+
+ + + +
+
+ + +
+ + + +
+ + +
+
+ + + +
+
+ + +
+ + + +
+ + + +
+
+ + + +
+
+ + + +
diff --git a/data/gui/debug_slider.stkgui b/data/gui/debug_slider.stkgui index c4d25a954..2fb46728a 100644 --- a/data/gui/debug_slider.stkgui +++ b/data/gui/debug_slider.stkgui @@ -1,3 +1,4 @@ +
- - + + +
+ +
diff --git a/data/gui/online/lobby_settings.stkgui b/data/gui/online/lobby_settings.stkgui index fc5ff8deb..2535b1946 100644 --- a/data/gui/online/lobby_settings.stkgui +++ b/data/gui/online/lobby_settings.stkgui @@ -1,6 +1,6 @@ +
-
@@ -9,24 +9,23 @@
- + - +
- - - - - - - - - - + + + + + + + + +
diff --git a/data/gui/online/main.stkgui b/data/gui/online/main.stkgui index 28c979ee8..2b0150313 100644 --- a/data/gui/online/main.stkgui +++ b/data/gui/online/main.stkgui @@ -1,17 +1,18 @@ +
- +
- + - + - + - -
- - + + + + +
diff --git a/data/gui/online/notification_dialog.stkgui b/data/gui/online/notification_dialog.stkgui index 90a9d739f..c22846fd6 100644 --- a/data/gui/online/notification_dialog.stkgui +++ b/data/gui/online/notification_dialog.stkgui @@ -1,19 +1,16 @@ + -
- +
-
diff --git a/data/gui/online/profile_achievements.stkgui b/data/gui/online/profile_achievements.stkgui index d072200b5..b8d13653d 100644 --- a/data/gui/online/profile_achievements.stkgui +++ b/data/gui/online/profile_achievements.stkgui @@ -1,23 +1,22 @@ + + - +
-
+
-
- - - - - - - - - - - - - -
+ + + + + + + + + + + +
diff --git a/data/gui/online/profile_friends.stkgui b/data/gui/online/profile_friends.stkgui index b0c6b073c..c2498bfd9 100644 --- a/data/gui/online/profile_friends.stkgui +++ b/data/gui/online/profile_friends.stkgui @@ -1,37 +1,35 @@ + + - +
-
+
-
- - - - - - - - - - - - - - -
- - - -
- -
+ + + + + + + + + + + + +
+ + + +
+
diff --git a/data/gui/online/profile_overview.stkgui b/data/gui/online/profile_overview.stkgui index ab7a4d2da..81afe5507 100644 --- a/data/gui/online/profile_overview.stkgui +++ b/data/gui/online/profile_overview.stkgui @@ -1,25 +1,24 @@ + + - +
-
+
-
- - - - - - - - - - - -
+ -
-
-
+ + + + + + + +
+ +
+
+
diff --git a/data/gui/online/profile_settings.stkgui b/data/gui/online/profile_settings.stkgui index 35abe5ee3..78599ff0b 100644 --- a/data/gui/online/profile_settings.stkgui +++ b/data/gui/online/profile_settings.stkgui @@ -1,29 +1,28 @@ + + - +
-
+
-
- - - - - - - - - - - -
-
-
-
- -
- + +
diff --git a/data/gui/online/recovery_info.stkgui b/data/gui/online/recovery_info.stkgui index 036dba116..59abf992c 100644 --- a/data/gui/online/recovery_info.stkgui +++ b/data/gui/online/recovery_info.stkgui @@ -1,23 +1,20 @@ + -
- +
- - - -
+ + +
diff --git a/data/gui/online/recovery_input.stkgui b/data/gui/online/recovery_input.stkgui index 26a8a7da0..0ed793f22 100644 --- a/data/gui/online/recovery_input.stkgui +++ b/data/gui/online/recovery_input.stkgui @@ -1,46 +1,44 @@ + -
- +
- + - -
+ + + + + + +
diff --git a/data/gui/online/register.stkgui b/data/gui/online/register.stkgui index dca284620..ab37206d9 100644 --- a/data/gui/online/register.stkgui +++ b/data/gui/online/register.stkgui @@ -1,82 +1,80 @@ - + +
-
+
+ -
- + +
+
+
+
+
+ +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
- - + + + + +
+
+ diff --git a/data/gui/online/registration_terms.stkgui b/data/gui/online/registration_terms.stkgui index 4c94d47e5..42b6995fc 100644 --- a/data/gui/online/registration_terms.stkgui +++ b/data/gui/online/registration_terms.stkgui @@ -1,36 +1,33 @@ + -
- +
- + - + - +
- + - +
-
diff --git a/data/gui/online/server_info_dialog.stkgui b/data/gui/online/server_info_dialog.stkgui index 9ce39b949..d91720706 100644 --- a/data/gui/online/server_info_dialog.stkgui +++ b/data/gui/online/server_info_dialog.stkgui @@ -1,33 +1,30 @@ + -
- +
- + - +
- - - + + +
-
diff --git a/data/gui/online/server_selection.stkgui b/data/gui/online/server_selection.stkgui index c863b9cc2..8d89bdd96 100644 --- a/data/gui/online/server_selection.stkgui +++ b/data/gui/online/server_selection.stkgui @@ -1,17 +1,15 @@ + +
-
+
+ +
+ +
-
- -
- + + +
- - - - - -
- diff --git a/data/gui/online/user_info_dialog.stkgui b/data/gui/online/user_info_dialog.stkgui index ae9e16d46..448daf059 100644 --- a/data/gui/online/user_info_dialog.stkgui +++ b/data/gui/online/user_info_dialog.stkgui @@ -1,41 +1,37 @@ + -
-
- + - +
- - - + + +
-
diff --git a/data/gui/online/user_search.stkgui b/data/gui/online/user_search.stkgui index df933620b..6cd01e931 100644 --- a/data/gui/online/user_search.stkgui +++ b/data/gui/online/user_search.stkgui @@ -1,24 +1,22 @@ + - - -
-
- - - -
- - -
- - - - - - - -
- - + + +
+
+ + + +
+ + +
+ + + + + + +
diff --git a/data/gui/online/vote_dialog.stkgui b/data/gui/online/vote_dialog.stkgui index d61c206d2..e344c21ad 100644 --- a/data/gui/online/vote_dialog.stkgui +++ b/data/gui/online/vote_dialog.stkgui @@ -1,27 +1,24 @@ + -
-
- + - +
-
diff --git a/data/gui/options_audio.stkgui b/data/gui/options_audio.stkgui index b925511da..4150e2f08 100644 --- a/data/gui/options_audio.stkgui +++ b/data/gui/options_audio.stkgui @@ -1,70 +1,69 @@ + +
-
- -
- - - - - - - - - - - - - - - -
- + + + + + + + + + + + + + +
+ +
diff --git a/data/gui/options_device.stkgui b/data/gui/options_device.stkgui index 0492c72c5..afe5c5de3 100644 --- a/data/gui/options_device.stkgui +++ b/data/gui/options_device.stkgui @@ -1,50 +1,49 @@ + +
-
+
+ -
- - - - - - - - - - - - - - -
- -
- - + +
+
diff --git a/data/gui/options_input.stkgui b/data/gui/options_input.stkgui index e4160b3aa..e966291f1 100644 --- a/data/gui/options_input.stkgui +++ b/data/gui/options_input.stkgui @@ -1,40 +1,39 @@ + +
-
+
+ -
- - - - - - - - - - - -
- - +
+
diff --git a/data/gui/options_players.stkgui b/data/gui/options_players.stkgui index 10c26320f..d291eab90 100644 --- a/data/gui/options_players.stkgui +++ b/data/gui/options_players.stkgui @@ -1,52 +1,51 @@ + +
-
+
+ -
- - - - - - - - - - - - - - -
- -
- - - -
- - +
+
diff --git a/data/gui/options_ui.stkgui b/data/gui/options_ui.stkgui index 2293390f5..5e411fba1 100644 --- a/data/gui/options_ui.stkgui +++ b/data/gui/options_ui.stkgui @@ -1,63 +1,62 @@ + +
-
+
+ -
- - - - - - - - - - - - - + + + + + + + - -
-
- - - -
- - -
+ -
- - -
+ -
- - -
+ +
+
+ + + +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + + + + + + - - - - - - - - - -
-
- - +
+
diff --git a/data/gui/options_video.stkgui b/data/gui/options_video.stkgui index 9f679add6..bdeb63365 100644 --- a/data/gui/options_video.stkgui +++ b/data/gui/options_video.stkgui @@ -1,84 +1,83 @@ + +
-
- -
- - - - - - - - - - - - +
- -
-
-
- - - - -
- - - -
- - - - - -
+ - + +
+ + + +
+ + + + +
+ +
diff --git a/data/gui/overworld_dialog.stkgui b/data/gui/overworld_dialog.stkgui index f10aa8d8e..c5bae2ba1 100644 --- a/data/gui/overworld_dialog.stkgui +++ b/data/gui/overworld_dialog.stkgui @@ -1,5 +1,5 @@ + -
@@ -29,5 +29,4 @@
-
diff --git a/data/gui/press_a_key_dialog.stkgui b/data/gui/press_a_key_dialog.stkgui index 3c53559dd..290772370 100644 --- a/data/gui/press_a_key_dialog.stkgui +++ b/data/gui/press_a_key_dialog.stkgui @@ -1,15 +1,14 @@ + +
-
+
+
diff --git a/data/gui/race_paused_dialog.stkgui b/data/gui/race_paused_dialog.stkgui index ba4dbe9f4..b31d50af8 100644 --- a/data/gui/race_paused_dialog.stkgui +++ b/data/gui/race_paused_dialog.stkgui @@ -1,7 +1,6 @@ + -
-
- - + + +
+ + + + + +
+ + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - +
diff --git a/data/gui/select_challenge.stkgui b/data/gui/select_challenge.stkgui index 796bc66f1..e45870601 100644 --- a/data/gui/select_challenge.stkgui +++ b/data/gui/select_challenge.stkgui @@ -1,46 +1,45 @@ + +
-
+
-
- - - -
-
- - - -
- - -
- - - -
- - -
- - - -
- - -
- - + -
+
+
+ + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
diff --git a/data/gui/soccer_setup.stkgui b/data/gui/soccer_setup.stkgui index d876e93a7..2ba235c4c 100644 --- a/data/gui/soccer_setup.stkgui +++ b/data/gui/soccer_setup.stkgui @@ -1,13 +1,13 @@ + -
- + - +
@@ -21,7 +21,7 @@
- +
@@ -30,18 +30,16 @@
- + - +
- +
-
diff --git a/data/gui/track_info_dialog.stkgui b/data/gui/track_info_dialog.stkgui index d93259056..1cd67f681 100644 --- a/data/gui/track_info_dialog.stkgui +++ b/data/gui/track_info_dialog.stkgui @@ -1,77 +1,73 @@ +
+
+