diff options
author | Eugene Sandulenko | 2017-12-08 23:57:19 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-12-08 23:57:48 +0100 |
commit | 6d59ecdd41f5ddc1d689540abb65013343bf994d (patch) | |
tree | 21a42f1392224c4aed97ed1bef1f584efca2ab52 /engines/fullpipe | |
parent | 7724e51936fc006a48ded3efd28b9caf20c5bc7e (diff) | |
download | scummvm-rg350-6d59ecdd41f5ddc1d689540abb65013343bf994d.tar.gz scummvm-rg350-6d59ecdd41f5ddc1d689540abb65013343bf994d.tar.bz2 scummvm-rg350-6d59ecdd41f5ddc1d689540abb65013343bf994d.zip |
FULLPIPE: Load gameobj.h
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 3 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 9 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/utils.cpp | 39 |
5 files changed, 57 insertions, 6 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index fef896d663..48dff107c8 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -269,6 +269,9 @@ Common::Error FullpipeEngine::run() { _isSaveAllowed = false; + if (debugChannelSet(-1, kDebugXML)) + loadGameObjH(); + int scene = 0; if (ConfMan.hasKey("boot_param")) scene = convertScene(ConfMan.getInt("boot_param")); diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 08c6de2621..ff843fe537 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -63,6 +63,8 @@ enum { kDebugXML = 1 << 10 }; +#define MAXGAMEOBJH 10000 + class BehaviorManager; class BaseModalObject; class GameLoader; @@ -90,6 +92,8 @@ typedef Common::Array<int16> MovTable; typedef Common::Array<int32> Palette; typedef Common::Array<Common::Point> PointList; +typedef Common::HashMap<uint16, Common::String> GameObjHMap; + int global_messageHandler1(ExCommand *cmd); int global_messageHandler2(ExCommand *cmd); int global_messageHandler3(ExCommand *cmd); @@ -135,6 +139,9 @@ public: GameProject *_gameProject; bool loadGam(const char *fname, int scene = 0); + void loadGameObjH(); + Common::String gameIdToStr(uint16 id); + GameVar *getGameLoaderGameVar(); InputController *getGameLoaderInputController(); @@ -347,6 +354,8 @@ public: bool _stream2playing; + GameObjHMap _gameObjH; + public: bool _isSaveAllowed; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 31e5c219c4..8407009679 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -235,8 +235,8 @@ GameObject::GameObject(GameObject *src) { } Common::String GameObject::toXML() { - return Common::String::format("id=%d name=\"%s\" x=%d y=%d priority=%d f8=%d", - _id, transCyrillic(_objectName), _ox, _oy, _priority, _field_8); + return Common::String::format("id=\"%s\" name=\"%s\" x=%d y=%d priority=%d f8=%d", + g_fp->gameIdToStr(_id).c_str(), transCyrillic(_objectName), _ox, _oy, _priority, _field_8); } bool GameObject::load(MfcArchive &file) { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 49cb3fde1f..4cee1c167f 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1375,8 +1375,8 @@ bool Statics::load(MfcArchive &file) { _staticsId = file.readUint16LE(); _staticsName = file.readPascalString(); - debugC(6, kDebugXML, "%% <STATICS id=%d name=\"%s\" %s />", - _staticsId, transCyrillic(_staticsName), DynamicPhase::toXML().c_str()); + debugC(6, kDebugXML, "%% <STATICS id=\"%s\" name=\"%s\" %s />", + g_fp->gameIdToStr(_staticsId).c_str(), transCyrillic(_staticsName), DynamicPhase::toXML().c_str()); _picture.load(file); @@ -1622,8 +1622,8 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) { _framePosOffsets[_dynamicPhases.size() - 1].y = _m2y; } - debugC(6, kDebugXML, "%% <MOVEMENT %s staticsId=%d mX=%d my=%d staticsId2=%d m2x=%d m2y=%d>", - GameObject::toXML().c_str(), staticsid, _mx, _my, staticsid2, _m2x, _m2y); + debugC(6, kDebugXML, "%% <MOVEMENT %s staticsId=\"%s\" mX=%d my=%d staticsId2=\"%s\" m2x=%d m2y=%d>", + GameObject::toXML().c_str(), g_fp->gameIdToStr(staticsid).c_str(), _mx, _my, g_fp->gameIdToStr(staticsid2).c_str(), _m2x, _m2y); for (int i = 0; i < dynCount; i++) debugC(6, kDebugXML, "%% <PHASE %s />", _dynamicPhases[i]->toXML().c_str()); diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index f3f07b0514..c1cf912de6 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -546,4 +546,43 @@ byte *transCyrillic(const Common::String &str) { return tmp; } +void FullpipeEngine::loadGameObjH() { + Common::File file; + + if (!file.open("gameobj.h")) + return; + + while(true) { + Common::String s = file.readLine(); + + if (file.eos()) + break; + + if (!s.hasPrefix("#define ")) { + warning("Bad read: <%s>", s.c_str()); + continue; + } + + int cnt = 0; + const char *ptr = &s.c_str()[8]; // Skip '#define '' + + while (*ptr && *ptr != ' ') { + cnt++; + ptr++; + } + + Common::String val(&s.c_str()[8], cnt); + int key = strtol(ptr, NULL, 10); + + _gameObjH[(uint16)key] = val; + } +} + +Common::String FullpipeEngine::gameIdToStr(uint16 id) { + if (_gameObjH.contains(id)) + return _gameObjH[id]; + + return Common::String::format("%d", id); +} + } // End of namespace Fullpipe |