From: <ka...@us...> - 2014-05-11 17:09:59
|
Revision: 8228 http://sourceforge.net/p/paintown/code/8228 Author: kazzmir Date: 2014-05-11 17:09:56 +0000 (Sun, 11 May 2014) Log Message: ----------- delay creation of the minimap buffer Modified Paths: -------------- trunk/src/paintown-engine/game/adventure_world.cpp trunk/src/paintown-engine/game/adventure_world.h Modified: trunk/src/paintown-engine/game/adventure_world.cpp =================================================================== --- trunk/src/paintown-engine/game/adventure_world.cpp 2014-05-11 00:20:53 UTC (rev 8227) +++ trunk/src/paintown-engine/game/adventure_world.cpp 2014-05-11 17:09:56 UTC (rev 8228) @@ -66,7 +66,6 @@ AdventureWorld::AdventureWorld(): World(), draw_minimaps( true ), -mini_map( NULL ), takeAScreenshot(false), is_paused(false), slowmotion(0), @@ -85,7 +84,6 @@ World(), path( path ), draw_minimaps( true ), -mini_map( NULL ), takeAScreenshot(false), is_paused(false), slowmotion(0), @@ -113,13 +111,6 @@ threadedLoadLevel(path); - /* 1.3333 is the aspect ratio of screen_width/screen_height when the res is any standard of - * 640,480 800,600, 1024,768 - * but it should use the actual values instead of guessing since the screen size - * could theoretically change - */ - mini_map = new Graphics::Bitmap(screen_size, (int)((double) screen_size / 1.3333)); - for ( vector<PlayerTracker>::iterator it = this->players.begin(); it != this->players.end(); it++ ){ PlayerTracker & tracker = *it; void * handle = Script::Engine::getEngine()->createPlayer(tracker.player); @@ -139,10 +130,6 @@ delete bang; } - if (mini_map){ - delete mini_map; - } - delete cacher; delete descriptionGradient; @@ -769,7 +756,16 @@ } void AdventureWorld::drawMiniMap(Graphics::Bitmap * work, const PlayerTracker & player, const map<int, vector<Paintown::Object*> > & object_z, int x, int y, int width, int height){ - drawWorld(player, mini_map, object_z, player.min_x); + if (mini_map == NULL){ + /* 1.3333 is the aspect ratio of screen_width/screen_height when the res is any standard of + * 640,480 800,600, 1024,768 + * but it should use the actual values instead of guessing since the screen size + * could theoretically change + */ + mini_map = new Graphics::Bitmap(screen_size, (int)((double) screen_size / 1.3333)); + } + + drawWorld(player, mini_map.raw(), object_z, player.min_x); Graphics::Bitmap mini(width, height); mini_map->Stretch(mini); Graphics::Bitmap::transBlender(0, 0, 0, 160); Modified: trunk/src/paintown-engine/game/adventure_world.h =================================================================== --- trunk/src/paintown-engine/game/adventure_world.h 2014-05-11 00:20:53 UTC (rev 8227) +++ trunk/src/paintown-engine/game/adventure_world.h 2014-05-11 17:09:56 UTC (rev 8228) @@ -193,7 +193,7 @@ bool draw_minimaps; - Graphics::Bitmap * mini_map; + Util::ReferenceCount<Graphics::Bitmap> mini_map; /* screenshots that are shown at the end of the level */ std::deque<Graphics::Bitmap*> screenshots; |