[Scummvm-cvs-logs] scummvm master -> 8c71bf0f6e11bf4da0bb09bfe972fae887d264a3
dreammaster
dreammaster at scummvm.org
Tue Jun 9 02:38:18 CEST 2015
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8c71bf0f6e SHERLOCK: Add RT map data loading
Commit: 8c71bf0f6e11bf4da0bb09bfe972fae887d264a3
https://github.com/scummvm/scummvm/commit/8c71bf0f6e11bf4da0bb09bfe972fae887d264a3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-08T20:37:08-04:00
Commit Message:
SHERLOCK: Add RT map data loading
Changed paths:
engines/sherlock/tattoo/tattoo_map.cpp
engines/sherlock/tattoo/tattoo_map.h
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index ced7ed9..3a02d5b 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -21,16 +21,89 @@
*/
#include "sherlock/tattoo/tattoo_map.h"
+#include "sherlock/sherlock.h"
namespace Sherlock {
namespace Tattoo {
+void MapEntry::clear() {
+ _iconNum = -1;
+ _description = "";
+}
+
+/*-------------------------------------------------------------------------*/
+
+TattooMap::TattooMap(SherlockEngine *vm) : Map(vm) {
+ loadData();
+}
+
int TattooMap::show() {
// TODO
return 61;
}
+void TattooMap::loadData() {
+ Resources &res = *_vm->_res;
+ char c;
+
+ Common::SeekableReadStream *stream = res.load("map.txt");
+
+ _data.resize(100);
+ for (uint idx = 0; idx < _data.size(); ++idx)
+ _data[idx].clear();
+
+ do
+ {
+ // Find the start of the number
+ do {
+ c = stream->readByte();
+ if (stream->pos() >= stream->size())
+ return;
+ } while (c < '0' || c > '9');
+
+ // Get the scene number
+ Common::String locStr;
+ locStr += c;
+ while ((c = stream->readByte()) != '.')
+ locStr += c;
+ MapEntry &mapEntry = _data[atoi(locStr.c_str()) - 1];
+
+ // Get the location name
+ while (stream->readByte() != '"')
+ ;
+
+ while ((c = stream->readByte()) != '"')
+ mapEntry._description += c;
+
+ // Find the ( specifying the (X,Y) position of the Icon
+ while (stream->readByte() != '(')
+ ;
+
+ // Get the X Position of the icon
+ Common::String numStr;
+ while ((c = stream->readByte()) != ',')
+ numStr += c;
+ mapEntry.x = atoi(numStr.c_str());
+
+ // Get the Y position of the icon
+ numStr = "";
+ while ((c = stream->readByte()) != ')')
+ numStr += c;
+ mapEntry.y = atoi(numStr.c_str());
+
+ // Find and get the location's icon number
+ while (stream->readByte() != '#')
+ ;
+
+ Common::String iconStr;
+ while (stream->pos() < stream->size() && (c = stream->readByte()) != '\r')
+ iconStr += c;
+
+ mapEntry._iconNum = atoi(iconStr.c_str()) - 1;
+ } while (stream->pos() < stream->size());
+}
+
} // End of namespace Tattoo
} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_map.h b/engines/sherlock/tattoo/tattoo_map.h
index 750cd90..b0c1a3f 100644
--- a/engines/sherlock/tattoo/tattoo_map.h
+++ b/engines/sherlock/tattoo/tattoo_map.h
@@ -32,9 +32,25 @@ class SherlockEngine;
namespace Tattoo {
+struct MapEntry : Common::Point {
+ int _iconNum;
+ Common::String _description;
+
+ MapEntry() : Common::Point(), _iconNum(-1) {}
+ MapEntry(int posX, int posY, int iconNum) : Common::Point(posX, posY), _iconNum(iconNum) {}
+ void clear();
+};
+
class TattooMap : public Map {
+private:
+ Common::Array<MapEntry> _data;
+
+ /**
+ * Load data needed for the map
+ */
+ void loadData();
public:
- TattooMap(SherlockEngine *vm) : Map(vm) {}
+ TattooMap(SherlockEngine *vm);
virtual ~TattooMap() {}
/**
More information about the Scummvm-git-logs
mailing list