aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohndoe1232011-08-29 10:23:04 +0000
committerWillem Jan Palenstijn2013-05-08 20:39:35 +0200
commit28177361bf9406fce53db89b469e912219380b4d (patch)
tree239fe82bf89a681a23e3c88066cb80c54f570418
parenteb8c44b54c846d30d9ce246b786fd46e1218b586 (diff)
downloadscummvm-rg350-28177361bf9406fce53db89b469e912219380b4d.tar.gz
scummvm-rg350-28177361bf9406fce53db89b469e912219380b4d.tar.bz2
scummvm-rg350-28177361bf9406fce53db89b469e912219380b4d.zip
NEVERHOOD: Add Hall of Records tables
- Add tables for Scene2201
-rw-r--r--devtools/create_neverhood/create_neverhood.cpp99
-rw-r--r--devtools/create_neverhood/tables.h56
-rw-r--r--dists/engine-data/neverhood.datbin7592 -> 8080 bytes
3 files changed, 142 insertions, 13 deletions
diff --git a/devtools/create_neverhood/create_neverhood.cpp b/devtools/create_neverhood/create_neverhood.cpp
index 14dd32db3d..1efc6161c4 100644
--- a/devtools/create_neverhood/create_neverhood.cpp
+++ b/devtools/create_neverhood/create_neverhood.cpp
@@ -60,6 +60,28 @@ byte *getData(uint32 offset) {
return data + offset - dataStart + fileStart;
}
+const char *getStringP(uint32 offset) {
+ return offset != 0 ? (const char*)getData(offset) : NULL;
+}
+
+uint32 calcHash(const char *value) {
+ if (!value)
+ return 0;
+ uint32 hash = 0, shiftValue = 0;
+ while (*value != 0) {
+ char ch = *value++;
+ if (ch >= 'a' && ch <= 'z')
+ ch -= 32;
+ else if (ch >= '0' && ch <= '9')
+ ch += 22;
+ shiftValue += ch - 64;
+ if (shiftValue >= 32)
+ shiftValue -= 32;
+ hash ^= 1 << shiftValue;
+ }
+ return hash;
+}
+
struct HitRect {
int16 x1, y1, x2, y2;
uint16 messageNum;
@@ -217,6 +239,36 @@ struct NavigationItem {
};
+struct SceneInfo140Item {
+ uint32 bgFilename1;
+ uint32 bgFilename2;
+ uint32 txFilename;
+ uint32 bgFilename3;
+ byte xPosIndex;
+ byte count;
+
+ void load(uint32 offset) {
+ byte *item = getData(offset);
+ // Only save the hashes instead of the full names
+ bgFilename1 = calcHash(getStringP(READ_LE_UINT32(item + 0)));
+ bgFilename2 = calcHash(getStringP(READ_LE_UINT32(item + 4)));
+ txFilename = calcHash(getStringP(READ_LE_UINT32(item + 8)));
+ bgFilename3 = calcHash(getStringP(READ_LE_UINT32(item + 12)));
+ xPosIndex = item[16];
+ count = item[17];
+ }
+
+ void save(FILE *fd) {
+ writeUint32LE(fd, bgFilename1);
+ writeUint32LE(fd, bgFilename2);
+ writeUint32LE(fd, txFilename);
+ writeUint32LE(fd, bgFilename3);
+ writeByte(fd, xPosIndex);
+ writeByte(fd, count);
+ }
+
+};
+
template<class ITEMCLASS>
class StaticDataList {
public:
@@ -346,10 +398,33 @@ public:
};
+template<class ITEMCLASS>
+class StaticDataVector {
+public:
+ std::vector<ITEMCLASS> items;
+
+ void loadVector(const uint32 *offsets) {
+ for (int i = 0; offsets[i] != 0; i++) {
+ ITEMCLASS item;
+ item.load(offsets[i]);
+ items.push_back(item);
+ }
+ }
+
+ void saveVector(FILE *fd) {
+ writeUint32LE(fd, items.size());
+ for (typename std::vector<ITEMCLASS>::iterator it = items.begin(); it != items.end(); it++) {
+ (*it).save(fd);
+ }
+ }
+
+};
+
StaticDataListVector<HitRectList> hitRectLists;
StaticDataListVector<RectList> rectLists;
StaticDataListVector<MessageList> messageLists;
StaticDataListVector<NavigationList> navigationLists;
+StaticDataVector<SceneInfo140Item> sceneInfo140Items;
void addMessageList(uint32 messageListCount, uint32 messageListOffset) {
MessageList *messageList = new MessageList();
@@ -363,24 +438,22 @@ int main(int argc, char *argv[]) {
loadExe("nhc.exe");
- hitRectLists.loadListVector(hitRectListOffsets);
- rectLists.loadListVector(rectListOffsets);
- messageLists.loadListVector(messageListOffsets);
- navigationLists.loadListVector(navigationListOffsets);
-
+ hitRectLists.loadListVector(hitRectListOffsets);
+ rectLists.loadListVector(rectListOffsets);
+ messageLists.loadListVector(messageListOffsets);
+ navigationLists.loadListVector(navigationListOffsets);
+ sceneInfo140Items.loadVector(sceneInfo140Offsets);
+
datFile = fopen("neverhood.dat", "wb");
writeUint32LE(datFile, 0x11223344); // Some magic
writeUint32LE(datFile, DAT_VERSION);
- // Write all message lists
- messageLists.saveListVector(datFile);
- // Write all rect lists
- rectLists.saveListVector(datFile);
- // Write all hit rect lists
- hitRectLists.saveListVector(datFile);
- // Write all navigation lists
- navigationLists.saveListVector(datFile);
+ messageLists.saveListVector(datFile);
+ rectLists.saveListVector(datFile);
+ hitRectLists.saveListVector(datFile);
+ navigationLists.saveListVector(datFile);
+ sceneInfo140Items.saveVector(datFile);
fclose(datFile);
diff --git a/devtools/create_neverhood/tables.h b/devtools/create_neverhood/tables.h
index b2d5bc52ff..8a139f5e74 100644
--- a/devtools/create_neverhood/tables.h
+++ b/devtools/create_neverhood/tables.h
@@ -159,6 +159,19 @@ static const uint32 messageListOffsets[] = {
4, 0x004B35F0,
2, 0x004B3550,
1, 0x004B3530,
+ // Scene2201
+ 1, 0x004B8118,
+ 1, 0x004B8130,
+ 1, 0x004B8178,
+ 2, 0x004B8120,
+ 3, 0x004B81A0,
+ 1, 0x004B81B8,
+ 2, 0x004B8108,
+ 5, 0x004B8150,
+ 4, 0x004B8180,
+ 3, 0x004B8138,
+ 2, 0x004B8108,
+ 2, 0x004B81C8,
0, 0
};
@@ -196,3 +209,46 @@ static const uint32 navigationListOffsets[] = {
1, 0x004B7FB0,
0, 0
};
+
+// Hall of Records scene definitions
+
+static const uint32 sceneInfo140Offsets[] = {
+ 0x004B7180,
+ 0x004B7198,
+ 0x004B71B0,
+ 0x004B71C8,
+ 0x004B71E0,
+ 0x004B71F8,
+ 0x004B7210,
+ 0x004B7228,
+ 0x004B7240,
+ 0x004B7258,
+ 0x004B7270,
+ 0x004B7288,
+ 0x004B72A0,
+ 0x004B72B8,
+ 0x004B72D0,
+ 0x004B72E8,
+ 0x004B7300,
+ 0x004B7318,
+ 0x004B7330,
+ 0x004B7348,
+ 0x004B7360,
+ 0x004B7378,
+ 0x004B7390,
+ 0x004B73A8,
+ 0x004B73C0,
+ 0x004B73D8,
+ 0x004B73F0,
+ 0x004B7408,
+ 0x004B7420,
+ 0x004B7438,
+ 0x004B7450,
+ 0x004B7468,
+ 0x004B7480,
+ 0x004B7498,
+ 0x004B74B0,
+ 0x004B74C8,
+ 0
+};
+
diff --git a/dists/engine-data/neverhood.dat b/dists/engine-data/neverhood.dat
index 84a6425ae6..fb36884f81 100644
--- a/dists/engine-data/neverhood.dat
+++ b/dists/engine-data/neverhood.dat
Binary files differ