aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-07-21 19:57:33 +0200
committeruruk2014-07-21 19:57:33 +0200
commit6e26422468b8667c86219069cea25466370656e1 (patch)
tree8bb0e63fd54d4103a1940f6ad3028bd40fff4e8e
parent1176721034b07ddc6517e0a8b96c5eedb0b57e08 (diff)
downloadscummvm-rg350-6e26422468b8667c86219069cea25466370656e1.tar.gz
scummvm-rg350-6e26422468b8667c86219069cea25466370656e1.tar.bz2
scummvm-rg350-6e26422468b8667c86219069cea25466370656e1.zip
CGE2: Rework loading of sprites from file.
Now it satisfies the needs described in the last commit's TODO comment.
-rw-r--r--engines/cge2/cge2.h2
-rw-r--r--engines/cge2/cge2_main.cpp5
-rw-r--r--engines/cge2/saveload.cpp2
-rw-r--r--engines/cge2/spare.cpp12
4 files changed, 7 insertions, 14 deletions
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 6f07102ea5..cd3a56617a 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -151,7 +151,7 @@ public:
void runGame();
void initToolbar();
void loadHeroes();
- void loadScript(const char *fname);
+ void loadScript(const char *fname, bool onlyToolbar = false);
Sprite *loadSprite(const char *fname, int ref, int scene, V3D &pos);
void badLab(const char *fn);
void sceneUp(int cav);
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 938ad849be..51d9816445 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -315,7 +315,7 @@ Sprite *CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos)
return sprite;
}
-void CGE2Engine::loadScript(const char *fname) {
+void CGE2Engine::loadScript(const char *fname, bool onlyToolbar) {
EncryptedStream scrf(this, fname);
if (scrf.err())
@@ -341,6 +341,9 @@ void CGE2Engine::loadScript(const char *fname) {
// sprite ident number
int SpI = number(tmpStr);
+ if (onlyToolbar && SpI >= 141)
+ return;
+
// sprite file name
char *SpN;
if ((SpN = token(nullptr)) == nullptr)
diff --git a/engines/cge2/saveload.cpp b/engines/cge2/saveload.cpp
index 3890e74341..b9a856f5f4 100644
--- a/engines/cge2/saveload.cpp
+++ b/engines/cge2/saveload.cpp
@@ -323,7 +323,7 @@ void CGE2Engine::resetGame() {
_spare->clear();
_vga->_showQ->clear();
_commandHandler->reset();
- loadScript("CGE.INI");
+ loadScript("CGE.INI", true);
delete _infoLine;
_infoLine = new InfoLine(this, kInfoW);
}
diff --git a/engines/cge2/spare.cpp b/engines/cge2/spare.cpp
index 54918f7920..547d070fc9 100644
--- a/engines/cge2/spare.cpp
+++ b/engines/cge2/spare.cpp
@@ -47,17 +47,7 @@ void Spare::sync(Common::Serializer &s) {
for (int i = 0; i < size; i++) {
Sprite *sprite = new Sprite(_vm);
sprite->sync(s);
-
- // In case the reference of the sprite is changed comapred to CGE.INI
- // TODO: Rework the whole loading so it doesn't load every sprite from CGE.INI
- // and then update them, but load everything from file, so this check isn't
- // needed anymore. To do that, I also have to save/load the toolbar's sprites too.
- Sprite *loc = locate(sprite->_file);
- if (loc->_ref != sprite->_ref) {
- loc->contract();
- *loc = *sprite;
- } else
- update(sprite);
+ update(sprite);
}
}
}