aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/text.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2011-01-28 16:13:12 +0000
committerFilippos Karapetis2011-01-28 16:13:12 +0000
commita2f960017931ad871c37bf1d9c197418aa8afca9 (patch)
treeea003cd1f548266f26255e048d1d575673b981d7 /engines/sword25/gfx/text.cpp
parent7760628bdba085f57711b18c3fa9fdff6c12a38b (diff)
downloadscummvm-rg350-a2f960017931ad871c37bf1d9c197418aa8afca9.tar.gz
scummvm-rg350-a2f960017931ad871c37bf1d9c197418aa8afca9.tar.bz2
scummvm-rg350-a2f960017931ad871c37bf1d9c197418aa8afca9.zip
SWORD25: Disabled the mechanism which precaches all of the game's resources on startup.
This reduced the initial memory used by 100MB for me, though the game keeps allocating new resources in each scene without deleting them, because of the missing functionality in getUsedMemory(). This change also slightly reduces the loading time on game startup. svn-id: r55593
Diffstat (limited to 'engines/sword25/gfx/text.cpp')
-rw-r--r--engines/sword25/gfx/text.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index 5dad89207f..bbfc3804a3 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -39,6 +39,7 @@
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/outputpersistenceblock.h"
#include "sword25/kernel/inputpersistenceblock.h"
+#include "sword25/kernel/resmanager.h" // for PRECACHE_RESOURCES
#include "sword25/gfx/fontresource.h"
#include "sword25/gfx/bitmapresource.h"
@@ -70,7 +71,9 @@ Text::Text(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPt
}
bool Text::setFont(const Common::String &font) {
- // Font precachen.
+ // Load font
+
+#ifdef PRECACHE_RESOURCES
if (getResourceManager()->precacheResource(font)) {
_font = font;
updateFormat();
@@ -80,6 +83,13 @@ bool Text::setFont(const Common::String &font) {
error("Could not precache font \"%s\". Font probably does not exist.", font.c_str());
return false;
}
+#else
+ getResourceManager()->requestResource(font);
+ _font = font;
+ updateFormat();
+ forceRefresh();
+ return true;
+#endif
}