aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorjohndoe1232011-07-13 18:34:20 +0000
committerWillem Jan Palenstijn2013-05-08 20:38:47 +0200
commitb611b65bf42a3f2d710199fa69428ec1012a0108 (patch)
treebf6107ba3d858eb790005b75f3c32e2f8bb40f8a /devtools
parentffe024844b2f97fe4e735603308e505a7bcd982d (diff)
downloadscummvm-rg350-b611b65bf42a3f2d710199fa69428ec1012a0108.tar.gz
scummvm-rg350-b611b65bf42a3f2d710199fa69428ec1012a0108.tar.bz2
scummvm-rg350-b611b65bf42a3f2d710199fa69428ec1012a0108.zip
NEVERHOOD: Change addHitRect to use an explicit count
- This is since the alignment stuff didn't work and it's not worth it to investigate - Add possibility to write out hardcoded message lists instead of reading from the exe for special lists
Diffstat (limited to 'devtools')
-rw-r--r--devtools/create_neverhood/create_neverhood.cpp55
-rw-r--r--devtools/create_neverhood/tables.h6
2 files changed, 43 insertions, 18 deletions
diff --git a/devtools/create_neverhood/create_neverhood.cpp b/devtools/create_neverhood/create_neverhood.cpp
index 951a2f0ef1..84f3f74ac8 100644
--- a/devtools/create_neverhood/create_neverhood.cpp
+++ b/devtools/create_neverhood/create_neverhood.cpp
@@ -76,6 +76,7 @@ typedef std::vector<RectItem> RectItems;
struct MessageItem {
uint16 messageNum;
uint32 messageParam;
+ MessageItem(uint16 msgNum, uint32 msgParam) : messageNum(msgNum), messageParam(msgParam) {}
};
typedef std::vector<MessageItem> MessageItems;
@@ -103,14 +104,10 @@ byte *getData(uint32 offset) {
return data + offset - dataStart + fileStart;
}
-void addHitRect(uint32 offset) {
+void addHitRect(uint32 count, uint32 offset) {
HitRectList *hitRectList = new HitRectList();
hitRectList->id = offset;
byte *item = getData(offset);
- uint32 count = READ_LE_UINT32(item);
- //printf("count = %d\n", count);
- // Align to 16 bytes
- item = data + ((offset + 4 + 16) & 0xFFFFFFF0) - dataStart + fileStart;
for (uint32 i = 0; i < count; i++) {
HitRect hitRect;
hitRect.x1 = READ_LE_UINT16(item + 0);
@@ -128,15 +125,43 @@ void addHitRect(uint32 offset) {
void addMessage(uint32 count, uint32 offset) {
MessageList *messageList = new MessageList();
messageList->id = offset;
- byte *item = getData(offset);
- for (uint32 i = 0; i < count; i++) {
- MessageItem messageItem;
- messageItem.messageNum = READ_LE_UINT16(item + 0);
- messageItem.messageParam = READ_LE_UINT32(item + 4);
- //printf("%04X, %08X\n", messageItem.messageNum, messageItem.messageParam);
- item += 8;
- messageList->messageItems.push_back(messageItem);
+
+ // Special code for message lists which are set at runtime (but otherwise constant)
+ switch (offset) {
+ // Scene 1002 rings
+ case 0x004B4200:
+ messageList->messageItems.push_back(MessageItem(0x4800, 258));
+ messageList->messageItems.push_back(MessageItem(0x100D, 0x4A845A00));
+ messageList->messageItems.push_back(MessageItem(0x4805, 1));
+ break;
+ case 0x004B4218:
+ messageList->messageItems.push_back(MessageItem(0x4800, 297));
+ messageList->messageItems.push_back(MessageItem(0x100D, 0x43807801));
+ messageList->messageItems.push_back(MessageItem(0x4805, 2));
+ break;
+ case 0x004B4230:
+ messageList->messageItems.push_back(MessageItem(0x4800, 370));
+ messageList->messageItems.push_back(MessageItem(0x100D, 0x46C26A01));
+ break;
+ case 0x004B4240:
+ messageList->messageItems.push_back(MessageItem(0x4800, 334));
+ messageList->messageItems.push_back(MessageItem(0x100D, 0x468C7B11));
+ messageList->messageItems.push_back(MessageItem(0x4805, 1));
+ break;
+ case 0x004B4258:
+ messageList->messageItems.push_back(MessageItem(0x4800, 425));
+ messageList->messageItems.push_back(MessageItem(0x100D, 0x42845B19));
+ messageList->messageItems.push_back(MessageItem(0x4805, 1));
+ break;
+ default:
+ // Read message list from the exe
+ byte *item = getData(offset);
+ for (uint32 i = 0; i < count; i++) {
+ messageList->messageItems.push_back(MessageItem(READ_LE_UINT16(item + 0), READ_LE_UINT32(item + 4)));
+ item += 8;
+ }
}
+
messageLists.push_back(messageList);
}
@@ -180,8 +205,8 @@ int main(int argc, char *argv[]) {
loadExe("nhc.exe");
- for (int i = 0; hitRectListOffsets[i] != 0; i++) {
- addHitRect(hitRectListOffsets[i]);
+ for (int i = 0; hitRectListOffsets[i] != 0; i += 2) {
+ addHitRect(hitRectListOffsets[i], hitRectListOffsets[i + 1]);
}
for (int i = 0; rectListOffsets[i] != 0; i += 2) {
diff --git a/devtools/create_neverhood/tables.h b/devtools/create_neverhood/tables.h
index d6e230af5e..7aba996ef8 100644
--- a/devtools/create_neverhood/tables.h
+++ b/devtools/create_neverhood/tables.h
@@ -22,10 +22,10 @@
static const uint32 hitRectListOffsets[] = {
// Scene1001
- 0x004B4858,
+ 1, 0x004B4860,
// Scene1002
- 0x004B4134,
- 0
+ 1, 0x004B4138,
+ 0, 0
};
static const uint32 rectListOffsets[] = {