[Scummvm-git-logs] scummvm master -> 02f679180425f7f2b95236ffeaa67805d2a30e7a
dreammaster
dreammaster at scummvm.org
Sat Aug 27 03:18:33 CEST 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0fbc3b709d DEVTOOLS: Added data for CParrotLobbyLinkUpdator to create_titanic
02f6791804 TITANIC: Implemented parrot lobby classes
Commit: 0fbc3b709d242a1ac82467973f56a8f84d9a465e
https://github.com/scummvm/scummvm/commit/0fbc3b709d242a1ac82467973f56a8f84d9a465e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-26T21:18:03-04:00
Commit Message:
DEVTOOLS: Added data for CParrotLobbyLinkUpdator to create_titanic
Changed paths:
devtools/create_titanic/create_titanic_dat.cpp
diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp
index 7171467..61e5de1 100644
--- a/devtools/create_titanic/create_titanic_dat.cpp
+++ b/devtools/create_titanic/create_titanic_dat.cpp
@@ -797,6 +797,38 @@ void writeBedheadData() {
dataOffset += size;
}
+void writeParrotLobbyLinkUpdaterEntries() {
+ static const int OFFSETS[3] = { 0x5A5B38, 0x5A5320, 0x5A4360 };
+ static const int COUNTS[5] = { 7, 5, 6, 9, 1 };
+ static const int SKIP[5] = { 36, 36, 40, 36, 0 };
+ uint recordOffset = OFFSETS[_version], linkOffset;
+ byte vals[8];
+
+ outputFile.seek(dataOffset);
+
+ for (int groupNum = 0; groupNum < 4; ++groupNum) {
+ for (int entryNum = 0; entryNum < COUNTS[groupNum];
+ ++entryNum, recordOffset += 36) {
+ inputFile.seek(recordOffset - FILE_DIFF[_version]);
+ linkOffset = inputFile.readUint32LE();
+ for (int idx = 0; idx < 8; ++idx)
+ vals[idx] = inputFile.readUint32LE();
+
+ // Write out the entry
+ inputFile.seek(linkOffset - FILE_DIFF[_version]);
+ outputFile.writeString(inputFile);
+ outputFile.write(vals, 8);
+ }
+
+ // Skip space between groups
+ recordOffset += SKIP[groupNum];
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader("DATA/PARROT_LOBBY_LINK_UPDATOR", dataOffset, size);
+ dataOffset += size;
+}
+
void writeHeader() {
// Write out magic string
const char *MAGIC_STR = "SVTN";
@@ -969,6 +1001,7 @@ void writeData() {
writeBarbotFrameRanges();
writeMissiveOMatMessages();
writeBedheadData();
+ writeParrotLobbyLinkUpdaterEntries();
}
void createScriptMap() {
Commit: 02f679180425f7f2b95236ffeaa67805d2a30e7a
https://github.com/scummvm/scummvm/commit/02f679180425f7f2b95236ffeaa67805d2a30e7a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-26T21:18:26-04:00
Commit Message:
TITANIC: Implemented parrot lobby classes
Changed paths:
engines/titanic/game/parrot/parrot_lobby_controller.cpp
engines/titanic/game/parrot/parrot_lobby_controller.h
engines/titanic/game/parrot/parrot_lobby_link_updater.cpp
engines/titanic/game/parrot/parrot_lobby_link_updater.h
engines/titanic/game/parrot/parrot_lobby_object.cpp
engines/titanic/game/parrot/parrot_lobby_object.h
diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.cpp b/engines/titanic/game/parrot/parrot_lobby_controller.cpp
index f1e054a..907e751 100644
--- a/engines/titanic/game/parrot/parrot_lobby_controller.cpp
+++ b/engines/titanic/game/parrot/parrot_lobby_controller.cpp
@@ -21,9 +21,14 @@
*/
#include "titanic/game/parrot/parrot_lobby_controller.h"
+#include "titanic/core/room_item.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CParrotLobbyController, CParrotLobbyObject)
+ ON_MESSAGE(ActMsg)
+END_MESSAGE_MAP()
+
void CParrotLobbyController::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CParrotLobbyObject::save(file, indent);
@@ -34,4 +39,34 @@ void CParrotLobbyController::load(SimpleFile *file) {
CParrotLobbyObject::load(file);
}
+bool CParrotLobbyController::ActMsg(CActMsg *msg) {
+ if (msg->_action == "Refresh")
+ return false;
+ else if (msg->_action == "GainParrot")
+ _haveParrot = true;
+ else if (msg->_action == "LoseParrot")
+ _haveParrot = false;
+ else if (msg->_action == "GainPerch")
+ _havePerch = true;
+ else if (msg->_action == "LosePerch")
+ _havePerch = false;
+ else if (msg->_action == "GainStick")
+ _haveStick = true;
+ else if (msg->_action == "LoseStick")
+ _haveStick = false;
+
+ _flags = 0;
+ if (_haveParrot)
+ _flags = 4;
+ if (_havePerch)
+ _flags |= 2;
+ if (_haveStick)
+ _flags |= 1;
+
+ CActMsg actMsg("Refresh");
+ actMsg.execute(findRoom(), CParrotLobbyObject::_type, MSGFLAG_CLASS_DEF | MSGFLAG_SCAN);
+ actMsg.execute("ParrotLobbyUpdater_TOW");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h
index d2fa4a1..896a4e1 100644
--- a/engines/titanic/game/parrot/parrot_lobby_controller.h
+++ b/engines/titanic/game/parrot/parrot_lobby_controller.h
@@ -28,6 +28,8 @@
namespace Titanic {
class CParrotLobbyController : public CParrotLobbyObject {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp
index 25d5ec7..47311c3 100644
--- a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp
+++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp
@@ -21,9 +21,46 @@
*/
#include "titanic/game/parrot/parrot_lobby_link_updater.h"
+#include "titanic/titanic.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CParrotLobbyLinkUpdater, CParrotLobbyObject)
+ ON_MESSAGE(ActMsg)
+END_MESSAGE_MAP()
+
+/*------------------------------------------------------------------------*/
+
+LinkUpdatorEntry::LinkUpdatorEntry() {
+ Common::fill(&_vals[0], &_vals[8], 0);
+}
+
+void LinkUpdatorEntry::load(Common::SeekableReadStream *s) {
+ _linkStr = readStringFromStream(s);
+ for (int idx = 0; idx < 8; ++idx)
+ _vals[idx] = s->readByte();
+}
+
+/*------------------------------------------------------------------------*/
+
+void LinkUpdatorEntries::load(Common::SeekableReadStream *s, int count) {
+ resize(count);
+ for (int idx = 0; idx < count; ++idx)
+ (*this)[idx].load(s);
+}
+
+/*------------------------------------------------------------------------*/
+
+CParrotLobbyLinkUpdater::CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) {
+ Common::SeekableReadStream *s = g_vm->_filesManager->getResource("DATA/PARROT_LOBBY_LINK_UPDATOR");
+ _entries[0].load(s, 7);
+ _entries[1].load(s, 5);
+ _entries[2].load(s, 6);
+ _entries[3].load(s, 9);
+ _entries[4].load(s, 1);
+ delete s;
+}
+
void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CParrotLobbyObject::save(file, indent);
@@ -34,4 +71,45 @@ void CParrotLobbyLinkUpdater::load(SimpleFile *file) {
CParrotLobbyObject::load(file);
}
+bool CParrotLobbyLinkUpdater::ActMsg(CActMsg *msg) {
+ if (msg->_action != "Refresh")
+ return false;
+
+ CNodeItem *node = findNode();
+ LinkUpdatorEntries *entriesP;
+ if (isEquals("ParrotLobbyUpdater_TOW")) {
+ entriesP = &_entries[4];
+ } else {
+ if (node->_nodeNumber > 3)
+ return true;
+ entriesP = &_entries[node->_nodeNumber];
+ }
+ int count = entriesP->size();
+
+ for (CTreeItem *item = node->getFirstChild(); item; item = item->scan(node)) {
+ CLinkItem *link = dynamic_cast<CLinkItem *>(item);
+ if (!link || count == 0)
+ continue;
+
+ CString linkName = link->getName();
+ char c = linkName.lastChar();
+ if (c >= 'a' && c <= 'd')
+ linkName.deleteLastChar();
+
+ for (uint idx = 0; idx < entriesP->size(); ++idx) {
+ const LinkUpdatorEntry &entry = (*entriesP)[idx];
+ if (entry._linkStr == linkName) {
+ int val = entry._vals[CParrotLobbyObject::_flags];
+ if (val)
+ linkName += (char)(0x60 + val);
+
+ link->_name = linkName;
+ break;
+ }
+ }
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h
index 0470a62..93db931 100644
--- a/engines/titanic/game/parrot/parrot_lobby_link_updater.h
+++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h
@@ -23,16 +23,34 @@
#ifndef TITANIC_PARROT_LOBBY_LINK_UPDATER_H
#define TITANIC_PARROT_LOBBY_LINK_UPDATER_H
+#include "common/stream.h"
#include "titanic/game/parrot/parrot_lobby_object.h"
namespace Titanic {
+struct LinkUpdatorEntry {
+ CString _linkStr;
+ int _vals[8];
+
+ LinkUpdatorEntry();
+ void load(Common::SeekableReadStream *s);
+};
+
+class LinkUpdatorEntries : public Common::Array<LinkUpdatorEntry> {
+public:
+ void load(Common::SeekableReadStream *s, int count);
+};
+
class CParrotLobbyLinkUpdater : public CParrotLobbyObject {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
+private:
+ LinkUpdatorEntries _entries[5];
public:
int _fieldBC;
public:
CLASSDEF;
- CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) {}
+ CParrotLobbyLinkUpdater();
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp
index a78ab2b..06222fd 100644
--- a/engines/titanic/game/parrot/parrot_lobby_object.cpp
+++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp
@@ -26,34 +26,34 @@ namespace Titanic {
EMPTY_MESSAGE_MAP(CParrotLobbyObject, CGameObject);
-int CParrotLobbyObject::_v1;
-int CParrotLobbyObject::_v2;
-int CParrotLobbyObject::_v3;
-int CParrotLobbyObject::_v4;
+bool CParrotLobbyObject::_haveParrot;
+bool CParrotLobbyObject::_havePerch;
+bool CParrotLobbyObject::_haveStick;
+int CParrotLobbyObject::_flags;
void CParrotLobbyObject::init() {
- _v1 = 1;
- _v2 = 1;
- _v3 = 1;
- _v4 = 7;
+ _haveParrot = true;
+ _havePerch = true;
+ _haveStick = true;
+ _flags = 7;
}
void CParrotLobbyObject::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_v1, indent);
- file->writeNumberLine(_v2, indent);
- file->writeNumberLine(_v3, indent);
- file->writeNumberLine(_v4, indent);
+ file->writeNumberLine(_haveParrot, indent);
+ file->writeNumberLine(_havePerch, indent);
+ file->writeNumberLine(_haveStick, indent);
+ file->writeNumberLine(_flags, indent);
CGameObject::save(file, indent);
}
void CParrotLobbyObject::load(SimpleFile *file) {
file->readNumber();
- _v1 = file->readNumber();
- _v2 = file->readNumber();
- _v3 = file->readNumber();
- _v4 = file->readNumber();
+ _haveParrot = file->readNumber();
+ _havePerch = file->readNumber();
+ _haveStick = file->readNumber();
+ _flags = file->readNumber();
CGameObject::load(file);
}
diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h
index 5272303..a210331 100644
--- a/engines/titanic/game/parrot/parrot_lobby_object.h
+++ b/engines/titanic/game/parrot/parrot_lobby_object.h
@@ -30,10 +30,10 @@ namespace Titanic {
class CParrotLobbyObject : public CGameObject {
DECLARE_MESSAGE_MAP;
public:
- static int _v1;
- static int _v2;
- static int _v3;
- static int _v4;
+ static bool _haveParrot;
+ static bool _havePerch;
+ static bool _haveStick;
+ static int _flags;
static void init();
public:
More information about the Scummvm-git-logs
mailing list