[Scummvm-git-logs] scummvm master -> e9b4d18ad24ee608c50d0eb42f1c1f008cedd4e2
dreammaster
paulfgilbert at gmail.com
Thu Apr 30 05:12:02 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
74aef2ae03 GLK: Adding game detections
d9a9e0f91d ULTIMA4: Extract data tables from exes into ultima.dat
e9b4d18ad2 ULTIMA4: Stop keypresses being drawn during intro
Commit: 74aef2ae0315978c4c3720a6a68ad4d009de51a8
https://github.com/scummvm/scummvm/commit/74aef2ae0315978c4c3720a6a68ad4d009de51a8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-29T22:00:44-07:00
Commit Message:
GLK: Adding game detections
Changed paths:
engines/glk/frotz/detection_tables.h
engines/glk/glulxe/detection_tables.h
diff --git a/engines/glk/frotz/detection_tables.h b/engines/glk/frotz/detection_tables.h
index 5a36f6133c..769a173fe4 100644
--- a/engines/glk/frotz/detection_tables.h
+++ b/engines/glk/frotz/detection_tables.h
@@ -594,6 +594,7 @@ const PlainGameDescriptor ZCODE_GAME_LIST[] = {
{ "sixgrayrats", "Six Gray Rats Crawl Up The Pillow" },
{ "slackerx", "Slacker X" },
{ "sleepcycle", "Sleep Cycle" },
+ { "slouchingbedlam", "Slouching Towards Bedlam" },
{ "snafufun", "SNAFUFUN" },
{ "snowquest", "Snowquest" },
{ "neverplayed", "So, You've Never Played a Text Adventure Before, Huh?" },
@@ -1635,6 +1636,7 @@ const FrotzGameDescription FROTZ_GAMES[] = {
ENTRY0("sixgrayrats", "150331", "1a2b10729ebb83a08a38f0c80020a34d", 428544),
ENTRY0("slackerx", "971009", "c7014f074407ddebc685dcd7bce5bd37", 55296),
ENTRY0("sleepcycle", "101217", "5c9c1b6c46c057099cdc6ad04f30407d", 253892),
+ ENTRY0("slouchingbedlam", "030925", "0f870671f3d7569d57eb79a8be9b4a28", 216576),
ENTRY0("snafufun", "990925", "2b04ac88022c9df74b4ae59cb3f75f27", 13312),
ENTRY0("snowquest", "100127", "2442363dd6f7f2ee6a6ca840ca9d9881", 1034206),
ENTRY0("sofar", "961218", "026e1c0b7ef555011df2a9f72a2db574", 300032),
diff --git a/engines/glk/glulxe/detection_tables.h b/engines/glk/glulxe/detection_tables.h
index bd1af680dd..65ce2751f3 100644
--- a/engines/glk/glulxe/detection_tables.h
+++ b/engines/glk/glulxe/detection_tables.h
@@ -106,6 +106,7 @@ const PlainGameDescriptor GLULXE_GAME_LIST[] = {
{ "dungeonspuzzle", "Dungeon's Puzzle" },
{ "dungeontext1", "Dungeon Text I - Escape From Darkness" },
{ "eas2", "Another Earth, Another Sky. Earth And Sky: Episode 2" },
+ { "eatme", "Eat Me" },
{ "endlesssands", "Endless Sands" },
{ "endling", "The Endling Archive" },
{ "enterpriseincidents", "The Enterprise Incidents: A Middle School Fantasy" },
@@ -192,10 +193,12 @@ const PlainGameDescriptor GLULXE_GAME_LIST[] = {
{ "six", "Six" },
{ "smittenkittens", "Smitten Kittens" },
{ "skmmc", "Someone Keeps Moving My Chair" },
+ { "slouchingbedlamglulx", "Slouching Towards Bedlam" },
{ "spaceship", "Spaceship!" },
{ "spellbound", "Spellbound" },
{ "spirI7wrak", "SpirI7wrak" },
{ "starlight", "Starlight" },
+ { "stiffymakane", "Stiffy Makane - Apocolocyntosis" },
{ "subrosa", "Sub Rosa: The Seven Deceits of Confessor Destine" },
{ "superluminalvagranttwin", "Superluminal Vagrant Twin" },
{ "tacoFiction", "Taco Fiction" },
@@ -244,6 +247,7 @@ const PlainGameDescriptor GLULXE_GAME_LIST[] = {
{ "wand", "The Wand" },
{ "winterstormdraco", "Winter Storm Draco" },
{ "wishertheurgist", "Wisher, Theurgist, Fatalist" },
+ { "wizardsniffer", "The Wizard Sniffer" },
{ "wof", "Works of Fiction" },
{ "wordoftheday", "Word of the Day" },
{ "wordsofpower", "Words of Power" },
@@ -383,6 +387,7 @@ const GlkDetectionEntry GLULXE_GAMES[] = {
DT_ENTRY1("dungeonspuzzle", "180428", "6f9413eb4901da34adbdd79753094c2a", 662208),
DT_ENTRY1("dungeontext1", "130317", "1c69e410ff3fa7c7dcf83875a7f3a963", 746466),
DT_ENTRY1("eas2", "030112", "fc2b4a123489076679597a57d04c5acc", 845600),
+ DT_ENTRY1("eatme", "171013", "5e9c50e06ae1f954b9dd41abcfc0f09b", 2570070),
DT_ENTRY1("endlesssands", "150215", "2105d775eb759af04ab788e046d965e0", 982748),
DT_ENTRY1("endlesssands", "150712", "55b31591423b011bb99be2724a6bdbe9", 1005788),
DT_ENTRY1("endling", "090217", "52500f2301277154258d2a846d45aedb", 148908),
@@ -481,10 +486,12 @@ const GlkDetectionEntry GLULXE_GAMES[] = {
DT_ENTRY1("six", "170723", "2d1fdfe386c08fdacd620b7497bcd88f", 8661160),
DT_ENTRY0("smittenkittens", "c3402d5d8b94675af5e3e0069366d4fd", 1240942),
DT_ENTRY1("skmmc", "150116", "46aee190f69d75592d72b1e3c573b6a8", 831452),
+ DT_ENTRY1("slouchingbedlamglulx", "140613", "c3ee4e636fb1ef2a0438dc3a08d4c1eb", 982754),
DT_ENTRY1("spaceship", "090928", "e52390cba328a8c863150ce4651fa71f", 1429732),
DT_ENTRY1("spellbound", "160728", "c37e0e19a2fe74edc2d1df90bc97e132", 1061586),
DT_ENTRY1("spirI7wrak", "141218", "d7e58b86d1c6e06ecdc83ebbb7b20242", 2631214),
DT_ENTRY1("starlight", "151119", "ee4d2ed91518392981bf3cfd0fcf644d", 885152),
+ DT_ENTRY0("stiffymakane", "f978ca1dafb3e44f1b29bd26527f342c", 2486436),
DT_ENTRY1("subrosa", "160324", "30e7ded8624c26c04e8361d235f42c67", 1481628),
DT_ENTRY1("superluminalvagranttwin", "160316", "7beb275a3e66b7b9840019caa3041723", 1162788),
DT_ENTRY1("tacoFiction", "130422", "766be6495cb312d8270587c4d45d7e6a", 1928530),
@@ -537,6 +544,7 @@ const GlkDetectionEntry GLULXE_GAMES[] = {
DT_ENTRY1("wand", "171118", "b824638fc1d015b0837688322839ada0", 830208),
DT_ENTRY1("winterstormdraco", "150928", "b4835af78525e56420f138c2e5f6806c", 812124),
DT_ENTRY1("wishertheurgist", "160708", "4bbe0b3a29d57d1428e6cd6cf7c97fce", 824204),
+ DT_ENTRY1("wizardsniffer", "171007", "834fbcad9b93f6fab461ad4b8ff48bb5", 1240012),
DT_ENTRY1("wof", "100515", "7de6ef1ecdec5066f65b1283b9203dc6", 10185552),
DT_ENTRY1("wordoftheday", "171129", "c45a9d68e80765ceff7654366fa47328", 4506970),
DT_ENTRY1("wordsofpower", "021229 (No Sound)", "487ab63bce62d7fd86852b1974ba1a1c", 465306),
Commit: d9a9e0f91dccd7fd2c04cadf5a34c793d1842ba4
https://github.com/scummvm/scummvm/commit/d9a9e0f91dccd7fd2c04cadf5a34c793d1842ba4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-29T22:00:44-07:00
Commit Message:
ULTIMA4: Extract data tables from exes into ultima.dat
Changed paths:
A devtools/create_ultima/files/ultima4/intro/intro_base_tile.dat
A devtools/create_ultima/files/ultima4/intro/intro_beastie1.dat
A devtools/create_ultima/files/ultima4/intro/intro_beastie2.dat
A devtools/create_ultima/files/ultima4/intro/intro_map.dat
A devtools/create_ultima/files/ultima4/intro/intro_script.dat
A devtools/create_ultima/files/ultima4/intro/intro_sig.dat
A devtools/create_ultima/files/ultima4/text/endgame1.dat
A devtools/create_ultima/files/ultima4/text/endgame2.dat
A devtools/create_ultima/files/ultima4/text/hawkwind.dat
A devtools/create_ultima/files/ultima4/text/intro_gypsy.dat
A devtools/create_ultima/files/ultima4/text/intro_questions.dat
A devtools/create_ultima/files/ultima4/text/intro_text.dat
A devtools/create_ultima/files/ultima4/text/lb_keywords.dat
A devtools/create_ultima/files/ultima4/text/lb_text.dat
A devtools/create_ultima/files/ultima4/text/shrines.dat
A devtools/create_ultima/files/ultima4/text/virtue.dat
A devtools/create_ultima/ultima4_resources.cpp
A devtools/create_ultima/ultima4_resources.h
devtools/create_ultima/create_ultima.cpp
devtools/create_ultima/create_ultima.h
devtools/create_ultima/file.cpp
devtools/create_ultima/file.h
devtools/create_ultima/module.mk
devtools/create_ultima/ultima1_resources.cpp
engines/ultima/shared/core/file.cpp
engines/ultima/shared/core/file.h
engines/ultima/ultima4/controllers/intro_controller.cpp
engines/ultima/ultima4/controllers/intro_controller.h
engines/ultima/ultima4/conversation/dialogueloader.cpp
engines/ultima/ultima4/conversation/dialogueloader_hw.cpp
engines/ultima/ultima4/conversation/dialogueloader_lb.cpp
engines/ultima/ultima4/filesys/u4file.cpp
engines/ultima/ultima4/filesys/u4file.h
engines/ultima/ultima4/game/codex.cpp
engines/ultima/ultima4/map/shrine.cpp
diff --git a/devtools/create_ultima/create_ultima.cpp b/devtools/create_ultima/create_ultima.cpp
index a002c7b72f..a5651a5362 100644
--- a/devtools/create_ultima/create_ultima.cpp
+++ b/devtools/create_ultima/create_ultima.cpp
@@ -33,16 +33,18 @@
#include <stdlib.h>
#include <string.h>
#include "ultima1_resources.h"
+#include "ultima4_resources.h"
#define VERSION_NUMBER 1
-void error(const char *s, ...) {
+void error(const char *s) {
printf("%s\n", s);
exit(1);
}
int main(int argc, char *argv[]) {
extractUltima1Resources();
+ extractUltima4Resources();
return 0;
}
diff --git a/devtools/create_ultima/create_ultima.h b/devtools/create_ultima/create_ultima.h
index 7bcc3a736d..0644e20db6 100644
--- a/devtools/create_ultima/create_ultima.h
+++ b/devtools/create_ultima/create_ultima.h
@@ -23,6 +23,6 @@
#ifndef CREATE_ULTIMA_H
#define CREATE_ULTIMA_H
-extern void error(const char *s, ...);
+extern void error(const char *s);
#endif
diff --git a/devtools/create_ultima/file.cpp b/devtools/create_ultima/file.cpp
index 08f1d293b9..9b40622086 100644
--- a/devtools/create_ultima/file.cpp
+++ b/devtools/create_ultima/file.cpp
@@ -22,6 +22,19 @@
#include "file.h"
+#define MD5_COMPUTE_SIZE 1024
+
+uint32 File::computeMD5() {
+ uint32 total = 0;
+ seek(0);
+ for (int idx = 0; idx < MD5_COMPUTE_SIZE; ++idx)
+ total += readByte();
+
+ seek(0);
+ return total;
+}
+
+
void Surface::setPaletteEntry(byte index, byte r, byte g, byte b) {
byte *pal = _palette + index * 3;
pal[0] = r;
diff --git a/devtools/create_ultima/file.h b/devtools/create_ultima/file.h
index de173ff7e1..ca5a71960e 100644
--- a/devtools/create_ultima/file.h
+++ b/devtools/create_ultima/file.h
@@ -31,6 +31,9 @@
#include <cassert>
typedef unsigned char byte;
+typedef unsigned int uint32;
+
+extern void error(const char *s);
class File {
private:
@@ -38,7 +41,11 @@ private:
public:
File(const char *filename) {
_file = fopen(filename, "rb");
- assert(_file);
+ if (!_file) {
+ char buf[255];
+ sprintf(buf, "Could not open file %s", filename);
+ error(buf);
+ }
}
~File() {
fclose(_file);
@@ -64,6 +71,12 @@ public:
void read(void *buf, int size) {
fread(buf, 1, size, _file);
}
+
+ bool eof() const {
+ return feof(_file);
+ }
+
+ uint32 computeMD5();
};
class WriteFile {
@@ -96,6 +109,14 @@ public:
int write(void *buf, int size) {
return (int)fwrite(buf, 1, size, _file);
}
+
+ void write(File &src, int size) {
+ byte *data = new byte[size];
+ src.read(data, size);
+ write(data, size);
+ delete[] data;
+ }
+
void writeRepeating(byte val, size_t count) {
while (count-- > 0)
writeByte(val);
diff --git a/devtools/create_ultima/files/ultima4/intro/intro_base_tile.dat b/devtools/create_ultima/files/ultima4/intro/intro_base_tile.dat
new file mode 100644
index 0000000000..fddc46e126
--- /dev/null
+++ b/devtools/create_ultima/files/ultima4/intro/intro_base_tile.dat
@@ -0,0 +1 @@
+@88ÈÈ$ ðøMON
\ No newline at end of file
diff --git a/devtools/create_ultima/files/ultima4/intro/intro_beastie1.dat b/devtools/create_ultima/files/ultima4/intro/intro_beastie1.dat
new file mode 100644
index 0000000000..f1bc276111
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/intro/intro_beastie1.dat differ
diff --git a/devtools/create_ultima/files/ultima4/intro/intro_beastie2.dat b/devtools/create_ultima/files/ultima4/intro/intro_beastie2.dat
new file mode 100644
index 0000000000..b72992b853
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/intro/intro_beastie2.dat differ
diff --git a/devtools/create_ultima/files/ultima4/intro/intro_map.dat b/devtools/create_ultima/files/ultima4/intro/intro_map.dat
new file mode 100644
index 0000000000..c9ec03447b
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/intro/intro_map.dat differ
diff --git a/devtools/create_ultima/files/ultima4/intro/intro_script.dat b/devtools/create_ultima/files/ultima4/intro/intro_script.dat
new file mode 100644
index 0000000000..418417eb6e
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/intro/intro_script.dat differ
diff --git a/devtools/create_ultima/files/ultima4/intro/intro_sig.dat b/devtools/create_ultima/files/ultima4/intro/intro_sig.dat
new file mode 100644
index 0000000000..a4c9b91d1c
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/intro/intro_sig.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/endgame1.dat b/devtools/create_ultima/files/ultima4/text/endgame1.dat
new file mode 100644
index 0000000000..7a040d3d09
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/endgame1.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/endgame2.dat b/devtools/create_ultima/files/ultima4/text/endgame2.dat
new file mode 100644
index 0000000000..8cb5a4ad8b
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/endgame2.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/hawkwind.dat b/devtools/create_ultima/files/ultima4/text/hawkwind.dat
new file mode 100644
index 0000000000..639cbbb89b
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/hawkwind.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/intro_gypsy.dat b/devtools/create_ultima/files/ultima4/text/intro_gypsy.dat
new file mode 100644
index 0000000000..6376339a0b
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/intro_gypsy.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/intro_questions.dat b/devtools/create_ultima/files/ultima4/text/intro_questions.dat
new file mode 100644
index 0000000000..35841f9ccf
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/intro_questions.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/intro_text.dat b/devtools/create_ultima/files/ultima4/text/intro_text.dat
new file mode 100644
index 0000000000..890836a6cd
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/intro_text.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/lb_keywords.dat b/devtools/create_ultima/files/ultima4/text/lb_keywords.dat
new file mode 100644
index 0000000000..dc2dab7856
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/lb_keywords.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/lb_text.dat b/devtools/create_ultima/files/ultima4/text/lb_text.dat
new file mode 100644
index 0000000000..8072f90e9e
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/lb_text.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/shrines.dat b/devtools/create_ultima/files/ultima4/text/shrines.dat
new file mode 100644
index 0000000000..0529749159
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/shrines.dat differ
diff --git a/devtools/create_ultima/files/ultima4/text/virtue.dat b/devtools/create_ultima/files/ultima4/text/virtue.dat
new file mode 100644
index 0000000000..de017eb148
Binary files /dev/null and b/devtools/create_ultima/files/ultima4/text/virtue.dat differ
diff --git a/devtools/create_ultima/module.mk b/devtools/create_ultima/module.mk
index 2e7aba3737..6137d6d565 100644
--- a/devtools/create_ultima/module.mk
+++ b/devtools/create_ultima/module.mk
@@ -3,7 +3,8 @@ MODULE := devtools/create_ultima
MODULE_OBJS := \
create_ultima.o \
file.o \
- ultima1_resources.o
+ ultima1_resources.o \
+ ultima4_resources.o
# Set the name of the executable
TOOL_EXECUTABLE := create_ultima
diff --git a/devtools/create_ultima/ultima1_resources.cpp b/devtools/create_ultima/ultima1_resources.cpp
index 36e5d1ee28..19f02b653e 100644
--- a/devtools/create_ultima/ultima1_resources.cpp
+++ b/devtools/create_ultima/ultima1_resources.cpp
@@ -24,20 +24,9 @@
#include "file.h"
#define FILE_BUFFER_SIZE 1024
-#define MD5_COMPUTE_SIZE 1024
typedef unsigned int uint32;
-uint32 computeMD5(File &f) {
- uint32 total = 0;
- f.seek(0);
- for (int idx = 0; idx < MD5_COMPUTE_SIZE; ++idx)
- total += f.readByte();
-
- f.seek(0);
- return total;
-}
-
#define DATA_SEGMENT_OFFSET 0x40D0
#define LOGO_HEIGHT 64
#define LOGO_WIDTH1 199
@@ -106,7 +95,7 @@ void createFlags(File &in) {
void extractUltima1Resources() {
// Open up ultima1.exe for logo
File u1("ultima.exe");
- if (computeMD5(u1) != 64620)
+ if (u1.computeMD5() != 64620)
error("Unknown version of Ultima 1 ultima.exe");
// Extract the Origin logo and flag animation data
diff --git a/devtools/create_ultima/ultima4_resources.cpp b/devtools/create_ultima/ultima4_resources.cpp
new file mode 100644
index 0000000000..c4f4b87e31
--- /dev/null
+++ b/devtools/create_ultima/ultima4_resources.cpp
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "create_ultima.h"
+#include "file.h"
+
+void extractStringTable(File &src, const char *filename, int offset, int count) {
+ if (offset != -1)
+ src.seek(offset);
+
+ WriteFile dest(filename);
+ char c;
+
+ for (int idx = 0; idx < count; ++idx) {
+ do {
+ c = src.readByte();
+ dest.writeByte(c);
+ } while (c != '\0');
+ }
+}
+
+void extractData(File &src, const char *filename, int offset, int size) {
+ if (offset != -1)
+ src.seek(offset);
+
+ WriteFile dest(filename);
+ dest.write(src, size);
+}
+
+void extractUltima4Resources() {
+ // Extract string tables from avatar.exe
+ File f2("avatar.exe");
+ if (f2.computeMD5() != 55967)
+ error("Unknown version of Ultima 4 avatar.exe");
+
+ // Extract string tables
+ extractStringTable(f2, "hawkwind.dat", 74729, 53);
+ extractStringTable(f2, "lb_keywords.dat", 87581, 24);
+ extractStringTable(f2, "lb_text.dat", 87754, 25);
+ extractStringTable(f2, "virtue.dat", 0x0fc7b, 11);
+ extractStringTable(f2, "endgame1.dat", 0x0fee4, 7);
+ extractStringTable(f2, "endgame2.dat", 0x10187, 5);
+ extractStringTable(f2, "shrines.dat", 93682, 24);
+
+ // Extract string tables from title.exe
+ File f1("title.exe");
+ if (f1.computeMD5() != 115195)
+ error("Unknown version of Ultima 4 title.exe");
+
+ const int INTRO_TEXT_OFFSET = 17445 - 1; // (start at zero)
+ extractStringTable(f1, "intro_questions.dat", INTRO_TEXT_OFFSET, 28);
+ extractStringTable(f1, "intro_text.dat", -1, 24);
+ extractStringTable(f1, "intro_gypsy.dat", -1, 15);
+
+ // Extract miscellaneous data from the title.exe
+ #define INTRO_MAP_OFFSET 30339
+ #define INTRO_FIXUPDATA_OFFSET 29806
+ #define INTRO_SCRIPT_TABLE_SIZE 548
+ #define INTRO_SCRIPT_TABLE_OFFSET 30434
+ #define INTRO_BASETILE_TABLE_SIZE 15
+ #define INTRO_BASETILE_TABLE_OFFSET 16584
+ #define BEASTIE1_FRAMES 0x80
+ #define BEASTIE2_FRAMES 0x40
+ #define BEASTIE_FRAME_TABLE_OFFSET 0x7380
+ #define BEASTIE1_FRAMES_OFFSET 0
+ #define BEASTIE2_FRAMES_OFFSET 0x78
+ #define INTRO_MAP_HEIGHT 5
+ #define INTRO_MAP_WIDTH 19
+
+ extractData(f1, "intro_sig.dat", INTRO_FIXUPDATA_OFFSET, 533);
+ extractData(f1, "intro_map.dat", INTRO_MAP_OFFSET,
+ INTRO_MAP_WIDTH * INTRO_MAP_HEIGHT);
+ extractData(f1, "intro_script.dat", INTRO_SCRIPT_TABLE_OFFSET, INTRO_SCRIPT_TABLE_SIZE);
+ extractData(f1, "intro_base_tile.dat", INTRO_BASETILE_TABLE_OFFSET, INTRO_BASETILE_TABLE_SIZE);
+ extractData(f1, "intro_beastie1.dat", BEASTIE_FRAME_TABLE_OFFSET + BEASTIE1_FRAMES_OFFSET,
+ BEASTIE1_FRAMES);
+ extractData(f1, "intro_beastie2.dat", BEASTIE_FRAME_TABLE_OFFSET + BEASTIE2_FRAMES_OFFSET,
+ BEASTIE2_FRAMES);
+}
diff --git a/devtools/create_ultima/ultima4_resources.h b/devtools/create_ultima/ultima4_resources.h
new file mode 100644
index 0000000000..0180737997
--- /dev/null
+++ b/devtools/create_ultima/ultima4_resources.h
@@ -0,0 +1,28 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ULTIMA4_RESOURCES_H
+#define ULTIMA4_RESOURCES_H
+
+extern void extractUltima4Resources();
+
+#endif
diff --git a/engines/ultima/shared/core/file.cpp b/engines/ultima/shared/core/file.cpp
index 9a426351bf..7def6fc839 100644
--- a/engines/ultima/shared/core/file.cpp
+++ b/engines/ultima/shared/core/file.cpp
@@ -41,24 +41,32 @@ Common::String readStringFromStream(Common::SeekableReadStream *s) {
#define ERROR error("Could not open file - %s", name.c_str())
-File::File(const Common::String &name) : Common::File() {
+File::File(const Common::String &name) : Common::File(), _filesize(-1) {
+ close();
+
if (!Common::File::open(name))
ERROR;
}
bool File::open(const Common::String &name) {
+ close();
+
if (!Common::File::open(name))
ERROR;
return true;
}
bool File::open(const Common::String &name, Common::Archive &archive) {
+ close();
+
if (!Common::File::open(name, archive))
ERROR;
return true;
}
bool File::open(const Common::FSNode &node) {
+ close();
+
Common::String name = node.getName();
if (!Common::File::open(node))
ERROR;
@@ -66,16 +74,30 @@ bool File::open(const Common::FSNode &node) {
}
bool File::open(SeekableReadStream *stream, const Common::String &name) {
+ close();
+
if (!Common::File::open(stream, name))
ERROR;
return true;
}
+void File::close() {
+ _filesize = -1;
+ Common::File::close();
+}
+
+bool File::eof() {
+ if (_filesize == -1)
+ _filesize = size();
+
+ return pos() >= _filesize;
+}
+
Common::String File::readString() {
Common::String result;
char c;
- while (pos() < size() && (c = (char)readByte()) != '\0')
+ while (!eof() && (c = (char)readByte()) != '\0')
result += c;
return result;
diff --git a/engines/ultima/shared/core/file.h b/engines/ultima/shared/core/file.h
index 6b6bfbbba7..75cb6e6fa6 100644
--- a/engines/ultima/shared/core/file.h
+++ b/engines/ultima/shared/core/file.h
@@ -33,9 +33,10 @@ namespace Shared {
* Simple ScummVM File descendent that throws a wobbly if the file it tries to open isn't present
*/
class File : public Common::File {
+private:
+ int32 _filesize;
public:
- File() : Common::File() {
- }
+ File() : Common::File(), _filesize(-1) {}
File(const Common::String &name);
/**
@@ -64,6 +65,16 @@ public:
*/
bool open(SeekableReadStream *stream, const Common::String &name) override;
+ /**
+ * Close the currently open file
+ */
+ void close();
+
+ /**
+ * Differing eof that returns true when pos == size as well as beyond
+ */
+ bool eof();
+
/**
* Reads in a null terminated string
*/
diff --git a/engines/ultima/ultima4/controllers/intro_controller.cpp b/engines/ultima/ultima4/controllers/intro_controller.cpp
index ff5ceee224..c51c5bc4f1 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.cpp
+++ b/engines/ultima/ultima4/controllers/intro_controller.cpp
@@ -62,6 +62,11 @@ IntroController *g_intro;
#define GYP_SEGUE1 13
#define GYP_SEGUE2 14
+#define INTRO_SCRIPT_TABLE_SIZE 548
+#define INTRO_BASETILE_TABLE_SIZE 15
+#define BEASTIE1_FRAMES 0x80
+#define BEASTIE2_FRAMES 0x40
+
class IntroObjectState {
public:
IntroObjectState() : x(0), y(0), tile(0) {}
@@ -69,19 +74,6 @@ public:
MapTile tile; /* base tile + tile frame */
};
-const int IntroBinData::INTRO_TEXT_OFFSET = 17445 - 1; // (start at zero)
-const int IntroBinData::INTRO_MAP_OFFSET = 30339;
-const int IntroBinData::INTRO_FIXUPDATA_OFFSET = 29806;
-const int IntroBinData::INTRO_SCRIPT_TABLE_SIZE = 548;
-const int IntroBinData::INTRO_SCRIPT_TABLE_OFFSET = 30434;
-const int IntroBinData::INTRO_BASETILE_TABLE_SIZE = 15;
-const int IntroBinData::INTRO_BASETILE_TABLE_OFFSET = 16584;
-const int IntroBinData::BEASTIE1_FRAMES = 0x80;
-const int IntroBinData::BEASTIE2_FRAMES = 0x40;
-const int IntroBinData::BEASTIE_FRAME_TABLE_OFFSET = 0x7380;
-const int IntroBinData::BEASTIE1_FRAMES_OFFSET = 0;
-const int IntroBinData::BEASTIE2_FRAMES_OFFSET = 0x78;
-
void IntroController::AnimElement::shufflePlotData() {
for (int idx = 0; idx < ((int)_plotData.size() - 1); ++idx) {
// Pick a random element from the remainder of the plot data
@@ -116,65 +108,65 @@ IntroBinData::~IntroBinData() {
_introGypsy.clear();
}
+void IntroBinData::openFile(Shared::File &f, const Common::String &name) {
+ f.open(Common::String::format("data/intro/%s.dat", name.c_str()));
+}
+
bool IntroBinData::load() {
int i;
- Common::File *title = u4fopen("title.exe");
- if (!title)
- return false;
+ _introQuestions = u4read_stringtable("intro_questions");
+ _introText = u4read_stringtable("intro_text");
+ _introGypsy = u4read_stringtable("intro_gypsy");
- _introQuestions = u4read_stringtable(title, INTRO_TEXT_OFFSET, 28);
- _introText = u4read_stringtable(title, -1, 24);
- _introGypsy = u4read_stringtable(title, -1, 15);
-
- /* clean up stray newlines at end of strings */
+ // Clean up stray newlines at end of strings
for (i = 0; i < 15; i++)
trim(_introGypsy[i]);
if (_sigData)
delete _sigData;
_sigData = new byte[533];
- u4fseek(title, INTRO_FIXUPDATA_OFFSET, SEEK_SET);
- u4fread(_sigData, 1, 533, title);
- u4fseek(title, INTRO_MAP_OFFSET, SEEK_SET);
+ Shared::File f;
+ openFile(f, "intro_sig");
+ f.read(_sigData, 533);
+
+ openFile(f, "intro_map");
_introMap.clear();
_introMap.resize(INTRO_MAP_WIDTH * INTRO_MAP_HEIGHT);
for (i = 0; i < INTRO_MAP_HEIGHT * INTRO_MAP_WIDTH; i++)
- _introMap[i] = g_tileMaps->get("base")->translate(u4fgetc(title));
+ _introMap[i] = g_tileMaps->get("base")->translate(f.readByte());
- u4fseek(title, INTRO_SCRIPT_TABLE_OFFSET, SEEK_SET);
+ openFile(f, "intro_script");
_scriptTable = new byte[INTRO_SCRIPT_TABLE_SIZE];
for (i = 0; i < INTRO_SCRIPT_TABLE_SIZE; i++)
- _scriptTable[i] = u4fgetc(title);
+ _scriptTable[i] = f.readByte();
- u4fseek(title, INTRO_BASETILE_TABLE_OFFSET, SEEK_SET);
+ openFile(f, "intro_base_tile");
_baseTileTable = new Tile*[INTRO_BASETILE_TABLE_SIZE];
for (i = 0; i < INTRO_BASETILE_TABLE_SIZE; i++) {
- MapTile tile = g_tileMaps->get("base")->translate(u4fgetc(title));
+ MapTile tile = g_tileMaps->get("base")->translate(f.readByte());
_baseTileTable[i] = g_tileSets->get("base")->get(tile._id);
}
/* --------------------------
load beastie frame table 1
-------------------------- */
+ openFile(f, "intro_beastie1");
_beastie1FrameTable = new byte[BEASTIE1_FRAMES];
- u4fseek(title, BEASTIE_FRAME_TABLE_OFFSET + BEASTIE1_FRAMES_OFFSET, SEEK_SET);
for (i = 0; i < BEASTIE1_FRAMES; i++) {
- _beastie1FrameTable[i] = u4fgetc(title);
+ _beastie1FrameTable[i] = f.readByte();
}
/* --------------------------
load beastie frame table 2
-------------------------- */
+ openFile(f, "intro_beastie2");
_beastie2FrameTable = new byte[BEASTIE2_FRAMES];
- u4fseek(title, BEASTIE_FRAME_TABLE_OFFSET + BEASTIE2_FRAMES_OFFSET, SEEK_SET);
for (i = 0; i < BEASTIE2_FRAMES; i++) {
- _beastie2FrameTable[i] = u4fgetc(title);
+ _beastie2FrameTable[i] = f.readByte();
}
- u4fclose(title);
-
return true;
}
@@ -330,7 +322,7 @@ bool IntroController::init() {
_sleepCycles = 0;
_scrPos = 0;
- _objectStateTable = new IntroObjectState[IntroBinData::INTRO_BASETILE_TABLE_SIZE];
+ _objectStateTable = new IntroObjectState[INTRO_BASETILE_TABLE_SIZE];
_backgroundArea.reinit();
_menuArea.reinit();
@@ -533,7 +525,7 @@ void IntroController::drawMapAnimated() {
int i;
// draw animated objects
- for (i = 0; i < IntroBinData::INTRO_BASETILE_TABLE_SIZE; i++)
+ for (i = 0; i < INTRO_BASETILE_TABLE_SIZE; i++)
if (_objectStateTable[i].tile != 0) {
Std::vector<MapTile> tiles;
tiles.push_back(_objectStateTable[i].tile);
@@ -949,9 +941,9 @@ void IntroController::timerFired() {
if (_beastiesVisible)
drawBeasties();
- if (xu4_random(2) && ++_beastie1Cycle >= IntroBinData::BEASTIE1_FRAMES)
+ if (xu4_random(2) && ++_beastie1Cycle >= BEASTIE1_FRAMES)
_beastie1Cycle = 0;
- if (xu4_random(2) && ++_beastie2Cycle >= IntroBinData::BEASTIE2_FRAMES)
+ if (xu4_random(2) && ++_beastie2Cycle >= BEASTIE2_FRAMES)
_beastie2Cycle = 0;
}
@@ -1399,7 +1391,7 @@ void IntroController::preloadMap() {
_mapArea.loadTile(_binData->_introMap[x + (y * INTRO_MAP_WIDTH)]);
// draw animated objects
- for (i = 0; i < IntroBinData::INTRO_BASETILE_TABLE_SIZE; i++) {
+ for (i = 0; i < INTRO_BASETILE_TABLE_SIZE; i++) {
if (_objectStateTable[i].tile != 0)
_mapArea.loadTile(_objectStateTable[i].tile);
}
diff --git a/engines/ultima/ultima4/controllers/intro_controller.h b/engines/ultima/ultima4/controllers/intro_controller.h
index 4ba90a9139..98e275a7d5 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.h
+++ b/engines/ultima/ultima4/controllers/intro_controller.h
@@ -30,6 +30,7 @@
#include "ultima/ultima4/game/textview.h"
#include "ultima/ultima4/gfx/imageview.h"
#include "ultima/ultima4/map/tileview.h"
+#include "ultima/shared/core/file.h"
namespace Ultima {
namespace Ultima4 {
@@ -41,20 +42,12 @@ class Tile;
* Binary data loaded from the U4DOS title.exe file.
*/
class IntroBinData {
+private:
+ // disallow assignments, copy contruction
+ IntroBinData(const IntroBinData &);
+ const IntroBinData &operator=(const IntroBinData &);
+ void openFile(Shared::File &f, const Common::String &name);
public:
- const static int INTRO_TEXT_OFFSET;
- const static int INTRO_MAP_OFFSET;
- const static int INTRO_FIXUPDATA_OFFSET;
- const static int INTRO_SCRIPT_TABLE_SIZE;
- const static int INTRO_SCRIPT_TABLE_OFFSET;
- const static int INTRO_BASETILE_TABLE_SIZE;
- const static int INTRO_BASETILE_TABLE_OFFSET;
- const static int BEASTIE1_FRAMES;
- const static int BEASTIE2_FRAMES;
- const static int BEASTIE_FRAME_TABLE_OFFSET;
- const static int BEASTIE1_FRAMES_OFFSET;
- const static int BEASTIE2_FRAMES_OFFSET;
-
IntroBinData();
~IntroBinData();
@@ -69,11 +62,6 @@ public:
Std::vector<Common::String> _introText;
Std::vector<Common::String> _introQuestions;
Std::vector<Common::String> _introGypsy;
-
-private:
- // disallow assignments, copy contruction
- IntroBinData(const IntroBinData &);
- const IntroBinData &operator=(const IntroBinData &);
};
diff --git a/engines/ultima/ultima4/conversation/dialogueloader.cpp b/engines/ultima/ultima4/conversation/dialogueloader.cpp
index 9b2e13f0be..dffcb48382 100644
--- a/engines/ultima/ultima4/conversation/dialogueloader.cpp
+++ b/engines/ultima/ultima4/conversation/dialogueloader.cpp
@@ -25,6 +25,7 @@
#include "ultima/ultima4/conversation/dialogueloader_hw.h"
#include "ultima/ultima4/conversation/dialogueloader_lb.h"
#include "ultima/ultima4/conversation/dialogueloader_tlk.h"
+#include "ultima/ultima4/filesys/u4file.h"
namespace Ultima {
namespace Ultima4 {
diff --git a/engines/ultima/ultima4/conversation/dialogueloader_hw.cpp b/engines/ultima/ultima4/conversation/dialogueloader_hw.cpp
index 7f9c37b0d4..49c16c1bcc 100644
--- a/engines/ultima/ultima4/conversation/dialogueloader_hw.cpp
+++ b/engines/ultima/ultima4/conversation/dialogueloader_hw.cpp
@@ -53,12 +53,8 @@ Response *hawkwindGetIntro(const DynamicResponse *dynResp);
* A special case dialogue loader for Hawkwind.
*/
Dialogue *U4HWDialogueLoader::load(void *source) {
- Common::File *avatar = u4fopen("avatar.exe");
- if (!avatar)
- return nullptr;
-
Std::vector<Common::String> &hawkwindText = g_ultima->_hawkwindText;
- hawkwindText = u4read_stringtable(avatar, 74729, 53);
+ hawkwindText = u4read_stringtable("hawkwind");
Dialogue *dlg = new Dialogue();
dlg->setTurnAwayProb(0);
diff --git a/engines/ultima/ultima4/conversation/dialogueloader_lb.cpp b/engines/ultima/ultima4/conversation/dialogueloader_lb.cpp
index 9d43671a37..a4f2011b70 100644
--- a/engines/ultima/ultima4/conversation/dialogueloader_lb.cpp
+++ b/engines/ultima/ultima4/conversation/dialogueloader_lb.cpp
@@ -35,19 +35,15 @@ Response *lordBritishGetIntro(const DynamicResponse *resp);
/**
* A special case dialogue loader for Lord British. Loads most of the
- * keyword/responses from a hardcoded location in avatar.exe. The
- * "help" response is a special case that changes based on the
- * current party status.
+ * keyword/responses from a string table originally extracted from the
+ * game executable. The "help" response is a special case that changes
+ * based on the current party status.
*/
Dialogue *U4LBDialogueLoader::load(void *source) {
- Common::File *avatar = u4fopen("avatar.exe");
- if (!avatar)
- return nullptr;
-
- Std::vector<Common::String> lbKeywords = u4read_stringtable(avatar, 87581, 24);
- /* There's a \0 in the 19th Common::String so we get a
- spurious 20th entry */
- Std::vector<Common::String> lbText = u4read_stringtable(avatar, 87754, 25);
+ Std::vector<Common::String> lbKeywords = u4read_stringtable("lb_keywords");
+
+ // There's a \0 in the 19th Common::String so we get a spurious 20th entry
+ Std::vector<Common::String> lbText = u4read_stringtable("lb_text");
for (int i = 20; i < 24; i++)
lbText[i] = lbText[i + 1];
lbText.pop_back();
diff --git a/engines/ultima/ultima4/filesys/u4file.cpp b/engines/ultima/ultima4/filesys/u4file.cpp
index 4c281bb466..33640ba95b 100644
--- a/engines/ultima/ultima4/filesys/u4file.cpp
+++ b/engines/ultima/ultima4/filesys/u4file.cpp
@@ -22,6 +22,7 @@
#include "ultima/ultima4/filesys/u4file.h"
#include "ultima/ultima4/core/utils.h"
+#include "ultima/shared/core/file.h"
#include "common/debug.h"
#include "common/file.h"
#include "common/savefile.h"
@@ -78,24 +79,13 @@ long u4flength(Common::File *f) {
return f->size();
}
-Std::vector<Common::String> u4read_stringtable(Common::File *f, long offset, int nstrings) {
- Common::String buffer;
- int i;
+Std::vector<Common::String> u4read_stringtable(const Common::String &filename) {
+ Shared::File f(Common::String::format("data/text/%s.dat", filename.c_str()));
Std::vector<Common::String> strs;
+ Common::String line;
- ASSERT(offset < u4flength(f), "offset begins beyond end of file");
-
- if (offset != -1)
- f->seek(offset, SEEK_SET);
- for (i = 0; i < nstrings; i++) {
- char c;
- buffer.clear();
-
- while ((c = f->readByte()) != '\0')
- buffer += c;
-
- strs.push_back(buffer);
- }
+ while (!f.eof())
+ strs.push_back(f.readString());
return strs;
}
diff --git a/engines/ultima/ultima4/filesys/u4file.h b/engines/ultima/ultima4/filesys/u4file.h
index 8121a61681..4069766294 100644
--- a/engines/ultima/ultima4/filesys/u4file.h
+++ b/engines/ultima/ultima4/filesys/u4file.h
@@ -52,7 +52,7 @@ extern long u4flength(Common::File *f);
* are read from the given offset, or the current file position if
* offset is -1.
*/
-extern Std::vector<Common::String> u4read_stringtable(Common::File *f, long offset, int nstrings);
+extern Std::vector<Common::String> u4read_stringtable(const Common::String &filename);
extern Common::String u4find_music(const Common::String &fname);
extern Common::String u4find_sound(const Common::String &fname);
diff --git a/engines/ultima/ultima4/game/codex.cpp b/engines/ultima/ultima4/game/codex.cpp
index fc1dd8c747..2e82d89b61 100644
--- a/engines/ultima/ultima4/game/codex.cpp
+++ b/engines/ultima/ultima4/game/codex.cpp
@@ -48,17 +48,9 @@ Codex::~Codex() {
}
int Codex::init() {
- Common::File *avatar;
-
- avatar = u4fopen("avatar.exe");
- if (!avatar)
- return 0;
-
- _virtueQuestions = u4read_stringtable(avatar, 0x0fc7b, 11);
- _endgameText1 = u4read_stringtable(avatar, 0x0fee4, 7);
- _endgameText2 = u4read_stringtable(avatar, 0x10187, 5);
-
- u4fclose(avatar);
+ _virtueQuestions = u4read_stringtable("virtue");
+ _endgameText1 = u4read_stringtable("endgame1");
+ _endgameText2 = u4read_stringtable("endgame2");
return 1;
}
diff --git a/engines/ultima/ultima4/map/shrine.cpp b/engines/ultima/ultima4/map/shrine.cpp
index 7368eb5784..3770346720 100644
--- a/engines/ultima/ultima4/map/shrine.cpp
+++ b/engines/ultima/ultima4/map/shrine.cpp
@@ -57,12 +57,7 @@ Shrines::~Shrines() {
}
void Shrines::loadAdvice() {
- Common::File *avatar = u4fopen("avatar.exe");
- if (!avatar)
- return;
-
- _advice = u4read_stringtable(avatar, 93682, 24);
- u4fclose(avatar);
+ _advice = u4read_stringtable("shrines");
}
/*-------------------------------------------------------------------*/
Commit: e9b4d18ad24ee608c50d0eb42f1c1f008cedd4e2
https://github.com/scummvm/scummvm/commit/e9b4d18ad24ee608c50d0eb42f1c1f008cedd4e2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-29T22:00:44-07:00
Commit Message:
ULTIMA4: Stop keypresses being drawn during intro
Changed paths:
engines/ultima/ultima4/game/context.cpp
diff --git a/engines/ultima/ultima4/game/context.cpp b/engines/ultima/ultima4/game/context.cpp
index c21ca7129c..91ef21e8f1 100644
--- a/engines/ultima/ultima4/game/context.cpp
+++ b/engines/ultima/ultima4/game/context.cpp
@@ -28,7 +28,7 @@ namespace Ultima4 {
Context *g_context;
Context::Context() : _party(nullptr), _location(nullptr),
- _line(0), _col(0), _stats(nullptr), _moonPhase(0),
+ _line(999), _col(0), _stats(nullptr), _moonPhase(0),
_windDirection(0), _windCounter(0), _windLock(false),
_aura(nullptr), _horseSpeed(0), _opacity(0),
_transportContext(TRANSPORT_ANY), _lastCommandTime(0),
More information about the Scummvm-git-logs
mailing list