supertuxkart-sourceforge-migration / stk-migration-test

0 stars 0 forks source link

Garage problem in overworld #766

Closed supertuxkart-sourceforge-migration closed 10 years ago

supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560

In the overworld (story mode), as soon as you enter the garage, a race paused dialog appears which is perfectly normal. But, if you stay in the garage for a while, it keeps on popping up every 3-4 seconds by itself.

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee If I remember correctly, in STK 0.8 when you ran to garage, kart selection screen was automatically displayed. Perhaps it was better solution than race pause dialog?

supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560 No, race pause dialog displays when you run into garage. (in current svn trunk revision 14384)

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee I remembered correctly ;-)

It was caused by this change: r11635 - "Add special escape-menu on overworld, and make Nolok's bubble gum swapper-proof".

Now it is file: src/tracks/track_object_presentation.cpp, lines 594-595:

if (m_action == "garage")
{
    new RacePausedDialog(0.8f, 0.6f);
    //dynamic_cast<OverWorld*>(World::getWorld())->scheduleSelectKart();
}
supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560 But why is it popping up again and again after some short time intervals?

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee Longer time intervals wouldn't really solve this... And about other solution, what do you propose?

Popup message could be displayed only once, when you enter to garage. But what if you accidentaly press escape? In such case you need to run from garage and enter there once again? Not really good idea.

I would like to restore previous entering to garage - before r11635 change. But I noticed there crash - ticket #1088. It is barely noticable with current solution, so it is better for now...

supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560 Well, I noticed it the first time I played stk so from my point of view, it is noticable.

The problem is that entering a garage is considered as collecting an item of type ITEM_TRIGGER in the code (src/items/item.cpp).This item has a return time of 2 seconds (m_return_till_time). So, after every 2 seconds, being in the garage triggers the collection of an item and pops up the Race Pause Dialog.

My solution would be to display the race paused dialog only when one enters the garage and if escape key is pressed, it should disappear and never come until the time one stays in the garage. If you go out and come back again, the same thing should happen.

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee *The crash is not noticable, popup windows of course yes ;)

supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560 Yes, the crash is really not noticable, that's right.

I'd like to work on the ticket and submit a patch ASAP if it's okay with you??? I'm new to stk and I'm a gsoc aspirant.

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee If you want, sure :)

You can also look at the overworld.blend file. There is a bit stupid object (sphere) in garage which checks if you are there or not. It could be changed to line. In such case popup would be displayed twice - when you go to the garage and when you leave it. And in such case would be needed only one check - if you are alredy in garage or not. If yes, popup shouldn't be displayed.

If you need I can change this sphere in overworld and export track.

Or if you have better idea, it's not a problem :)

supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560 I'd like to try with my own hand but thanks for the suggestions. I'll see the mentioned file and check what can be done :)

supertuxkart-sourceforge-migration commented 10 years ago

Author: shs8560 Can you mention where this file - overworld.blend exists? I wasn't able to find it.

I just started out with stk code so I'm not much familiar.

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee All sources for media (textures, sounds, track and kart models) are here: https://sourceforge.net/p/supertuxkart/code/HEAD/tree/media/trunk/

All STK models are created in blender. One minor disadvantage is that you need plug-ins for blender which allow to export files as b3d and xml files. Actually in this case only xml files are needed. Plugins are in media/trunk/blender_25. Somewhere on the STK site is written where it should be copied - I not remember paths.

supertuxkart-sourceforge-migration commented 10 years ago

Author: auria Changing the sphere to a line is non trivial : it requires modifying the exporter, then modifying the loader on the C++ side, and performing the appropriate collision detection. Nothing impossible, but just to make sure you know what you're trying to do, it's non-trivial

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee That's true, it is not as easy as I supposed - I tried to fix it yesterday ;p

In track_object_presentation.cpp we can use "m_action_active = false;" in garage action. Okey, popup is displayed only once.

Then I would like to get this object (garage) in overworld update() function, but I was unable to do it. I could check position of this object and if distance from the kart would be long enough, do reset() on garage.

supertuxkart-sourceforge-migration commented 10 years ago

Author: deveee Fixed in r14804.

I leaved this sphere as it was ;p

TODO (if someone is interested): Compare distance between garage and kart with for example length of the kart or distance of object defined in scene.xml. Currently (m_garage_pos-m_kart_pos).length2_2d() gives much higher values than getKart(0)->getKartModel()->getLength(), not sure why. I must look at this closer.