From: <hik...@us...> - 2010-08-01 23:37:45
|
Revision: 5716 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5716&view=rev Author: hikerstk Date: 2010-08-01 23:37:39 +0000 (Sun, 01 Aug 2010) Log Message: ----------- 1) Fixed incorrect colours for rows (player karts should be in red). 2) Removed unnecessary type casts. 3) When increasing the GP points, the 'recently earned' points are now decreased. Modified Paths: -------------- main/trunk/src/states_screens/race_result_gui.cpp main/trunk/src/states_screens/race_result_gui.hpp Modified: main/trunk/src/states_screens/race_result_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.cpp 2010-08-01 23:30:13 UTC (rev 5715) +++ main/trunk/src/states_screens/race_result_gui.cpp 2010-08-01 23:37:39 UTC (rev 5716) @@ -90,6 +90,7 @@ { if(order[i]==-1) continue; Kart *kart = world->getKart(order[i]); + m_is_player_kart.push_back(kart->getController()->isPlayerController()); m_kart_names.push_back(kart->getName()); video::ITexture *icon = @@ -188,9 +189,8 @@ assert(world->getPhase()==WorldStatus::RESULT_DISPLAY_PHASE); unsigned int num_karts = world->getNumKarts(); - // First: Update the finite state machine, and set - // the current X and Y positions. - // =============================================== + // First: Update the finite state machine + // ====================================== switch(m_animation_state) { case RR_INIT: @@ -241,11 +241,13 @@ case RR_WAIT_TILL_END: break; } // switch + // Second phase: update X and Y positions for the various animations + // ================================================================= float v = 0.9f*UserConfigParams::m_width/m_time_single_scroll; for(unsigned int i=0; i<m_kart_names.size(); i++) { float x = m_x_pos[i]; - float y = (float)m_y_pos[i]; + float y = m_y_pos[i]; switch(m_animation_state) { // Both states use the same scrolling: @@ -263,14 +265,15 @@ m_current_displayed_points[i] += dt*m_time_for_points; if(m_current_displayed_points[i]>m_new_overall_points[i]) m_current_displayed_points[i] = (float)m_new_overall_points[i]; + m_new_points[i] -= dt*m_time_for_points; + if(m_new_points[i]<0) + m_new_points[i] = 0; break; case RR_RESORT_TABLE: x = m_x_pos[i] -m_radius[i]*sin(m_timer/m_time_rotation*M_PI); y = m_centre_point[i]+m_radius[i]*cos(m_timer/m_time_rotation*M_PI); break; case RR_WAIT_TILL_END: - x = m_x_pos[i]; - y = (float)m_y_pos[i]; break; } // switch displayOneEntry((unsigned int)x, (unsigned int)y, i, true); @@ -295,6 +298,8 @@ m_kart_icons[rank] = kart->getKartProperties()->getIconMaterial()->getTexture(); m_kart_names[rank] = kart->getName(); + m_is_player_kart[rank] = kart->getController()->isPlayerController(); + float time = race_manager->getOverallTime(kart_id); m_finish_time_string[rank] = StringUtils::timeToString(time).c_str(); @@ -303,7 +308,7 @@ m_y_pos[rank] = (float)(m_top+rank*m_distance_between_rows); int p = race_manager->getKartPrevScore(kart_id); m_current_displayed_points[rank] = (float)p; - m_new_points[rank] = race_manager->getPositionScore(kart->getPosition()); + m_new_points[rank] = (float)race_manager->getPositionScore(kart->getPosition()); } // Now update the GP ranks, and determine the new position @@ -332,13 +337,8 @@ unsigned int n, bool display_points) { World *world = World::getWorld(); - video::SColor color; - // Display player karts in red - Kart *kart = world->getKart(n); - if(kart->getController()->isPlayerController()) - color = video::SColor(255, 255, 0, 0); - else - color = video::SColor(255, 255, 255, 255); + video::SColor color = m_is_player_kart[n] ? video::SColor(255,255,0, 0 ) + : video::SColor(255,255,255,255); // First draw the icon // ------------------- @@ -381,12 +381,16 @@ + m_width_kart_name + m_width_column_space + m_width_finish_time + m_width_column_space; dest_rect = core::recti(x_point, y, x_point+100, y+10); - core::stringw point_string = core::stringw("+")+core::stringw(m_new_points[n]); - // With mono-space digits space has the same width as each character, so - // we can simply fill up the string with spaces to get the right aligned. - while(point_string.size()<3) - point_string = core::stringw(" ")+point_string; - m_font->draw(point_string, dest_rect, color); + if(m_new_points[n]>0) + { + core::stringw point_string = core::stringw("+") + + core::stringw((int)m_new_points[n]); + // With mono-space digits space has the same width as each character, so + // we can simply fill up the string with spaces to get the right aligned. + while(point_string.size()<3) + point_string = core::stringw(" ")+point_string; + m_font->draw(point_string, dest_rect, color); + } // Draw the old_points plus increase value // --------------------------------------- Modified: main/trunk/src/states_screens/race_result_gui.hpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.hpp 2010-08-01 23:30:13 UTC (rev 5715) +++ main/trunk/src/states_screens/race_result_gui.hpp 2010-08-01 23:37:39 UTC (rev 5716) @@ -70,6 +70,9 @@ /** Currenct Y position. */ std::vector<float> m_y_pos; + /** True if kart is a player kart. */ + std::vector<bool> m_is_player_kart; + /** The center point when sorting the entries. */ std::vector<float> m_centre_point; @@ -81,17 +84,14 @@ std::vector<core::stringw> m_kart_names; /** Points earned in this race. */ - std::vector<int> m_new_points; + std::vector<float> m_new_points; /** New overall points after this race. */ std::vector<int> m_new_overall_points; /** When updating the number of points in the display, this is the - currently displayed number of points, so - m_new_overall_points-m_new_points <= m_current_displayed_points <= - m_new_overall_points. - This is a floating point number since it stores the increments - during increasing the points. */ + currently displayed number of points. This is a floating point number + since it stores the increments during increasing the points. */ std::vector<float> m_current_displayed_points; /** The kart icons. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-05 13:16:39
|
Revision: 5725 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5725&view=rev Author: hikerstk Date: 2010-08-05 13:16:32 +0000 (Thu, 05 Aug 2010) Log Message: ----------- Simplified code by reusing existing function. Modified Paths: -------------- main/trunk/src/states_screens/grand_prix_lose.cpp main/trunk/src/states_screens/grand_prix_win.cpp Modified: main/trunk/src/states_screens/grand_prix_lose.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_lose.cpp 2010-08-04 22:47:36 UTC (rev 5724) +++ main/trunk/src/states_screens/grand_prix_lose.cpp 2010-08-05 13:16:32 UTC (rev 5725) @@ -231,29 +231,20 @@ const KartProperties* kart = kart_properties_manager->getKart(ident_arg[0]); if (kart != NULL) { - KartModel* kartModel = kart->getKartModel(); + KartModel* kart_model = kart->getKartModel(); m_kart_x = KART_START_X; m_kart_y = KART_Y; m_kart_z = KART_Z; - kart_main_node = irr_driver->addMesh(kartModel->getModel()); + kart_model->attachModel(&kart_main_node); kart_main_node->setPosition( core::vector3df(m_kart_x, m_kart_y, m_kart_z) ); //kart_main_node->setScale( core::vector3df(0.4f, 0.4f, 0.4f) ); kart_main_node->updateAbsolutePosition(); - - for (int wheel=0; wheel<4; wheel++) - { - scene::ISceneNode* wheel_model = irr_driver->getSceneManager()->addMeshSceneNode( - kartModel->getWheelModel(wheel), - kart_main_node); - wheel_model->setPosition( kartModel->getWheelGraphicsPosition(wheel).toIrrVector() ); - wheel_model->updateAbsolutePosition(); - } kart_main_node->setRotation(vector3df(0, 90, 0)); - } + } // if kart !=NULL m_kart_node = kart_main_node; -} +} // setKarts // ------------------------------------------------------------------------------------- Modified: main/trunk/src/states_screens/grand_prix_win.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_win.cpp 2010-08-04 22:47:36 UTC (rev 5724) +++ main/trunk/src/states_screens/grand_prix_win.cpp 2010-08-05 13:16:32 UTC (rev 5725) @@ -390,27 +390,18 @@ const KartProperties* kart = kart_properties_manager->getKart(idents[n]); if (kart != NULL) { - KartModel* kartModel = kart->getKartModel(); - assert(kartModel != NULL); + KartModel* kart_model = kart->getKartModel(); + assert(kart_model != NULL); m_kart_x[n] = m_podium_x[n]; m_kart_y[n] = INITIAL_Y; m_kart_z[n] = -4; m_kart_rotation[n] = 0.0f; - kart_main_node = irr_driver->addMesh(kartModel->getModel()); + kart_model->attachModel(&kart_main_node); assert(kart_main_node != NULL); kart_main_node->setPosition( core::vector3df(m_kart_x[n], m_kart_y[n], m_kart_z[n]) ); kart_main_node->setScale( core::vector3df(0.4f, 0.4f, 0.4f) ); - - for (int wheel=0; wheel<4; wheel++) - { - scene::ISceneNode* wheel_model = irr_driver->getSceneManager()->addMeshSceneNode( - kartModel->getWheelModel(wheel), - kart_main_node); - wheel_model->setPosition( kartModel->getWheelGraphicsPosition(wheel).toIrrVector() ); - wheel_model->updateAbsolutePosition(); - } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-06 13:59:09
|
Revision: 5727 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5727&view=rev Author: hikerstk Date: 2010-08-06 13:59:03 +0000 (Fri, 06 Aug 2010) Log Message: ----------- 1) Worked around bug of 'continue' text not being shown when a kart is unlocked. 2) Minor style cleanup. Modified Paths: -------------- main/trunk/src/states_screens/feature_unlocked.cpp main/trunk/src/states_screens/feature_unlocked.hpp Modified: main/trunk/src/states_screens/feature_unlocked.cpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.cpp 2010-08-06 05:12:50 UTC (rev 5726) +++ main/trunk/src/states_screens/feature_unlocked.cpp 2010-08-06 13:59:03 UTC (rev 5727) @@ -25,25 +25,25 @@ DEFINE_SCREEN_SINGLETON( FeatureUnlockedCutScene ); -// ------------------------------------------------------------------------------------- -// ------------------------------------------------------------------------------------- +// ============================================================================ #if 0 #pragma mark FeatureUnlockedCutScene::UnlockedThing #endif -FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(KartProperties* kart, irr::core::stringw msg) +FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(KartProperties* kart, + irr::core::stringw msg) { - m_unlocked_kart = kart; - m_unlock_message = msg; - m_curr_image = -1; + m_unlocked_kart = kart; + m_unlock_message = msg; + m_curr_image = -1; } // UnlockedThing::UnlockedThing // ------------------------------------------------------------------------------------- - FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(irr::video::ITexture* pict, - float w, float h, irr::core::stringw msg) + float w, float h, + irr::core::stringw msg) { m_unlocked_kart = NULL; m_pictures.push_back(pict); @@ -56,7 +56,8 @@ // ---------------------------------------------------------------------------- FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::vector<irr::video::ITexture*> picts, - float w, float h, irr::core::stringw msg) + float w, float h, + irr::core::stringw msg) { m_unlocked_kart = NULL; m_pictures = picts; @@ -81,57 +82,61 @@ #pragma mark FeatureUnlockedCutScene #endif -FeatureUnlockedCutScene::FeatureUnlockedCutScene() : Screen("feature_unlocked.stkgui") +FeatureUnlockedCutScene::FeatureUnlockedCutScene() + : Screen("feature_unlocked.stkgui") { setNeeds3D(true); m_throttle_FPS = false; +#ifdef USE_IRRLICHT_BUG_WORKAROUND + m_avoid_irrlicht_bug = NULL; +#endif } // FeatureUnlockedCutScene -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void FeatureUnlockedCutScene::loadedFromFile() { } // loadedFromFile -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- -void FeatureUnlockedCutScene::addUnlockedKart(KartProperties* unlocked_kart, irr::core::stringw msg) +void FeatureUnlockedCutScene::addUnlockedKart(KartProperties* unlocked_kart, + irr::core::stringw msg) { assert(unlocked_kart != NULL); m_unlocked_stuff.push_back( new UnlockedThing(unlocked_kart, msg) ); } // addUnlockedKart -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void FeatureUnlockedCutScene::addUnlockedPicture(irr::video::ITexture* picture, - float w, float h, irr::core::stringw msg) + float w, float h, + irr::core::stringw msg) { assert(picture != NULL); m_unlocked_stuff.push_back( new UnlockedThing(picture, w, h, msg) ); } // addUnlockedPicture -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void FeatureUnlockedCutScene::addUnlockedPictures(std::vector<irr::video::ITexture*> pictures, - float w, float h, irr::core::stringw msg) + float w, float h, + irr::core::stringw msg) { assert(!pictures.empty()); m_unlocked_stuff.push_back( new UnlockedThing(pictures, w, h, msg) ); } // addUnlockedPictures -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void FeatureUnlockedCutScene::init() { m_sky_angle = 0.0f; m_global_time = 0.0f; - //m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("lscales.png"), 16 /* hori_res */, 16 /* vert_res */, - // 1.0f /* texture_percent */, 2.0f /* sphere_percent */); - std::vector<std::string> texture_names(6); texture_names[0] = file_manager->getTextureFile("purplenebula.png"); texture_names[1] = file_manager->getTextureFile("purplenebula2.png"); @@ -140,8 +145,14 @@ texture_names[4] = file_manager->getTextureFile("purplenebula.png"); texture_names[5] = file_manager->getTextureFile("purplenebula2.png"); m_sky = irr_driver->addSkyBox(texture_names); +#ifdef DEBUG + m_sky->setName("skybox"); +#endif m_camera = irr_driver->addCameraSceneNode(); +#ifdef DEBUG + m_camera->setName("camera"); +#endif m_camera->setPosition( core::vector3df(0.0, 30.0f, 70.0f) ); m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); m_camera->setTarget( core::vector3df(0, 10, 0.0f) ); @@ -149,16 +160,27 @@ m_camera->updateAbsolutePosition(); irr_driver->getSceneManager()->setActiveCamera(m_camera); - scene::IAnimatedMesh* model_chest = irr_driver->getAnimatedMesh( file_manager->getModelFile("chest.b3d") ); + scene::IAnimatedMesh* model_chest = + irr_driver->getAnimatedMesh( file_manager->getModelFile("chest.b3d") ); assert(model_chest != NULL); m_chest = irr_driver->addAnimatedMesh(model_chest); +#ifdef DEBUG + m_chest->setName("chest"); +#endif m_chest->setPosition( core::vector3df(2, -3, 0) ); m_chest->setScale( core::vector3df(10.0f, 10.0f, 10.0f) ); - irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, 120, 120)); + irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, + 120, 120)); const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f ); - m_light = irr_driver->getSceneManager()->addLightSceneNode(NULL, sun_pos, video::SColorf(1.0f,1.0f,1.0f), 10000.0f /* radius */); + m_light = + irr_driver->getSceneManager()->addLightSceneNode(NULL, sun_pos, + video::SColorf(1.0f,1.0f,1.0f), + 10000.0f /* radius */); +#ifdef DEBUG + m_light->setName("light"); +#endif m_light->getLightData().DiffuseColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f); m_light->getLightData().SpecularColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f); @@ -173,6 +195,21 @@ KartModel* kart_model = m_unlocked_stuff[n].m_unlocked_kart->getKartModel(); kart_model->attachModel(&(m_unlocked_stuff[n].m_root_gift_node)); +#ifdef DEBUG + m_unlocked_stuff[n].m_root_gift_node->setName("unlocked kart"); +#endif +#ifdef USE_IRRLICHT_BUG_WORKAROUND + // If a mesh with this material is added, irrlicht will + // display the 'continue' text (otherwise the text is + // not visible). This is a terrible work around, but + // stk to be released without waiting for the next + // irrlicht version. + video::SMaterial m; + m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; + scene::IMesh* mesh = + irr_driver->createTexturedQuadMesh(&m, 0, 0); + m_avoid_irrlicht_bug = irr_driver->addMesh(mesh); +#endif } else if (!m_unlocked_stuff[n].m_pictures.empty()) { @@ -195,18 +232,18 @@ m_unlocked_stuff[n].m_w, m_unlocked_stuff[n].m_h); m_unlocked_stuff[n].m_root_gift_node = irr_driver->addMesh(mesh); - +#ifdef DEBUG + m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture"); +#endif } else { std::cerr << "Malformed unlocked goody!!!\n"; } } - - } // init -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void FeatureUnlockedCutScene::tearDown() { @@ -217,19 +254,21 @@ m_camera = NULL; irr_driver->removeNode(m_chest); - //irr_driver->removeNode(m_chest_top); - //irr_driver->removeNode(m_key); m_chest = NULL; - //m_chest_top = NULL; - //m_key = NULL; irr_driver->removeNode(m_light); m_light = NULL; - + +#ifdef USE_IRRLICHT_BUG_WORKAROUND + if(m_avoid_irrlicht_bug) + irr_driver->removeNode(m_avoid_irrlicht_bug); + m_avoid_irrlicht_bug = NULL; +#endif + m_unlocked_stuff.clearAndDeleteAll(); } -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- //FIXME: doesn't go here... template<typename T> @@ -240,9 +279,10 @@ return value; } -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- -void FeatureUnlockedCutScene::onUpdate(float dt, irr::video::IVideoDriver* driver) +void FeatureUnlockedCutScene::onUpdate(float dt, + irr::video::IVideoDriver* driver) { m_global_time += dt; @@ -257,13 +297,16 @@ if (m_global_time < ANIM_FROM) { // progression of the chest rotation between 0 and 1 - const float rotationProgression = keepInRange( 0.0f, 1.0f, (float)sin(M_PI/2.0f*m_global_time/double(ANIM_FROM)) ); - const float chest_rotation = keepInRange(80.0f, 160.0f, (float)(80 + rotationProgression * 80) ); + const float rotationProgression = + keepInRange( 0.0f, 1.0f, (float)sin(M_PI/2.0f*m_global_time/ANIM_FROM) ); + const float chest_rotation = + keepInRange(80.0f, 160.0f, 80 + rotationProgression * 80); m_chest->setRotation( core::vector3df(0.0f, chest_rotation, 0.0f) ); } - const float current_frame = (float)keepInRange(0.0, (double)last_image, - (m_global_time - ANIM_FROM)/(double)(ANIM_TO - ANIM_FROM) * last_image); + const float current_frame = keepInRange(0.0f, (float)last_image, + (float)(m_global_time - ANIM_FROM) + /(ANIM_TO - ANIM_FROM) * last_image); //std::cout << "current_frame: " << current_frame << std::endl; m_chest->setCurrentFrame( current_frame ); @@ -280,14 +323,16 @@ if (m_unlocked_stuff[n].m_root_gift_node == NULL) continue; core::vector3df pos = m_unlocked_stuff[n].m_root_gift_node->getPosition(); - pos.Y = sin( (float)((m_global_time - GIFT_EXIT_FROM)*M_PI*1.2/GIFT_EXIT_TO) )*30.0f; + pos.Y = sin( (float)((m_global_time-GIFT_EXIT_FROM)*M_PI*1.2/GIFT_EXIT_TO) )*30.0f; - // when there are more than 1 unlocked items, make sure they each have their own path when they move + // when there are more than 1 unlocked items, make sure they each + // have their own path when they move if (unlockedStuffCount > 1) { if (n % 2 == 0) pos.X -= 2.2f*dt*float( int((n + 1)/2) ); else pos.X += 2.2f*dt*float( int((n + 1)/2) ); - //std::cout << "Object " << n << " moving by " << (n % 2 == 0 ? -4.0f : 4.0f)*float( n/2 + 1 ) << std::endl; + //std::cout << "Object " << n << " moving by " << + // (n % 2 == 0 ? -4.0f : 4.0f)*float( n/2 + 1 ) << std::endl; } else { @@ -298,7 +343,8 @@ m_unlocked_stuff[n].m_root_gift_node->setPosition(pos); - core::vector3df scale = m_unlocked_stuff[n].m_root_gift_node->getScale(); + core::vector3df scale = + m_unlocked_stuff[n].m_root_gift_node->getScale(); scale.X += 2.0f*dt; scale.Y += 2.0f*dt; scale.Z += 2.0f*dt; @@ -394,7 +440,7 @@ } } -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const Challenge*> unlocked) { @@ -493,7 +539,7 @@ } // next challenge } -// ------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- bool FeatureUnlockedCutScene::onEscapePressed() { Modified: main/trunk/src/states_screens/feature_unlocked.hpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.hpp 2010-08-06 05:12:50 UTC (rev 5726) +++ main/trunk/src/states_screens/feature_unlocked.hpp 2010-08-06 13:59:03 UTC (rev 5727) @@ -72,12 +72,21 @@ /** Angle of the key (from 0 to 1, simply traces progression) */ float m_key_angle; - irr::scene::ISceneNode* m_sky; - irr::scene::ICameraSceneNode* m_camera; - irr::scene::IAnimatedMeshSceneNode* m_chest; - //irr::scene::ISceneNode* m_chest_top; - //irr::scene::ISceneNode* m_key; + /** The scene node for the sky box. */ + irr::scene::ISceneNode *m_sky; + + /** The scene node for the camera. */ + irr::scene::ICameraSceneNode *m_camera; + + /** The scene node for the animated mesh. */ + irr::scene::IAnimatedMeshSceneNode *m_chest; + + /** The scene node for the light. */ irr::scene::ILightSceneNode* m_light; +#define USE_IRRLICHT_BUG_WORKAROUND +#ifdef USE_IRRLICHT_BUG_WORKAROUND + scene::IMeshSceneNode *m_avoid_irrlicht_bug; +#endif void continueButtonPressed(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-08 23:01:31
|
Revision: 5732 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5732&view=rev Author: hikerstk Date: 2010-08-08 23:01:25 +0000 (Sun, 08 Aug 2010) Log Message: ----------- More names for scene nodes. Modified Paths: -------------- main/trunk/src/states_screens/grand_prix_lose.cpp main/trunk/src/states_screens/grand_prix_win.cpp Modified: main/trunk/src/states_screens/grand_prix_lose.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_lose.cpp 2010-08-08 22:54:04 UTC (rev 5731) +++ main/trunk/src/states_screens/grand_prix_lose.cpp 2010-08-08 23:01:25 UTC (rev 5732) @@ -91,12 +91,19 @@ scene::IAnimatedMesh* model_garage_door = irr_driver->getAnimatedMesh( file_manager->getModelFile("gplose_door.b3d") ); assert(model_garage_door!= NULL); m_garage_door = irr_driver->addAnimatedMesh(model_garage_door); +#ifdef DEBUG + m_garage_door->setName("garage-door"); +#endif m_garage_door->setPosition( core::vector3df(2, INITIAL_Y, 0) ); m_garage_door->setAnimationSpeed(0); scene::IMesh* model_garage = irr_driver->getMesh( file_manager->getModelFile("gplose.b3d") ); assert(model_garage!= NULL); m_garage = irr_driver->addMesh(model_garage); +#ifdef DEBUG + m_garage->setName("garage"); +#endif + m_garage->setPosition( core::vector3df(2, INITIAL_Y, 0) ); scene::ISceneManager* sceneManager = irr_driver->getSceneManager(); Modified: main/trunk/src/states_screens/grand_prix_win.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_win.cpp 2010-08-08 22:54:04 UTC (rev 5731) +++ main/trunk/src/states_screens/grand_prix_win.cpp 2010-08-08 23:01:25 UTC (rev 5732) @@ -158,6 +158,9 @@ scene::IMesh* model_village = irr_driver->getMesh( file_manager->getModelFile("village.b3d") ); assert(model_village != NULL); m_village = irr_driver->addMesh(model_village); +#ifdef DEBUG + m_village->setName("village"); +#endif m_village->setPosition( core::vector3df(2, INITIAL_Y, 0) ); @@ -166,12 +169,21 @@ m_podium_step[0] = irr_driver->addMesh(podium_model); +#ifdef DEBUG + m_podium_step[0]->setName("Podium 0"); +#endif m_podium_step[0]->setPosition( core::vector3df(m_podium_x[0], INITIAL_PODIUM_Y, m_podium_z[0]) ); m_podium_step[1] = irr_driver->addMesh(podium_model); +#ifdef DEBUG + m_podium_step[1]->setName("Podium 1"); +#endif m_podium_step[1]->setPosition( core::vector3df(m_podium_x[1], INITIAL_PODIUM_Y, m_podium_z[1]) ); m_podium_step[2] = irr_driver->addMesh(podium_model); +#ifdef DEBUG + m_podium_step[2]->setName("Podium 2"); +#endif m_podium_step[2]->setPosition( core::vector3df(m_podium_x[2], INITIAL_PODIUM_Y, m_podium_z[2]) ); scene::ISceneManager* sceneManager = irr_driver->getSceneManager(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xa...@us...> - 2010-08-22 17:51:55
|
Revision: 5759 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5759&view=rev Author: xapantu Date: 2010-08-22 17:51:48 +0000 (Sun, 22 Aug 2010) Log Message: ----------- Adding a mutex in the main_screen to avoid problem with the thread that loads the news Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp main/trunk/src/states_screens/main_menu_screen.hpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-08-21 13:21:21 UTC (rev 5758) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-08-22 17:51:48 UTC (rev 5759) @@ -63,7 +63,6 @@ #ifdef ADDONS_MANAGER void MainMenuScreen::changeNewsText(std::string action) { - LabelWidget* w = this->getWidget<LabelWidget>("info_addons"); if(action == "news") { FILE* newsFile = NULL; @@ -85,12 +84,16 @@ // to remove the break line. //info.replace(info.size()-1,1, ""); - std::cout << info << std::endl; - //w->setText(std::string(info).c_str()); + //std::cout << info << std::endl; + pthread_mutex_lock(&(this->m_mutex_news_text)); + m_news_text = std::string(info).c_str(); + pthread_mutex_unlock(&(this->m_mutex_news_text)); } if(action == "offline") { - //w->setText(_("Can't access stkaddons server...")); + pthread_mutex_lock(&(this->m_mutex_news_text)); + m_news_text = "offline"; + pthread_mutex_unlock(&(this->m_mutex_news_text)); } } #endif @@ -110,12 +113,29 @@ input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); input_manager->setMasterPlayerOnly(false); #ifdef ADDONS_MANAGER + pthread_mutex_init(&(this->m_mutex_news_text), NULL); pthread_t nThreadID2; pthread_create(&nThreadID2, NULL, &MainMenuScreen::downloadNews, this); #endif } +#ifdef ADDONS_MANAGER // ------------------------------------------------------------------------------------------------------ +void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) +{ + //FIXME:very bad for performance + LabelWidget* w = this->getWidget<LabelWidget>("info_addons"); + pthread_mutex_lock(&(this->m_mutex_news_text)); + if(m_news_text == "offline") + { + w->setText("Can't access stkaddons server..."); + } + else + w->setText(m_news_text.c_str()); + pthread_mutex_unlock(&(this->m_mutex_news_text)); +} +#endif +// ------------------------------------------------------------------------------------------------------ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, const int playerID) { Modified: main/trunk/src/states_screens/main_menu_screen.hpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.hpp 2010-08-21 13:21:21 UTC (rev 5758) +++ main/trunk/src/states_screens/main_menu_screen.hpp 2010-08-22 17:51:48 UTC (rev 5759) @@ -32,7 +32,12 @@ MainMenuScreen(); public: +#ifdef ADDONS_MANAGER void changeNewsText(std::string action); + pthread_mutex_t m_mutex_news_text; + std::string m_news_text; + void onUpdate(float delta, irr::video::IVideoDriver* driver); +#endif /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-25 13:54:35
|
Revision: 5776 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5776&view=rev Author: hikerstk Date: 2010-08-25 13:54:28 +0000 (Wed, 25 Aug 2010) Log Message: ----------- Fixed handling of ESC (which previously would close the screen, without removing the actual race result gui). ESC now allows some skipping of animations. Modified Paths: -------------- main/trunk/src/states_screens/race_result_gui.cpp main/trunk/src/states_screens/race_result_gui.hpp Modified: main/trunk/src/states_screens/race_result_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.cpp 2010-08-25 12:30:28 UTC (rev 5775) +++ main/trunk/src/states_screens/race_result_gui.cpp 2010-08-25 13:54:28 UTC (rev 5776) @@ -43,17 +43,6 @@ } // RaceResultGUI //----------------------------------------------------------------------------- -/** Destructor. */ -RaceResultGUI::~RaceResultGUI() -{ -} // ~Racegui - -//----------------------------------------------------------------------------- -void RaceResultGUI::loadedFromFile() -{ -} // loadedFromFile - -//----------------------------------------------------------------------------- /** Besides calling init in the base class this makes all buttons of this * screen invisible. The buttons will only displayed once the animation is * over. @@ -222,20 +211,6 @@ } // eventCallback //----------------------------------------------------------------------------- -/** This function is called when one of the player presses 'fire'. The next - * phase of the animation will be displayed. E.g. - * in a GP: pressing fire while/after showing the latest race result will - * start the animation for the current GP result - * in a normal race: when pressing fire while an animation is played, - * start the menu showing 'rerun, new race, back to main' etc. - */ -void RaceResultGUI::nextPhase() -{ - // This will trigger the next phase in the next render call. - // FIXME ... work in progress m_timer = 9999; -} // nextPhase - -//----------------------------------------------------------------------------- /** This determines the layout, i.e. the size of all columns, font size etc. */ void RaceResultGUI::determineTableLayout() @@ -355,6 +330,33 @@ } // determineTableLayout //----------------------------------------------------------------------------- +/** This function is called when one of the player presses 'fire'. The next + * phase of the animation will be displayed. E.g. + * in a GP: pressing fire while/after showing the latest race result will + * start the animation for the current GP result + * in a normal race: when pressing fire while an animation is played, + * start the menu showing 'rerun, new race, back to main' etc. + */ +void RaceResultGUI::nextPhase() +{ + // This will trigger the next phase in the next render call. + m_timer = 9999; +} // nextPhase + +//----------------------------------------------------------------------------- +/** If escape is pressed, don't do the default option (close the screen), but + * advance to the next animation phase. + */ +bool RaceResultGUI::onEscapePressed() +{ + nextPhase(); + return false; // indicates 'do not close' +} // onEscapePressed + +//----------------------------------------------------------------------------- +/** Called once a frame, this now triggers the rendering of the actual + * race result gui. + */ void RaceResultGUI::onUpdate(float dt, irr::video::IVideoDriver*) { renderGlobal(dt); Modified: main/trunk/src/states_screens/race_result_gui.hpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.hpp 2010-08-25 12:30:28 UTC (rev 5775) +++ main/trunk/src/states_screens/race_result_gui.hpp 2010-08-25 13:54:28 UTC (rev 5776) @@ -156,19 +156,14 @@ public: RaceResultGUI(); - virtual ~RaceResultGUI(); virtual void renderGlobal(float dt); /** \brief Implement callback from parent class GUIEngine::Screen */ - virtual void loadedFromFile(); + virtual void loadedFromFile() {}; - /** \brief implement callback from parent class GUIEngine::Screen */ - void init(); - - /** \brief implement callback from parent class GUIEngine::Screen */ - void tearDown(); - - /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void init(); + virtual void tearDown(); + virtual bool onEscapePressed(); void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-25 14:08:22
|
Revision: 5777 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5777&view=rev Author: hikerstk Date: 2010-08-25 14:08:16 +0000 (Wed, 25 Aug 2010) Log Message: ----------- Fixed incorrect animation frame in GP win/lose animations (see bug 3041529). Modified Paths: -------------- main/trunk/src/states_screens/grand_prix_lose.cpp main/trunk/src/states_screens/grand_prix_win.cpp Modified: main/trunk/src/states_screens/grand_prix_lose.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_lose.cpp 2010-08-25 13:54:28 UTC (rev 5776) +++ main/trunk/src/states_screens/grand_prix_lose.cpp 2010-08-25 14:08:16 UTC (rev 5777) @@ -241,7 +241,6 @@ if (kart != NULL) { KartModel* kart_model = kart->getKartModel(); - m_kart_x = KART_START_X; m_kart_y = KART_Y; m_kart_z = KART_Z; @@ -251,6 +250,7 @@ //kart_main_node->setScale( core::vector3df(0.4f, 0.4f, 0.4f) ); kart_main_node->updateAbsolutePosition(); kart_main_node->setRotation(vector3df(0, 90, 0)); + kart_model->setAnimation(KartModel::AF_DEFAULT); } // if kart !=NULL m_kart_node = kart_main_node; Modified: main/trunk/src/states_screens/grand_prix_win.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_win.cpp 2010-08-25 13:54:28 UTC (rev 5776) +++ main/trunk/src/states_screens/grand_prix_win.cpp 2010-08-25 14:08:16 UTC (rev 5777) @@ -414,6 +414,7 @@ assert(kart_main_node != NULL); kart_main_node->setPosition( core::vector3df(m_kart_x[n], m_kart_y[n], m_kart_z[n]) ); kart_main_node->setScale( core::vector3df(0.4f, 0.4f, 0.4f) ); + kart_model->setAnimation(KartModel::AF_DEFAULT); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-25 22:56:04
|
Revision: 5778 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5778&view=rev Author: hikerstk Date: 2010-08-25 22:55:58 +0000 (Wed, 25 Aug 2010) Log Message: ----------- Skip gp-table-resorting animation if the GP standings are unchanged, reduced time between point-increase and gp-table-resorting. Modified Paths: -------------- main/trunk/src/states_screens/race_result_gui.cpp main/trunk/src/states_screens/race_result_gui.hpp Modified: main/trunk/src/states_screens/race_result_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.cpp 2010-08-25 14:08:16 UTC (rev 5777) +++ main/trunk/src/states_screens/race_result_gui.cpp 2010-08-25 22:55:58 UTC (rev 5778) @@ -291,10 +291,8 @@ m_time_overall_scroll = (num_karts-1)*m_time_between_rows + m_time_single_scroll + 2.0f; - // The time to increase the number of points. Take the - // overall time for this phase (1 second atm) divided - // by the maximum number of points increase. - m_time_for_points = stk_config->m_scores[0]/1.0f; + // The time to increase the number of points. + m_time_for_points = 1.0f; // Determine text height r = m_font->getDimension(L"Y"); @@ -409,11 +407,28 @@ m_animation_state = RR_INCREASE_POINTS; m_timer = 0; } + break; case RR_INCREASE_POINTS: - if(m_timer > 5) + // Have one second delay before the resorting starts. + if(m_timer > 1+m_time_for_points) { m_animation_state = RR_RESORT_TABLE; - m_timer = 0; + if(m_gp_position_was_changed) + m_timer = 0; + else + // This causes the phase to go to RESORT_TABLE once, and then + // immediately wait till end. This has the advantage that any + // phase change settings will be processed properly. + m_timer = m_time_rotation+1; + // Make the new row permanent; necessary in case + // that the animation is skipped. + for(unsigned int i=0; i<num_karts; i++) + { + RowInfo *ri = &(m_all_row_infos[i]); + ri->m_new_points = 0; + ri->m_current_displayed_points = (float)ri->m_new_overall_points; + } + } break; case RR_RESORT_TABLE: @@ -455,10 +470,11 @@ } break; case RR_INCREASE_POINTS: - ri->m_current_displayed_points += dt*m_time_for_points; + ri->m_current_displayed_points += + dt*stk_config->m_scores[0]/m_time_for_points; if(ri->m_current_displayed_points>ri->m_new_overall_points) ri->m_current_displayed_points = (float)ri->m_new_overall_points; - ri->m_new_points -= dt*m_time_for_points; + ri->m_new_points -= dt*stk_config->m_scores[0]/m_time_for_points; if(ri->m_new_points<0) ri->m_new_points = 0; break; @@ -507,10 +523,12 @@ // Now update the GP ranks, and determine the new position // ------------------------------------------------------- race_manager->computeGPRanks(); + m_gp_position_was_changed = false; for(unsigned int i=0; i<num_karts; i++) { int j = old_rank[i]; int gp_position = race_manager->getKartGPRank(i); + m_gp_position_was_changed |= j!=gp_position; RowInfo *ri = &(m_all_row_infos[j]); ri->m_radius = (j-gp_position)*(int)m_distance_between_rows*0.5f; ri->m_centre_point = m_top+(gp_position+j)*m_distance_between_rows*0.5f; Modified: main/trunk/src/states_screens/race_result_gui.hpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.hpp 2010-08-25 14:08:16 UTC (rev 5777) +++ main/trunk/src/states_screens/race_result_gui.hpp 2010-08-25 22:55:58 UTC (rev 5778) @@ -144,6 +144,10 @@ /** The font to use. */ gui::ScalableFont *m_font; + /** True if a GP position was changed. If not, the point increase + * animation can be skipped. */ + bool m_gp_position_was_changed; + /** The previous monospace state of the font. */ bool m_was_monospace; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-08-26 10:17:04
|
Revision: 5783 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5783&view=rev Author: hikerstk Date: 2010-08-26 10:16:58 +0000 (Thu, 26 Aug 2010) Log Message: ----------- Added support for skipping animations by pressing 'fire'. Fixed some animations that were not skipped correctly. Modified Paths: -------------- main/trunk/src/states_screens/race_result_gui.cpp main/trunk/src/states_screens/race_result_gui.hpp Modified: main/trunk/src/states_screens/race_result_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.cpp 2010-08-26 04:23:05 UTC (rev 5782) +++ main/trunk/src/states_screens/race_result_gui.cpp 2010-08-26 10:16:58 UTC (rev 5783) @@ -84,11 +84,10 @@ top->setVisible(true); return; } - + else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) + { // In case of a GP: // ---------------- - if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) - { GUIEngine::Widget *top = getWidget("top"); top->setText( _("Continue") ); top->setVisible(true); @@ -102,20 +101,32 @@ bottom->setVisible(true); return; } + else + { + // Normal race + // ----------- + GUIEngine::Widget *top = getWidget("top"); + top->setText( _("Setup New Race") ); + top->setVisible(true); - // Normal race - // ----------- - GUIEngine::Widget *top = getWidget("top"); - top->setText( _("Setup New Race") ); - top->setVisible(true); + GUIEngine::Widget *middle = getWidget("middle"); + middle->setText( _("Restart") ); + middle->setVisible(true); - GUIEngine::Widget *middle = getWidget("middle"); - middle->setText( _("Restart") ); - middle->setVisible(true); + GUIEngine::Widget *bottom = getWidget("bottom"); + bottom->setText( _("Back to the menu") ); + bottom->setVisible(true); + } - GUIEngine::Widget *bottom = getWidget("bottom"); - bottom->setText( _("Back to the menu") ); - bottom->setVisible(true); + // FIXME: what happens if e.g. the 'abort' button has the focus (e.g. + // because the mouse cursors was at exactly that spot before it was + // hidden)? So if someone presses repeatedly 'fire', this might select + // the abort button here. Is this good enough to prevent this? + // Or should we have a way of setting the players focus (e.g. to + // the 'top' bottom, which should be the default)? The code below + // actually appears not to do anything(?) + for(unsigned int i=0; i<MAX_PLAYER_COUNT; i++) + GUIEngine::focusNothingForPlayer(i); } // enableAllButtons @@ -352,6 +363,27 @@ } // onEscapePressed //----------------------------------------------------------------------------- +/** This is called before an event is sent to a widget. Since in this case + * no widget is active, the event would be lost, so we act on fire events + * here and trigger the next phase. + */ +GUIEngine::EventPropagation RaceResultGUI::filterActions(PlayerAction action, + const unsigned int value, + Input::InputType type, + int playerId) +{ + if(action!=PA_FIRE) return GUIEngine::EVENT_LET; + + // If the buttons are already visible, let the event go through since + // it will be triggering eventCallback where this is handles. + + if(m_animation_state == RR_WAIT_TILL_END) return GUIEngine::EVENT_LET; + + nextPhase(); + return GUIEngine::EVENT_BLOCK; +} // filterActions + +//----------------------------------------------------------------------------- /** Called once a frame, this now triggers the rendering of the actual * race result gui. */ @@ -406,6 +438,11 @@ { m_animation_state = RR_INCREASE_POINTS; m_timer = 0; + for(unsigned int i=0; i<num_karts; i++) + { + RowInfo *ri = &(m_all_row_infos[i]); + ri->m_x_pos = (float)m_leftmost_column; + } } break; case RR_INCREASE_POINTS: @@ -469,7 +506,7 @@ x = ri->m_x_pos; } break; - case RR_INCREASE_POINTS: + case RR_INCREASE_POINTS: ri->m_current_displayed_points += dt*stk_config->m_scores[0]/m_time_for_points; if(ri->m_current_displayed_points>ri->m_new_overall_points) Modified: main/trunk/src/states_screens/race_result_gui.hpp =================================================================== --- main/trunk/src/states_screens/race_result_gui.hpp 2010-08-26 04:23:05 UTC (rev 5782) +++ main/trunk/src/states_screens/race_result_gui.hpp 2010-08-26 10:16:58 UTC (rev 5783) @@ -168,9 +168,13 @@ virtual void init(); virtual void tearDown(); virtual bool onEscapePressed(); + virtual GUIEngine::EventPropagation + filterActions(PlayerAction action, const unsigned int value, + Input::InputType type, int playerId); void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); + friend class GUIEngine::ScreenSingleton<RaceResultGUI>; /** Should not be called anymore. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xa...@us...> - 2010-08-31 09:12:24
|
Revision: 5834 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5834&view=rev Author: xapantu Date: 2010-08-31 09:12:18 +0000 (Tue, 31 Aug 2010) Log Message: ----------- Fix the problem with the thread that tried to access to a screen that could be deleted Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp main/trunk/src/states_screens/main_menu_screen.hpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-08-31 01:48:52 UTC (rev 5833) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-08-31 09:12:18 UTC (rev 5834) @@ -114,8 +114,7 @@ input_manager->setMasterPlayerOnly(false); #ifdef ADDONS_MANAGER pthread_mutex_init(&(this->m_mutex_news_text), NULL); - pthread_t nThreadID2; - pthread_create(&nThreadID2, NULL, &MainMenuScreen::downloadNews, this); + pthread_create(&m_thread_news_text, NULL, &MainMenuScreen::downloadNews, this); #endif } @@ -243,3 +242,10 @@ } #endif // ------------------------------------------------------------------------------------------------------ +#ifdef ADDONS_MANAGER +MainMenuScreen::~MainMenuScreen() +{ + fprintf(stdout, "canceling the thread"); + pthread_cancel(m_thread_news_text); +} +#endif Modified: main/trunk/src/states_screens/main_menu_screen.hpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.hpp 2010-08-31 01:48:52 UTC (rev 5833) +++ main/trunk/src/states_screens/main_menu_screen.hpp 2010-08-31 09:12:18 UTC (rev 5834) @@ -35,6 +35,8 @@ #ifdef ADDONS_MANAGER void changeNewsText(std::string action); pthread_mutex_t m_mutex_news_text; + pthread_t m_thread_news_text; + ~MainMenuScreen(); std::string m_news_text; void onUpdate(float delta, irr::video::IVideoDriver* driver); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-09-05 00:10:38
|
Revision: 5891 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5891&view=rev Author: auria Date: 2010-09-05 00:10:31 +0000 (Sun, 05 Sep 2010) Log Message: ----------- Removed many abuses of the all-inclusive widgets.hpp header Modified Paths: -------------- main/trunk/src/states_screens/dialogs/enter_player_name_dialog.cpp main/trunk/src/states_screens/dialogs/player_info_dialog.cpp main/trunk/src/states_screens/dialogs/press_a_key_dialog.cpp main/trunk/src/states_screens/dialogs/race_paused_dialog.cpp main/trunk/src/states_screens/dialogs/track_info_dialog.cpp main/trunk/src/states_screens/kart_selection.cpp main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/dialogs/enter_player_name_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/enter_player_name_dialog.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/dialogs/enter_player_name_dialog.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -19,7 +19,9 @@ #include "audio/sfx_manager.hpp" #include "guiengine/engine.hpp" -#include "guiengine/widgets.hpp" +#include "guiengine/widgets/button_widget.hpp" +#include "guiengine/widgets/label_widget.hpp" +#include "guiengine/widgets/text_box_widget.hpp" #include "states_screens/options_screen_players.hpp" #include "states_screens/state_manager.hpp" #include "utils/translation.hpp" Modified: main/trunk/src/states_screens/dialogs/player_info_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/player_info_dialog.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/dialogs/player_info_dialog.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -19,8 +19,9 @@ #include "config/player.hpp" #include "guiengine/engine.hpp" +#include "guiengine/widgets/button_widget.hpp" #include "guiengine/scalable_font.hpp" -#include "guiengine/widgets.hpp" +#include "guiengine/widgets/text_box_widget.hpp" #include "states_screens/options_screen_players.hpp" #include "states_screens/state_manager.hpp" #include "utils/string_utils.hpp" Modified: main/trunk/src/states_screens/dialogs/press_a_key_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/press_a_key_dialog.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/dialogs/press_a_key_dialog.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -17,7 +17,6 @@ #include "guiengine/engine.hpp" -#include "guiengine/widgets.hpp" #include "input/input.hpp" #include "input/input_manager.hpp" #include "states_screens/dialogs/press_a_key_dialog.hpp" Modified: main/trunk/src/states_screens/dialogs/race_paused_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/race_paused_dialog.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/dialogs/race_paused_dialog.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -21,7 +21,8 @@ #include "guiengine/engine.hpp" #include "guiengine/scalable_font.hpp" -#include "guiengine/widgets.hpp" +#include "guiengine/widgets/icon_button_widget.hpp" +#include "guiengine/widgets/ribbon_widget.hpp" #include "input/input_manager.hpp" #include "io/file_manager.hpp" #include "modes/world.hpp" Modified: main/trunk/src/states_screens/dialogs/track_info_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -18,7 +18,8 @@ #include "graphics/irr_driver.hpp" #include "guiengine/engine.hpp" #include "guiengine/screen.hpp" -#include "guiengine/widgets.hpp" +#include "guiengine/widgets/button_widget.hpp" +#include "guiengine/widgets/icon_button_widget.hpp" #include "io/file_manager.hpp" #include "karts/kart_properties_manager.hpp" #include "network/network_manager.hpp" Modified: main/trunk/src/states_screens/kart_selection.cpp =================================================================== --- main/trunk/src/states_screens/kart_selection.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/kart_selection.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -24,7 +24,11 @@ #include "graphics/irr_driver.hpp" #include "guiengine/engine.hpp" #include "guiengine/screen.hpp" -#include "guiengine/widgets.hpp" +#include "guiengine/widgets/dynamic_ribbon_widget.hpp" +#include "guiengine/widgets/label_widget.hpp" +#include "guiengine/widgets/model_view_widget.hpp" +#include "guiengine/widgets/ribbon_widget.hpp" +#include "guiengine/widgets/spinner_widget.hpp" #include "input/input.hpp" #include "input/input_manager.hpp" #include "input/device_manager.hpp" Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-04 23:55:32 UTC (rev 5890) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-05 00:10:31 UTC (rev 5891) @@ -23,11 +23,11 @@ //# include <pthread.h> //#endif -#include "guiengine/widgets.hpp" +#include "guiengine/widgets/ribbon_widget.hpp" +#include "input/device_manager.hpp" +#include "input/input_manager.hpp" #include "karts/kart_properties_manager.hpp" #include "main_loop.hpp" -#include "input/device_manager.hpp" -#include "input/input_manager.hpp" #include "states_screens/challenges.hpp" #include "states_screens/credits.hpp" #include "states_screens/kart_selection.hpp" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-09-09 12:26:42
|
Revision: 5949 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5949&view=rev Author: hikerstk Date: 2010-09-09 12:26:36 +0000 (Thu, 09 Sep 2010) Log Message: ----------- Fixed crash in new KartModel handling in unlocked features. Modified Paths: -------------- main/trunk/src/states_screens/feature_unlocked.cpp main/trunk/src/states_screens/feature_unlocked.hpp Modified: main/trunk/src/states_screens/feature_unlocked.cpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.cpp 2010-09-09 12:19:06 UTC (rev 5948) +++ main/trunk/src/states_screens/feature_unlocked.cpp 2010-09-09 12:26:36 UTC (rev 5949) @@ -189,12 +189,15 @@ if (unlockedStuffCount == 0) std::cerr << "There is nothing in the unlock chest!!!\n"; + m_all_kart_models.clear(); for (int n=0; n<unlockedStuffCount; n++) { if (m_unlocked_stuff[n].m_unlocked_kart != NULL) { - KartModel* kart_model = - m_unlocked_stuff[n].m_unlocked_kart->getKartModel(); + m_all_kart_models.push_back( + (*m_unlocked_stuff[n].m_unlocked_kart->getKartModel()) + ); + KartModel *kart_model = &(m_all_kart_models.back()); kart_model->attachModel(&(m_unlocked_stuff[n].m_root_gift_node)); #ifdef DEBUG m_unlocked_stuff[n].m_root_gift_node->setName("unlocked kart"); @@ -202,7 +205,7 @@ #ifdef USE_IRRLICHT_BUG_WORKAROUND // If a mesh with this material is added, irrlicht will // display the 'continue' text (otherwise the text is - // not visible). This is a terrible work around, but + // not visible). This is a terrible work around, but allows // stk to be released without waiting for the next // irrlicht version. video::SMaterial m; @@ -268,6 +271,7 @@ #endif m_unlocked_stuff.clearAndDeleteAll(); + m_all_kart_models.clear(); } // tearDown // ---------------------------------------------------------------------------- Modified: main/trunk/src/states_screens/feature_unlocked.hpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.hpp 2010-09-09 12:19:06 UTC (rev 5948) +++ main/trunk/src/states_screens/feature_unlocked.hpp 2010-09-09 12:26:36 UTC (rev 5949) @@ -57,9 +57,12 @@ ~UnlockedThing(); }; + + /** The list of all unlocked things. */ ptr_vector<UnlockedThing, HOLD> m_unlocked_stuff; - + /** To store the copy of the KartModel for each unlocked kart. */ + std::vector<KartModel> m_all_kart_models; /** sky angle, 0-360 */ float m_sky_angle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-09-18 22:26:19
|
Revision: 6051 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6051&view=rev Author: auria Date: 2010-09-18 22:26:13 +0000 (Sat, 18 Sep 2010) Log Message: ----------- Try to fix add-ons related crash at exit Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp main/trunk/src/states_screens/main_menu_screen.hpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-18 22:05:51 UTC (rev 6050) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-18 22:26:13 UTC (rev 6051) @@ -245,7 +245,7 @@ #endif // ------------------------------------------------------------------------------------------------------ #ifdef ADDONS_MANAGER -MainMenuScreen::~MainMenuScreen() +void MainMenuScreen::tearDown() { fprintf(stdout, "canceling the thread"); pthread_cancel(m_thread_news_text); Modified: main/trunk/src/states_screens/main_menu_screen.hpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.hpp 2010-09-18 22:05:51 UTC (rev 6050) +++ main/trunk/src/states_screens/main_menu_screen.hpp 2010-09-18 22:26:13 UTC (rev 6051) @@ -36,10 +36,12 @@ void changeNewsText(std::string action); pthread_mutex_t m_mutex_news_text; pthread_t m_thread_news_text; - ~MainMenuScreen(); + std::string m_news_text; - void onUpdate(float delta, irr::video::IVideoDriver* driver); + virtual void onUpdate(float delta, irr::video::IVideoDriver* driver); + virtual void tearDown(); #endif + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-09-23 03:14:00
|
Revision: 6118 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6118&view=rev Author: hikerstk Date: 2010-09-23 03:13:54 +0000 (Thu, 23 Sep 2010) Log Message: ----------- Fixed crash in case that not enough AI are selected in a FTL race (now there will be at least three karts in a FTL race). Modified Paths: -------------- main/trunk/src/states_screens/dialogs/track_info_dialog.cpp main/trunk/src/states_screens/race_setup_screen.cpp Modified: main/trunk/src/states_screens/dialogs/track_info_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-09-22 19:43:05 UTC (rev 6117) +++ main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-09-23 03:13:54 UTC (rev 6118) @@ -297,9 +297,7 @@ race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE); race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge - //race_manager->setNumKarts( 1 ); network_manager->setupPlayerKartInfo(); - //race_manager->getKartType(1) = KT_PLAYER; race_manager->startNew(); } Modified: main/trunk/src/states_screens/race_setup_screen.cpp =================================================================== --- main/trunk/src/states_screens/race_setup_screen.cpp 2010-09-22 19:43:05 UTC (rev 6117) +++ main/trunk/src/states_screens/race_setup_screen.cpp 2010-09-23 03:13:54 UTC (rev 6118) @@ -107,6 +107,10 @@ } else if (selectedMode == "ftl") { + // Make sure there are at least three karts, otherwise FTL doesn't + if(race_manager->getNumberOfKarts()<3) + race_manager->setNumKarts(3); + race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER); StateManager::get()->pushScreen( TracksScreen::getInstance() ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-10-19 21:49:26
|
Revision: 6314 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6314&view=rev Author: hikerstk Date: 2010-10-19 21:49:19 +0000 (Tue, 19 Oct 2010) Log Message: ----------- Fixed splitsceen display: energy bar was moved down a bit, lap and rank display are now on top of the energy bar (and just under the time). Removed 'finished' display if the race is finished. Modified Paths: -------------- main/trunk/src/states_screens/race_gui.cpp main/trunk/src/states_screens/race_gui.hpp Modified: main/trunk/src/states_screens/race_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_gui.cpp 2010-10-19 20:35:18 UTC (rev 6313) +++ main/trunk/src/states_screens/race_gui.cpp 2010-10-19 21:49:19 UTC (rev 6314) @@ -52,9 +52,7 @@ * created, so only the race manager can be accessed safely. */ RaceGUI::RaceGUI() -{ - m_map_right_side_x = 0; - +{ // Originally m_map_height was 100, and we take 480 as minimum res const float scaling = irr_driver->getFrameSize().Height / 480.0f; // Marker texture has to be power-of-two for (old) OpenGL compliance @@ -65,7 +63,6 @@ m_map_height = (int)(100.0f * scaling); m_map_left = (int)( 10.0f * scaling); m_map_bottom = (int)( 10.0f * scaling); - m_minimap_on_left = true; // Minimap is also rendered bigger via OpenGL, so find power-of-two again const int map_texture = 2 << ((int) ceil(1.0 + log(128.0 * scaling))); @@ -79,7 +76,6 @@ if (race_manager->getNumLocalPlayers() == 3) { m_map_left = UserConfigParams::m_width - m_map_width; - m_minimap_on_left = false; } m_speed_meter_icon = material_manager->getMaterial("speedback.png"); @@ -91,7 +87,6 @@ // Translate strings only one in constructor to avoid calling // gettext in each frame. //I18N: Shown at the end of a race - m_string_finished = _("Finished"); m_string_lap = _("Lap"); m_string_rank = _("Rank"); @@ -107,7 +102,26 @@ //read icon frame picture m_icons_frame=material_manager->getMaterial("icons-frame.png"); - + + // 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; + int w;font->getDimension(L"99/99").Width; + if(race_manager->getNumLaps()>9) + w = 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; + + } // RaceGUI //----------------------------------------------------------------------------- @@ -324,10 +338,8 @@ RaceGUI::KartIconDisplayInfo* info = World::getWorld()->getKartsDisplayInfo(); drawPowerupIcons (kart, viewport, scaling); - drawEnergyMeter (kart, viewport, scaling); - drawSpeed (kart, viewport, scaling); - drawLap (info, kart, viewport); - drawRank (info, kart, viewport); + drawSpeedAndEnergy (kart, viewport, scaling); + drawRankLap (info, kart, viewport); } // renderPlayerView @@ -354,7 +366,7 @@ gui::ScalableFont* font = GUIEngine::getFont(); font->draw(sw.c_str(), pos, time_color); -} // DRAWGLOBALTimer +} // drawGlobalTimer //----------------------------------------------------------------------------- /** Draws the mini map and the position of all karts on it. @@ -374,7 +386,6 @@ m_map_left + m_map_width, lower_y); core::rect<s32> source(core::position2di(0, 0), mini_map->getOriginalSize()); irr_driver->getVideoDriver()->draw2DImage(mini_map, dest, source, 0, 0, true); - m_map_right_side_x = dest.LowerRightCorner.X; for(unsigned int i=0; i<world->getNumKarts(); i++) { @@ -702,19 +713,28 @@ } // drawPowerupIcons //----------------------------------------------------------------------------- -/* Energy meter that gets filled with coins */ -void RaceGUI::drawEnergyMeter (const Kart *kart, - const core::recti &viewport, - const core::vector2df &scaling) +/** Energy meter that gets filled with nitro. This function is called from + * drawSpeedAndEnergy, which defines the correct position of the energy + * meter. + * \param x X position of the meter. + * \param y Y position of the meter. + * \param kart Kart to display the data for. + * \param scaling Scaling applied (in case of split screen) + */ +void RaceGUI::drawEnergyMeter(int x, int y, const Kart *kart, + const core::recti &viewport, + const core::vector2df &scaling) { float state = (float)(kart->getEnergy()) / MAX_ITEMS_COLLECTED; - //int y = (int)(250 * scaling.Y) + viewport.UpperLeftCorner.Y; - int w = (int)(16 * scaling.X); + // Don't scale width, it looks too small otherwise + int w = 16; int h = (int)(viewport.getHeight()/3); - - int x = viewport.LowerRightCorner.X - w - 5; - int y = viewport.LowerRightCorner.Y - (int)(250 * scaling.Y); + // Move energy bar slighty 'into' the speedometer. Leave 10 points + // between right edge of viewport and energy meter, and don't scale. + x -= w+10; + y -= (int)(30*scaling.Y); + float coin_target = (float)race_manager->getCoinTarget(); int th = (int)(h*(coin_target/MAX_ITEMS_COLLECTED)); @@ -766,8 +786,8 @@ } // drawEnergyMeter //----------------------------------------------------------------------------- -void RaceGUI::drawSpeed(const Kart* kart, const core::recti &viewport, - const core::vector2df &scaling) +void RaceGUI::drawSpeedAndEnergy(const Kart* kart, const core::recti &viewport, + const core::vector2df &scaling) { float minRatio = std::min(scaling.X, scaling.Y); @@ -775,9 +795,14 @@ int meter_width = (int)(SPEEDWIDTH*minRatio); int meter_height = (int)(SPEEDWIDTH*minRatio); core::vector2df offset; - offset.X = (float)(viewport.LowerRightCorner.X-meter_width) - 10.0f*scaling.X; + offset.X = (float)(viewport.LowerRightCorner.X-meter_width) - 15.0f*scaling.X; offset.Y = viewport.LowerRightCorner.Y-10*scaling.Y; + + drawEnergyMeter(viewport.LowerRightCorner.X, + viewport.LowerRightCorner.Y - meter_height, kart, + viewport, scaling); + // First draw the meter (i.e. the background which contains the numbers etc. // ------------------------------------------------------------------------- video::IVideoDriver *video = irr_driver->getVideoDriver(); @@ -873,133 +898,67 @@ } // drawSpeed //----------------------------------------------------------------------------- -void RaceGUI::drawLap(const KartIconDisplayInfo* info, const Kart* kart, - const core::recti &viewport) +/** Displays the rank and the lap of the kart. + * \param info Info object c +*/ +void RaceGUI::drawRankLap(const KartIconDisplayInfo* info, const Kart* kart, + const core::recti &viewport) { - // Don't display laps in follow the leader mode - if(!World::getWorld()->raceHasLaps()) return; - - const int lap = info[kart->getWorldKartId()].lap; - - if(lap<0) return; // don't display 'lap 0/...' + // Don't display laps or ranks if the kart has already finished the race. + if (kart->hasFinishedRace()) return; core::recti pos; - pos.UpperLeftCorner.Y = viewport.LowerRightCorner.Y; - - // place lap count somewhere on the left of the screen - if (m_minimap_on_left) - { - // check if mini-map is within Y coords of this player. - // if the mini-map is not even in the viewport of this player, don't - // bother placing the lap text at the right of the minimap. - if (UserConfigParams::m_height - m_map_bottom - m_map_height - > viewport.LowerRightCorner.Y) - { - pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X - + (int)(0.1f*UserConfigParams::m_width); - } - else - { - // place lap text at the right of the mini-map - const int calculated_x = viewport.UpperLeftCorner.X - + (int)(0.05f*UserConfigParams::m_width); - // don't overlap minimap - pos.UpperLeftCorner.X = std::max(calculated_x, - m_map_right_side_x + 15); - } - } - else - { - // mini-map is on the right, and lap text on right, - // so no overlap possible - pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X - + (int)(0.05f*UserConfigParams::m_width); - } - + pos.UpperLeftCorner.Y = viewport.UpperLeftCorner.Y; + // If the time display in the top right is in this viewport, + // move the lap/rank display down a little bit so that it is + // displayed under the time. + 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.X = viewport.LowerRightCorner.X + - m_rank_lap_width-10; + pos.LowerRightCorner.X = viewport.LowerRightCorner.X; gui::ScalableFont* font = GUIEngine::getFont(); int font_height = (int)(font->getDimension(L"X").Height); - - if (!kart->hasFinishedRace()) - { - static video::SColor color = video::SColor(255, 255, 255, 255); - pos.UpperLeftCorner.Y -= 3*font_height; - pos.LowerRightCorner = pos.UpperLeftCorner; - 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); - } -} // drawLap - -//----------------------------------------------------------------------------- -void RaceGUI::drawRank(const KartIconDisplayInfo* info, const Kart* kart, - const core::recti &viewport) -{ + static video::SColor color = video::SColor(255, 255, 255, 255); WorldWithRank *world = (WorldWithRank*)(World::getWorld()); + 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->getNumKarts(); - - core::recti pos; - pos.UpperLeftCorner.Y = viewport.LowerRightCorner.Y; + 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; - // place rank string somewhere on the left of the screen - if (m_minimap_on_left) + // Don't display laps in follow the leader mode + if(world->raceHasLaps()) { - // check if mini-map is within Y coords of this player. - // if the mini-map is not even in the viewport of this player, don't - // bother placing the lap text at the right of the minimap. - if (UserConfigParams::m_height - m_map_bottom - m_map_height - > viewport.LowerRightCorner.Y) + const int lap = info[kart->getWorldKartId()].lap; + + // don't display 'lap 0/...' + if(lap>=0) { - pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X - + (int)(0.1f*UserConfigParams::m_width); + 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; } - else - { - // place lap text at the right of the mini-map - const int calculated_x = viewport.UpperLeftCorner.X - + (int)(0.05f*UserConfigParams::m_width); - // don't overlap minimap - pos.UpperLeftCorner.X = std::max(calculated_x, - m_map_right_side_x + 15); - } } - else - { - // mini-map is on the right, and lap text on right, - // so no overlap possible - pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X - + (int)(0.05f*UserConfigParams::m_width); - } - - gui::ScalableFont* font = GUIEngine::getFont(); - int font_height = (int)(font->getDimension(L"X").Height); - - if (kart->hasFinishedRace()) - { - static video::SColor color = video::SColor(255, 255, 255, 255); - pos.UpperLeftCorner.Y -= (2+2)*font_height; - pos.LowerRightCorner = pos.UpperLeftCorner; - font->draw(m_string_finished.c_str(), pos, color); - } - else - { - static video::SColor color = video::SColor(255, 255, 255, 255); - pos.UpperLeftCorner.Y -= (3+2)*font_height; - pos.LowerRightCorner = pos.UpperLeftCorner; - font->draw(m_string_rank.c_str(), pos, color); - - char str[256]; - sprintf(str, "%d/%d", rank, kart_amount); - pos.UpperLeftCorner.Y += font_height; - pos.LowerRightCorner.Y += font_height; - font->draw(core::stringw(str).c_str(), pos, color); - } -} // drawRank +} // drawRankLap + //----------------------------------------------------------------------------- /** Removes messages which have been displayed long enough. This function * must be called after drawAllMessages, otherwise messages which are only Modified: main/trunk/src/states_screens/race_gui.hpp =================================================================== --- main/trunk/src/states_screens/race_gui.hpp 2010-10-19 20:35:18 UTC (rev 6313) +++ main/trunk/src/states_screens/race_gui.hpp 2010-10-19 21:49:19 UTC (rev 6314) @@ -88,9 +88,6 @@ /** Musical notes icon (for music description and credits) */ Material *m_music_icon; - /** Translated string of 'finished' message. */ - core::stringw m_string_finished; - /** Translated string 'lap' displayed every frame. */ core::stringw m_string_lap; @@ -108,10 +105,6 @@ /** The mini map of the track. */ video::ITexture *m_mini_map; - /** used to render lap count next to the map without overlap */ - int m_map_right_side_x; - bool m_minimap_on_left; - /** The size of a single marker in pixels, must be a power of 2. */ int m_marker_rendered_size; @@ -144,7 +137,10 @@ /** Used to display messages without overlapping */ int m_max_font_height; int m_small_font_max_height; - + /** 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; + /** Distance on track to begin showing overlap in drawGlobalPlayerIcons */ float m_dist_show_overlap;///can be zero float m_icons_inertia;///can be zero @@ -159,7 +155,7 @@ video::S3DVertex *v, unsigned short int *index); /* Display informat for one player on the screen. */ - void drawEnergyMeter (const Kart *kart, + void drawEnergyMeter (int x, int y, const Kart *kart, const core::recti &viewport, const core::vector2df &scaling); void drawPowerupIcons (const Kart* kart, @@ -168,12 +164,10 @@ void drawAllMessages (const Kart* kart, const core::recti &viewport, const core::vector2df &scaling); - void drawSpeed (const Kart* kart, const core::recti &viewport, + void drawSpeedAndEnergy (const Kart* kart, const core::recti &viewport, const core::vector2df &scaling); - void drawLap (const KartIconDisplayInfo* info, const Kart* kart, + void drawRankLap (const KartIconDisplayInfo* info, const Kart* kart, const core::recti &viewport); - void drawRank (const KartIconDisplayInfo* info, const Kart* kart, - const core::recti &viewport); void drawGlobalPlayerIcons (const KartIconDisplayInfo* info); /** Display items that are shown once only (for all karts). */ void drawGlobalMiniMap (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-11-09 16:00:27
|
Revision: 6480 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6480&view=rev Author: auria Date: 2010-11-09 16:00:21 +0000 (Tue, 09 Nov 2010) Log Message: ----------- Remove unused code + fixed wrong animation frame used on feature unlocked screen + fixed karts looking left on GP lose screen Modified Paths: -------------- main/trunk/src/states_screens/feature_unlocked.cpp main/trunk/src/states_screens/grand_prix_lose.cpp main/trunk/src/states_screens/grand_prix_lose.hpp Modified: main/trunk/src/states_screens/feature_unlocked.cpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.cpp 2010-11-09 14:52:07 UTC (rev 6479) +++ main/trunk/src/states_screens/feature_unlocked.cpp 2010-11-09 16:00:21 UTC (rev 6480) @@ -198,6 +198,10 @@ m_unlocked_stuff[n].m_unlocked_kart->getKartModelCopy(); m_all_kart_models.push_back(kart_model); kart_model->attachModel(&(m_unlocked_stuff[n].m_root_gift_node)); + kart_model->setAnimation(KartModel::AF_DEFAULT); + float susp[4]={0,0,0,0}; + kart_model->update(0.0f, 0.0f, susp); + #ifdef DEBUG m_unlocked_stuff[n].m_root_gift_node->setName("unlocked kart"); #endif Modified: main/trunk/src/states_screens/grand_prix_lose.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_lose.cpp 2010-11-09 14:52:07 UTC (rev 6479) +++ main/trunk/src/states_screens/grand_prix_lose.cpp 2010-11-09 16:00:21 UTC (rev 6480) @@ -295,11 +295,14 @@ kart_main_node->updateAbsolutePosition(); kart_main_node->setRotation(vector3df(0, 90, 0)); kart_model->setAnimation(KartModel::AF_DEFAULT); + float susp[4]={0,0,0,0}; + kart_model->update(0.0f, 0.0f, susp); } // if kart !=NULL m_kart_node[n] = kart_main_node; } + /* const int w = UserConfigParams::m_width; const int h = UserConfigParams::m_height; @@ -330,6 +333,7 @@ default: assert(false); } + */ } // setKarts Modified: main/trunk/src/states_screens/grand_prix_lose.hpp =================================================================== --- main/trunk/src/states_screens/grand_prix_lose.hpp 2010-11-09 14:52:07 UTC (rev 6479) +++ main/trunk/src/states_screens/grand_prix_lose.hpp 2010-11-09 16:00:21 UTC (rev 6480) @@ -49,7 +49,7 @@ MusicInformation* m_music; - irr::core::recti m_viewport[4]; + //irr::core::recti m_viewport[4]; public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xa...@us...> - 2010-11-09 16:53:59
|
Revision: 6481 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6481&view=rev Author: xapantu Date: 2010-11-09 16:53:53 +0000 (Tue, 09 Nov 2010) Log Message: ----------- [Addons] Download the news text directly in a string, we don't need a tmp file anymore, it was dirty Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp main/trunk/src/states_screens/main_menu_screen.hpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-11-09 16:00:21 UTC (rev 6480) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-11-09 16:53:53 UTC (rev 6481) @@ -61,36 +61,18 @@ } #endif #ifdef ADDONS_MANAGER -void MainMenuScreen::changeNewsText(std::string action) +void MainMenuScreen::changeNewsText(std::string action, std::string content) { if(action == "news") - { - FILE* newsFile = NULL; - char buffer[1024] = ""; - + { pthread_testcancel(); // check if thread was cancelled // enter the mutex; this will prevent the shutdown procedure // from continuing until this critical section is over pthread_mutex_lock(&(this->m_mutex_news_text)); - - newsFile = fopen(std::string(file_manager->getConfigDir() + "/news").c_str(), "r+"); - - if (newsFile == NULL) - { - fprintf(stderr, "Warning: cannot open news files\n"); - return; - } - - std::string info = std::string(""); - while (fgets(buffer, 1024, newsFile) != NULL) - { - info += std::string(buffer); - } - fclose(newsFile); - - m_news_text = std::string(info).c_str(); + m_news_text = content; + pthread_mutex_unlock(&(this->m_mutex_news_text)); } if(action == "offline") @@ -248,16 +230,19 @@ // FIXME: this code is wrong, "pt" might have been deleted by the // time the download is done (by having switched to another screen, // or exiting the game, etc...) - MainMenuScreen * pt = (MainMenuScreen*)pthis; - - if (download("news")) + //MainMenuScreen * pt = (MainMenuScreen*)pthis; + + std::string news = network_http->downloadToStr("news"); + if (news != "") { pthread_testcancel(); // check if thread was cancelled - pt->changeNewsText("news"); + MainMenuScreen * pt = (MainMenuScreen*)pthis; + pt->changeNewsText("news", news); } else { pthread_testcancel(); // check if thread was cancelled + MainMenuScreen * pt = (MainMenuScreen*)pthis; pt->changeNewsText("offline"); } return NULL; Modified: main/trunk/src/states_screens/main_menu_screen.hpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.hpp 2010-11-09 16:00:21 UTC (rev 6480) +++ main/trunk/src/states_screens/main_menu_screen.hpp 2010-11-09 16:53:53 UTC (rev 6481) @@ -33,7 +33,7 @@ public: #ifdef ADDONS_MANAGER - void changeNewsText(std::string action); + void changeNewsText(std::string action, std::string content=""); pthread_mutex_t m_mutex_news_text; pthread_t m_thread_news_text; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-11-09 16:56:13
|
Revision: 6482 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6482&view=rev Author: auria Date: 2010-11-09 16:56:07 +0000 (Tue, 09 Nov 2010) Log Message: ----------- Fixed shiny elephant on GP win screen by reducing sun intensity Modified Paths: -------------- main/trunk/src/states_screens/grand_prix_win.cpp main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/grand_prix_win.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_win.cpp 2010-11-09 16:53:53 UTC (rev 6481) +++ main/trunk/src/states_screens/grand_prix_win.cpp 2010-11-09 16:56:07 UTC (rev 6482) @@ -188,14 +188,15 @@ m_podium_step[2]->setPosition( core::vector3df(m_podium_x[2], INITIAL_PODIUM_Y, m_podium_z[2]) ); scene::ISceneManager* sceneManager = irr_driver->getSceneManager(); - sceneManager->setAmbientLight(video::SColor(255, 120, 120, 120)); + sceneManager->setAmbientLight(video::SColor(255, 95, 95, 95)); const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f ); m_light = irr_driver->getSceneManager()->addLightSceneNode(NULL, sun_pos, - video::SColorf(1.0f,1.0f,1.0f), + video::SColorf(0.25f,0.25f,0.25f), 300.0f /* radius */); - m_light->getLightData().DiffuseColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f); - m_light->getLightData().SpecularColor = irr::video::SColorf(1.0f, 0.0f, 0.0f, 0.0f); + m_light->getLightData().DiffuseColor = irr::video::SColorf(0.25f, 0.25f, 0.25f, 1.0f); + m_light->getLightData().AmbientColor = irr::video::SColorf(0.25f, 0.25f, 0.25f, 1.0f); + m_light->getLightData().SpecularColor = irr::video::SColorf(0.0f, 0.0f, 0.0f, 1.0f); sfx_manager->quickSound("winner"); } // init Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-11-09 16:53:53 UTC (rev 6481) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-11-09 16:56:07 UTC (rev 6482) @@ -169,7 +169,7 @@ else if (i % 4 == 2) { GrandPrixWin* scene = GrandPrixWin::getInstance(); - const std::string winners[] = { "tux", "nolok", "pidgin" }; + const std::string winners[] = { "elephpant", "nolok", "pidgin" }; StateManager::get()->pushScreen(scene); scene->setKarts( winners ); } @@ -179,7 +179,7 @@ StateManager::get()->pushScreen(scene); std::vector<std::string> losers; losers.push_back("nolok"); - losers.push_back("tux"); + losers.push_back("elephpant"); losers.push_back("wilber"); scene->setKarts( losers ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xa...@us...> - 2010-11-09 17:22:05
|
Revision: 6484 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6484&view=rev Author: xapantu Date: 2010-11-09 17:21:58 +0000 (Tue, 09 Nov 2010) Log Message: ----------- [Addons] an addon object isn't passed to the dialog anymore, it is stupid since addons_manager is extern. Modified Paths: -------------- main/trunk/src/states_screens/addons_screen.cpp main/trunk/src/states_screens/addons_update_screen.cpp main/trunk/src/states_screens/dialogs/addons_loading.cpp main/trunk/src/states_screens/dialogs/addons_loading.hpp Modified: main/trunk/src/states_screens/addons_screen.cpp =================================================================== --- main/trunk/src/states_screens/addons_screen.cpp 2010-11-09 17:04:58 UTC (rev 6483) +++ main/trunk/src/states_screens/addons_screen.cpp 2010-11-09 17:21:58 UTC (rev 6484) @@ -106,7 +106,7 @@ std::string addons = list->getSelectionInternalName(); addons_manager->SelectId(addons); - this->load = new AddonsLoading(addons_manager, 0.8f, 0.8f); + this->load = new AddonsLoading(0.8f, 0.8f); } if (name == "category") { Modified: main/trunk/src/states_screens/addons_update_screen.cpp =================================================================== --- main/trunk/src/states_screens/addons_update_screen.cpp 2010-11-09 17:04:58 UTC (rev 6483) +++ main/trunk/src/states_screens/addons_update_screen.cpp 2010-11-09 17:21:58 UTC (rev 6484) @@ -62,7 +62,7 @@ std::string addons = list->getSelectionInternalName(); addons_manager->SelectId(addons); - this->load = new AddonsLoading(addons_manager, 0.8f, 0.8f); + this->load = new AddonsLoading(0.8f, 0.8f); } else if (name == "category") { Modified: main/trunk/src/states_screens/dialogs/addons_loading.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/addons_loading.cpp 2010-11-09 17:04:58 UTC (rev 6483) +++ main/trunk/src/states_screens/dialogs/addons_loading.cpp 2010-11-09 17:21:58 UTC (rev 6484) @@ -37,11 +37,10 @@ // ------------------------------------------------------------------------------------------------------ -AddonsLoading::AddonsLoading(Addons * id, const float w, const float h) : +AddonsLoading::AddonsLoading(const float w, const float h) : ModalDialog(w, h) { loadFromFile("addons_view_dialog.stkgui"); - this->addons = id; m_can_install = false; m_can_load_icon = false; m_percent_update = false; @@ -56,7 +55,7 @@ version = this->getWidget<LabelWidget>("version"); - if(this->addons->IsInstalledAsBool()) + if(addons_manager->IsInstalledAsBool()) { if(addons_manager->GetInstalledVersion() < addons_manager->GetVersion()) this->getWidget<ButtonWidget>("install")->setLabel(_("Update")); @@ -68,27 +67,18 @@ } void AddonsLoading::loadInfo() { - - - /*I think we can wait a little to have the icon ?*/ - - - - name->setText(StringUtils::insertValues(_("Name: %i"), this->addons->GetName().c_str())); - description->setText(StringUtils::insertValues(_("Description: %i"), this->addons->GetDescription().c_str())); - version->setText(StringUtils::insertValues(_("Version: %i"), this->addons->GetVersionAsStr().c_str())); + name->setText(StringUtils::insertValues(_("Name: %i"), addons_manager->GetName().c_str())); + description->setText(StringUtils::insertValues(_("Description: %i"), addons_manager->GetDescription().c_str())); + version->setText(StringUtils::insertValues(_("Version: %i"), addons_manager->GetVersionAsStr().c_str())); pthread_t thread; pthread_create(&thread, NULL, &AddonsLoading::downloadIcon, this); - - - } // ------------------------------------------------------------------------------------------------------ void * AddonsLoading::downloadIcon( void * pthis) { AddonsLoading * pt = (AddonsLoading*)pthis; - if(download("icon/" + pt->addons->GetIcon(), pt->addons->GetName() + ".png")) + if(download("icon/" + addons_manager->GetIcon(), addons_manager->GetName() + ".png")) { pthread_mutex_lock(&(pt->m_mutex_can_install)); pt->m_can_load_icon = true; @@ -109,12 +99,12 @@ } else if(eventSource == "next") { - this->addons->NextType(this->addons->GetType()); + addons_manager->NextType(addons_manager->GetType()); this->loadInfo(); } else if(eventSource == "previous") { - this->addons->PreviousType(this->addons->GetType()); + addons_manager->PreviousType(addons_manager->GetType()); this->loadInfo(); } if(eventSource == "install") @@ -166,12 +156,12 @@ } if(m_percent_update) { - m_progress->setValue(addons->getDownloadState()); - m_state->setText(addons->getDownloadStateAsStr().c_str()); + m_progress->setValue(addons_manager->getDownloadState()); + m_state->setText(addons_manager->getDownloadStateAsStr().c_str()); } if(m_can_load_icon) { - icon->setImage(std::string(file_manager->getConfigDir() + "/" + this->addons->GetName() + ".png").c_str(), IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); + icon->setImage(std::string(file_manager->getConfigDir() + "/" + addons_manager->GetName() + ".png").c_str(), IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); } pthread_mutex_unlock(&(m_mutex_can_install)); } @@ -191,13 +181,13 @@ void * AddonsLoading::startInstall(void* pthis) { AddonsLoading * obj = (AddonsLoading*)pthis; - if(!obj->addons->IsInstalledAsBool() or obj->addons->NeedUpdate()) + if(!addons_manager->IsInstalledAsBool() or addons_manager->NeedUpdate()) { - obj->addons->Install(); + addons_manager->Install(); } else { - obj->addons->UnInstall(); + addons_manager->UnInstall(); } pthread_mutex_lock(&(obj->m_mutex_can_install)); obj->m_can_install = true; Modified: main/trunk/src/states_screens/dialogs/addons_loading.hpp =================================================================== --- main/trunk/src/states_screens/dialogs/addons_loading.hpp 2010-11-09 17:04:58 UTC (rev 6483) +++ main/trunk/src/states_screens/dialogs/addons_loading.hpp 2010-11-09 17:21:58 UTC (rev 6484) @@ -41,21 +41,44 @@ GUIEngine::IconButtonWidget * icon; GUIEngine::IconButtonWidget * m_next; GUIEngine::IconButtonWidget * m_previous; + + /** + * This function is called when the user click on 'Install', 'Uninstall', or + * 'Update'. It is started using a thread. + * */ static void * startInstall(void*); + /** + * This function handle the downllading of the addons icon. + * It is started using a thread. When it is ended, it change the flag + * 'm_can_load_icon' and the onUpdate function reload the icon + * */ static void * downloadIcon(void*); void loadInfo(); + + /* These three bool are some flags. + * m_can_install : when the installation is finidhed, onUpdate close the + * dialog. + * m_percent_update : to reload the download percent + * m_can_load_icon see above (function downloadIcon)*/ bool m_can_install; bool m_percent_update; bool m_can_load_icon; + public: /** * Creates a modal dialog with given percentage of screen width and height */ pthread_mutex_t m_mutex_can_install; - Addons * addons; - AddonsLoading(Addons * id, const float percentWidth, const float percentHeight); + AddonsLoading(const float percentWidth, const float percentHeight); GUIEngine::EventPropagation processEvent(const std::string& eventSource); + + /** This function is called by the GUI, all the frame (or somthing like + * that). It checks the flags (m_can_install, m_can_load_icon and + * m_percent_update) and do the necessary. + * */ void onUpdate(float delta); + + /** To close the dialog when the (un)installation is finished.*/ void close(); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-12-05 16:25:58
|
Revision: 6860 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6860&view=rev Author: auria Date: 2010-12-05 16:25:51 +0000 (Sun, 05 Dec 2010) Log Message: ----------- Make timer in race gui resolution-independent + fixed some very fishy code along the way Modified Paths: -------------- main/trunk/src/states_screens/race_gui.cpp main/trunk/src/states_screens/race_gui.hpp Modified: main/trunk/src/states_screens/race_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_gui.cpp 2010-12-05 16:25:32 UTC (rev 6859) +++ main/trunk/src/states_screens/race_gui.cpp 2010-12-05 16:25:51 UTC (rev 6860) @@ -107,11 +107,13 @@ // 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; - int w;font->getDimension(L"99/99").Width; - if(race_manager->getNumLaps()>9) + + int w; + if (race_manager->getNumLaps() > 9) w = 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 @@ -122,6 +124,8 @@ if(m_rank_lap_width < w) m_rank_lap_width = w; + m_timer_width = font->getDimension(L"99:99:99").Width; + } // RaceGUI //----------------------------------------------------------------------------- @@ -355,8 +359,8 @@ core::stringw sw(s.c_str()); static video::SColor time_color = video::SColor(255, 255, 255, 255); - core::rect<s32> pos(UserConfigParams::m_width-120, 10, - UserConfigParams::m_width, 50); + core::rect<s32> pos(UserConfigParams::m_width - m_timer_width - 10, 10, + UserConfigParams::m_width, 50); // special case : when 3 players play, use available 4th space for such things if (race_manager->getNumLocalPlayers() == 3) Modified: main/trunk/src/states_screens/race_gui.hpp =================================================================== --- main/trunk/src/states_screens/race_gui.hpp 2010-12-05 16:25:32 UTC (rev 6859) +++ main/trunk/src/states_screens/race_gui.hpp 2010-12-05 16:25:51 UTC (rev 6860) @@ -137,13 +137,18 @@ /** Used to display messages without overlapping */ int m_max_font_height; int m_small_font_max_height; + /** 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 string length for the timer */ + int m_timer_width; + /** Distance on track to begin showing overlap in drawGlobalPlayerIcons */ float m_dist_show_overlap;///can be zero float m_icons_inertia;///can be zero + /** previous position of icons */ std::vector< core::vector2d<s32> > m_previous_icons_position; Material *m_icons_frame; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mbj...@us...> - 2010-12-08 17:45:17
|
Revision: 6896 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6896&view=rev Author: mbjornstk Date: 2010-12-08 17:45:10 +0000 (Wed, 08 Dec 2010) Log Message: ----------- Fix SVN properties before something backfires. Probably aeonphyxius forgot to read SVN-CONFIG. Modified Paths: -------------- main/trunk/src/states_screens/tutorial_screen.hpp Property Changed: ---------------- main/trunk/src/states_screens/tutorial_screen.cpp main/trunk/src/states_screens/tutorial_screen.hpp Property changes on: main/trunk/src/states_screens/tutorial_screen.cpp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: main/trunk/src/states_screens/tutorial_screen.hpp =================================================================== --- main/trunk/src/states_screens/tutorial_screen.hpp 2010-12-08 16:28:13 UTC (rev 6895) +++ main/trunk/src/states_screens/tutorial_screen.hpp 2010-12-08 17:45:10 UTC (rev 6896) @@ -15,16 +15,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef TUTORIALSCREEN_H -#define TUTORIALSCREEN_H +#ifndef TUTORIALSCREEN_H +#define TUTORIALSCREEN_H #include "irrlicht.h" #include "guiengine/screen.hpp" #include "utils/ptr_vector.hpp" - - -class TutorialScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<TutorialScreen> -{ + + +class TutorialScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<TutorialScreen> +{ friend class GUIEngine::ScreenSingleton<TutorialScreen>; TutorialScreen(); @@ -40,7 +40,7 @@ void init(); /** \brief implement callback from parent class GUIEngine::Screen */ - void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); -}; - -#endif // TUTORIALSCREEN_H + void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); +}; + +#endif // TUTORIALSCREEN_H Property changes on: main/trunk/src/states_screens/tutorial_screen.hpp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-12-12 02:36:28
|
Revision: 6971 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6971&view=rev Author: auria Date: 2010-12-12 02:36:22 +0000 (Sun, 12 Dec 2010) Log Message: ----------- Fixed more leaks Modified Paths: -------------- main/trunk/src/states_screens/feature_unlocked.cpp main/trunk/src/states_screens/feature_unlocked.hpp Modified: main/trunk/src/states_screens/feature_unlocked.cpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.cpp 2010-12-12 02:23:54 UTC (rev 6970) +++ main/trunk/src/states_screens/feature_unlocked.cpp 2010-12-12 02:36:22 UTC (rev 6971) @@ -189,7 +189,7 @@ if (unlockedStuffCount == 0) std::cerr << "There is nothing in the unlock chest!!!\n"; - m_all_kart_models.clear(); + m_all_kart_models.clearAndDeleteAll(); for (int n=0; n<unlockedStuffCount; n++) { if (m_unlocked_stuff[n].m_unlocked_kart != NULL) @@ -239,6 +239,7 @@ 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(); #ifdef DEBUG m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture"); #endif @@ -274,7 +275,7 @@ #endif m_unlocked_stuff.clearAndDeleteAll(); - m_all_kart_models.clear(); + m_all_kart_models.clearAndDeleteAll(); } // tearDown // ---------------------------------------------------------------------------- Modified: main/trunk/src/states_screens/feature_unlocked.hpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.hpp 2010-12-12 02:23:54 UTC (rev 6970) +++ main/trunk/src/states_screens/feature_unlocked.hpp 2010-12-12 02:36:22 UTC (rev 6971) @@ -62,7 +62,8 @@ ptr_vector<UnlockedThing, HOLD> m_unlocked_stuff; /** To store the copy of the KartModel for each unlocked kart. */ - std::vector<KartModel*> m_all_kart_models; + ptr_vector<KartModel> m_all_kart_models; + /** sky angle, 0-360 */ float m_sky_angle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-12-15 00:23:48
|
Revision: 7026 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7026&view=rev Author: auria Date: 2010-12-15 00:23:42 +0000 (Wed, 15 Dec 2010) Log Message: ----------- Save options before leaving options screen Modified Paths: -------------- main/trunk/src/states_screens/options_screen_audio.cpp main/trunk/src/states_screens/options_screen_audio.hpp Modified: main/trunk/src/states_screens/options_screen_audio.cpp =================================================================== --- main/trunk/src/states_screens/options_screen_audio.cpp 2010-12-15 00:23:18 UTC (rev 7025) +++ main/trunk/src/states_screens/options_screen_audio.cpp 2010-12-15 00:23:42 UTC (rev 7026) @@ -83,6 +83,15 @@ // ----------------------------------------------------------------------------- +void OptionsScreenAudio::tearDown() +{ + Screen::tearDown(); + // save changes when leaving screen + user_config->saveConfig(); +} // tearDown + +// ----------------------------------------------------------------------------- + void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name, const int playerID) { if (name == "options_choice") Modified: main/trunk/src/states_screens/options_screen_audio.hpp =================================================================== --- main/trunk/src/states_screens/options_screen_audio.hpp 2010-12-15 00:23:18 UTC (rev 7025) +++ main/trunk/src/states_screens/options_screen_audio.hpp 2010-12-15 00:23:42 UTC (rev 7026) @@ -48,6 +48,9 @@ /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init(); + /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void tearDown(); + /** \brief implement optional callback from parent class GUIEngine::Screen */ virtual void unloaded(); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-12-23 18:30:30
|
Revision: 7159 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7159&view=rev Author: auria Date: 2010-12-23 18:30:23 +0000 (Thu, 23 Dec 2010) Log Message: ----------- Mark a few forgotten strings as translatable Modified Paths: -------------- main/trunk/src/states_screens/kart_selection.cpp main/trunk/src/states_screens/race_gui.cpp Modified: main/trunk/src/states_screens/kart_selection.cpp =================================================================== --- main/trunk/src/states_screens/kart_selection.cpp 2010-12-23 16:57:06 UTC (rev 7158) +++ main/trunk/src/states_screens/kart_selection.cpp 2010-12-23 18:30:23 UTC (rev 7159) @@ -213,7 +213,7 @@ LabelWidget *getPlayerIDLabel() {return m_player_ID_label;} - std::string deviceName; + core::stringw deviceName; std::string m_kartInternalName; PlayerKartWidget(KartSelectionScreen* parent, StateManager::ActivePlayer* associatedPlayer, @@ -245,11 +245,11 @@ // ---- Player ID label if (associatedPlayer->getDevice()->getType() == DT_KEYBOARD) { - deviceName += "keyboard"; + deviceName += _("keyboard"); } else if (associatedPlayer->getDevice()->getType() == DT_GAMEPAD) { - deviceName += "gamepad"; + deviceName += _("gamepad"); } m_player_ID_label = new LabelWidget(false, true); Modified: main/trunk/src/states_screens/race_gui.cpp =================================================================== --- main/trunk/src/states_screens/race_gui.cpp 2010-12-23 16:57:06 UTC (rev 7158) +++ main/trunk/src/states_screens/race_gui.cpp 2010-12-23 18:30:23 UTC (rev 7159) @@ -1113,8 +1113,9 @@ core::stringw thetext_composer; if (mi->getComposer()!="") { - std::string s = "by "+mi->getComposer(); - thetext_composer = s.c_str(); + thetext_composer = _("by"); + thetext_composer += " "; + thetext_composer += mi->getComposer().c_str(); textWidth2 = font->getDimension(thetext_composer.c_str()).Width; } const int max_text_size = (int)(UserConfigParams::m_width*2.0f/3.0f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-12-30 05:17:16
|
Revision: 7188 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7188&view=rev Author: hikerstk Date: 2010-12-30 05:17:10 +0000 (Thu, 30 Dec 2010) Log Message: ----------- More cleanup and code simplification for addons_screen. Modified Paths: -------------- main/trunk/src/states_screens/addons_screen.cpp main/trunk/src/states_screens/addons_screen.hpp main/trunk/src/states_screens/addons_update_screen.cpp main/trunk/src/states_screens/addons_update_screen.hpp main/trunk/src/states_screens/dialogs/addons_loading.cpp Modified: main/trunk/src/states_screens/addons_screen.cpp =================================================================== --- main/trunk/src/states_screens/addons_screen.cpp 2010-12-30 03:02:07 UTC (rev 7187) +++ main/trunk/src/states_screens/addons_screen.cpp 2010-12-30 05:17:10 UTC (rev 7188) @@ -19,13 +19,11 @@ #include "states_screens/addons_screen.hpp" -#include <pthread.h> #include <sstream> #include "irrlicht.h" #include "addons/addons_manager.hpp" -#include "addons/network_http.hpp" #include "guiengine/widget.hpp" #include "guiengine/widgets/ribbon_widget.hpp" #include "guiengine/CGUISpriteBank.h" @@ -34,7 +32,6 @@ #include "states_screens/dialogs/addons_loading.hpp" #include "states_screens/state_manager.hpp" - DEFINE_SCREEN_SINGLETON( AddonsScreen ); // ------------------------------------------------------------------------------------------------------ @@ -56,10 +53,11 @@ + "/package-update.png" ); m_icon_bank = new irr::gui::STKModifiedSpriteBank( GUIEngine::getGUIEnv()); - m_icon_bank->addTextureAsSprite(icon1); - m_icon_bank->addTextureAsSprite(icon2); - m_icon_bank->addTextureAsSprite(icon3); -} + m_icon_installed = m_icon_bank->addTextureAsSprite(icon1); + m_icon_not_installed = m_icon_bank->addTextureAsSprite(icon2); + m_icon_needs_update = m_icon_bank->addTextureAsSprite(icon3); +} // loadedFromFile + // ---------------------------------------------------------------------------- void AddonsScreen::init() @@ -68,7 +66,6 @@ getWidget<GUIEngine::RibbonWidget>("category")->setDeactivated(); m_type = "kart"; - pthread_mutex_init(&m_mutex, NULL); std::cout << "[Addons] Using directory <" + file_manager->getAddonsDir() << ">\n"; GUIEngine::ListWidget* w_list = @@ -76,17 +73,15 @@ w_list->setIcons(m_icon_bank); //w_list->clear(); std::cout << "icon bank" << std::endl; - m_can_load_list = false; getWidget<GUIEngine::LabelWidget>("update_status") ->setText(_("Updating the list...")); - pthread_t thread; - pthread_create(&thread, NULL, &AddonsScreen::downloadList, this); -} + loadList("kart"); +} // init + // ---------------------------------------------------------------------------- void AddonsScreen::loadList(const std::string &type) { - std::cout << "load list" << std::endl; GUIEngine::ListWidget* w_list = getWidget<GUIEngine::ListWidget>("list_addons"); w_list->clear(); @@ -98,32 +93,35 @@ if(addon.isInstalled() && addon.needsUpdate()) { w_list->addItem(addon.getId(), addon.getName().c_str(), - 2 /* icon installed */); + m_icon_needs_update); } else if(addon.isInstalled()) { w_list->addItem(addon.getId(), addon.getName().c_str(), - 0 /* icon installed */); + m_icon_installed); } else { w_list->addItem(addon.getId(), addon.getName().c_str(), - 1 /* icon unsinstalled*/); + m_icon_not_installed); } } m_can_load_list = false; getWidget<GUIEngine::RibbonWidget>("category")->setActivated(); getWidget<GUIEngine::LabelWidget>("update_status")->setText(""); - if(m_type == "kart") + if(type == "kart") getWidget<GUIEngine::RibbonWidget>("category")->select("tab_kart", PLAYER_ID_GAME_MASTER); - else if(m_type == "track") + else if(type == "track") getWidget<GUIEngine::RibbonWidget>("category")->select("tab_track", PLAYER_ID_GAME_MASTER); -} -// ---------------------------------------------------------------------------- + else + getWidget<GUIEngine::RibbonWidget>("category")->select("tab_update", + PLAYER_ID_GAME_MASTER); +} // loadList +// ---------------------------------------------------------------------------- void AddonsScreen::eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) { @@ -138,7 +136,7 @@ getWidget<GUIEngine::ListWidget>("list_addons"); std::string addons = list->getSelectionInternalName(); - m_load = new AddonsLoading(0.8f, 0.8f, addons); + new AddonsLoading(0.8f, 0.8f, addons); } if (name == "category") { @@ -158,30 +156,8 @@ loadList("kart"); } } -} +} // eventCallback // ---------------------------------------------------------------------------- -void AddonsScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) -{ - pthread_mutex_lock(&m_mutex); - if(m_can_load_list) - { - loadList(m_type); - } - pthread_mutex_unlock(&m_mutex); -} - - -// ---------------------------------------------------------------------------- - -void *AddonsScreen::downloadList( void *pthis) -{ - AddonsScreen *pt = (AddonsScreen*)pthis; - pthread_mutex_lock(&(pt->m_mutex)); - pt->m_can_load_list = true; - pthread_mutex_unlock(&(pt->m_mutex)); - - return NULL; -} #endif Modified: main/trunk/src/states_screens/addons_screen.hpp =================================================================== --- main/trunk/src/states_screens/addons_screen.hpp 2010-12-30 03:02:07 UTC (rev 7187) +++ main/trunk/src/states_screens/addons_screen.hpp 2010-12-30 05:17:10 UTC (rev 7188) @@ -20,7 +20,6 @@ #ifndef HEADER_ADDONS_SCREEN_HPP #define HEADER_ADDONS_SCREEN_HPP -#include <pthread.h> #include "irrlicht.h" #include "addons/addons_manager.hpp" @@ -46,7 +45,12 @@ AddonsManager *m_addons; AddonsLoading *m_load; void loadInformations(); - /** For the addons list, a package when it is installed. */ + /** Icon for installed addon, which can be updated. */ + int m_icon_needs_update; + /** Icon for installed addons, no update available. */ + int m_icon_installed; + /** Icon for is not installed yet. */ + int m_icon_not_installed; irr::gui::STKModifiedSpriteBank *m_icon_bank; GUIEngine::LabelWidget @@ -55,7 +59,6 @@ public: bool m_can_load_list; - pthread_mutex_t m_mutex; std::string m_type; /** Load the addons into the main list.*/ @@ -67,15 +70,10 @@ /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); - /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init(); friend void *startInstall(void *); - static void *downloadList(void *); - - /** This function is used to handle the thread (load the new list, etc...). */ - virtual void onUpdate(float delta, irr::video::IVideoDriver*); }; #endif Modified: main/trunk/src/states_screens/addons_update_screen.cpp =================================================================== --- main/trunk/src/states_screens/addons_update_screen.cpp 2010-12-30 03:02:07 UTC (rev 7187) +++ main/trunk/src/states_screens/addons_update_screen.cpp 2010-12-30 05:17:10 UTC (rev 7188) @@ -61,7 +61,7 @@ GUIEngine::ListWidget* list = getWidget<GUIEngine::ListWidget>("list_addons"); std::string addons = list->getSelectionInternalName(); - m_load = new AddonsLoading(0.8f, 0.8f, addons); + new AddonsLoading(0.8f, 0.8f, addons); } else if (name == "category") { Modified: main/trunk/src/states_screens/addons_update_screen.hpp =================================================================== --- main/trunk/src/states_screens/addons_update_screen.hpp 2010-12-30 03:02:07 UTC (rev 7187) +++ main/trunk/src/states_screens/addons_update_screen.hpp 2010-12-30 05:17:10 UTC (rev 7188) @@ -34,10 +34,8 @@ public GUIEngine::ScreenSingleton<AddonsUpdateScreen> { friend class GUIEngine::ScreenSingleton<AddonsUpdateScreen>; - AddonsUpdateScreen(); - Addons *m_addons; - /*uneeded*/ - AddonsLoading *m_load; + + AddonsUpdateScreen(); void loadInformations(); public: Modified: main/trunk/src/states_screens/dialogs/addons_loading.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/addons_loading.cpp 2010-12-30 03:02:07 UTC (rev 7187) +++ main/trunk/src/states_screens/dialogs/addons_loading.cpp 2010-12-30 05:17:10 UTC (rev 7188) @@ -184,11 +184,8 @@ // ------------------------------------------------------------------------------------------------------ void AddonsLoading::close() { - AddonsScreen* curr_screen = AddonsScreen::getInstance(); - pthread_mutex_lock(&(((AddonsScreen*)curr_screen)->m_mutex)); ((AddonsScreen*)curr_screen)->m_can_load_list = true; - pthread_mutex_unlock(&(((AddonsScreen*)curr_screen)->m_mutex)); dismiss(); } // ------------------------------------------------------------------------------------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |