[Scummvm-git-logs] scummvm master -> 681fbe53b24e6c27b4a048fb97bebebbd110fc89
npjg
noreply at scummvm.org
Sat Jan 11 18:29:04 UTC 2025
This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d56082609c MEDIASTATION: Remove unnecessary parentheses
6c7f1e8831 MEDIASTATION: Stub out Font asset
0aaa1a4f28 MEDIASTATION: Stub out Text asset
d9acff937a MEDIASTATION: Read the mouse active polygon as a point array
4edb0751df MEDIASTATION: Remove unused warning code in Sound
74be424053 MEDIASTATION: Fix off-by-one bug in Sound chunk reading
d0fc75d86e MEDIASTATION: Add debug statements to Sound chunk reading
29cf835042 MEDIASTATION: Explain setting sprite frame rate to 10
3ea63df349 MEDIASTATION: Partially implement Unk2 opcode
07d1b38ab7 MEDIASTATION: Implement reading string operand
681fbe53b2 MEDIASTATION: Partially implement calling methods through variables
Commit: d56082609c88de7898746427d33152c2a3a62a9a
https://github.com/scummvm/scummvm/commit/d56082609c88de7898746427d33152c2a3a62a9a
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Remove unnecessary parentheses
Changed paths:
engines/mediastation/mediascript/codechunk.cpp
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index c9fa38b77ad..436504dbd9a 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -149,7 +149,7 @@ Operand CodeChunk::executeNextStatement() {
break;
}
- case (kInstructionTypeOperand): {
+ case kInstructionTypeOperand: {
OperandType operandType = static_cast<OperandType>(Datum(*_bytecode).u.i);
debugC(8, kDebugScript, " *** Operand %d ***", static_cast<uint>(operandType));
Operand operand(operandType);
@@ -189,7 +189,7 @@ Operand CodeChunk::executeNextStatement() {
break;
}
- case (kInstructionTypeVariableRef): {
+ case kInstructionTypeVariableRef: {
// TODO: Add debug printout for this.
uint32 id = Datum(*_bytecode).u.i;
VariableScope scope = VariableScope(Datum(*_bytecode).u.i);
Commit: 6c7f1e88317d68afbd0428d1d56d9ac8e1e0060f
https://github.com/scummvm/scummvm/commit/6c7f1e88317d68afbd0428d1d56d9ac8e1e0060f
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Stub out Font asset
Changed paths:
A engines/mediastation/assets/font.cpp
A engines/mediastation/assets/font.h
engines/mediastation/context.cpp
engines/mediastation/module.mk
diff --git a/engines/mediastation/assets/font.cpp b/engines/mediastation/assets/font.cpp
new file mode 100644
index 00000000000..3f753356326
--- /dev/null
+++ b/engines/mediastation/assets/font.cpp
@@ -0,0 +1,54 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "mediastation/debugchannels.h"
+#include "mediastation/assets/font.h"
+
+namespace MediaStation {
+
+FontGlyph::FontGlyph(Chunk &chunk, uint asciiCode, uint unk1, uint unk2, BitmapHeader *header) : Bitmap(chunk, header) {
+ _asciiCode = asciiCode;
+ _unk1 = unk1;
+ _unk2 = unk2;
+}
+
+Font::~Font() {
+ _glyphs.clear();
+}
+
+Operand Font::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
+ error("Font::callMethod(): Font does not have any callable methods");
+}
+
+void Font::readChunk(Chunk &chunk) {
+ debugC(5, kDebugLoading, "Font::readChunk(): Reading font glyph (@0x%llx)", static_cast<long long int>(chunk.pos()));
+ uint asciiCode = Datum(chunk).u.i;
+ int unk1 = Datum(chunk).u.i;
+ int unk2 = Datum(chunk).u.i;
+ BitmapHeader *header = new BitmapHeader(chunk);
+ FontGlyph *glyph = new FontGlyph(chunk, asciiCode, unk1, unk2, header);
+ if (_glyphs.getValOrDefault(asciiCode) != nullptr) {
+ error("Font::readChunk(): Glyph for ASCII code 0x%x already exists", asciiCode);
+ }
+ _glyphs.setVal(asciiCode, glyph);
+}
+
+} // End of namespace MediaStation
diff --git a/engines/mediastation/assets/font.h b/engines/mediastation/assets/font.h
new file mode 100644
index 00000000000..56207d79f75
--- /dev/null
+++ b/engines/mediastation/assets/font.h
@@ -0,0 +1,60 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MEDIASTATION_FONT_H
+#define MEDIASTATION_FONT_H
+
+#include "mediastation/asset.h"
+#include "mediastation/assetheader.h"
+#include "mediastation/bitmap.h"
+#include "mediastation/mediascript/operand.h"
+
+namespace MediaStation {
+
+class FontGlyph : public Bitmap {
+public:
+ FontGlyph(Chunk &chunk, uint asciiCode, uint unk1, uint unk2, BitmapHeader *header);
+ uint _asciiCode = 0;
+
+private:
+ int _unk1 = 0;
+ int _unk2 = 0;
+};
+
+class Font : public Asset {
+public:
+ Font(AssetHeader *header) : Asset(header) {};
+ ~Font();
+
+ virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override;
+
+ virtual void readChunk(Chunk &chunk) override;
+
+private:
+ Common::HashMap<uint, FontGlyph *> _glyphs;
+
+ // Method implementations.
+ // No methods are implemented as of now.
+};
+
+} // End of namespace MediaStation
+
+#endif
\ No newline at end of file
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index 6adb2273db9..b35fd309467 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -35,6 +35,7 @@
#include "mediastation/assets/hotspot.h"
#include "mediastation/assets/timer.h"
#include "mediastation/assets/screen.h"
+#include "mediastation/assets/font.h"
namespace MediaStation {
@@ -236,6 +237,10 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
_screenAsset = header;
break;
+ case kAssetTypeFont:
+ asset = new Font(header);
+ break;
+
default:
error("Context::readHeaderSection(): No class for asset type 0x%x (@0x%llx)", static_cast<uint>(header->_type), static_cast<long long int>(chunk.pos()));
}
diff --git a/engines/mediastation/module.mk b/engines/mediastation/module.mk
index 6ddd845989a..4cc0ea75a87 100644
--- a/engines/mediastation/module.mk
+++ b/engines/mediastation/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS = \
assets/timer.o \
assets/canvas.o \
assets/screen.o \
+ assets/font.o \
mediascript/eventhandler.o \
mediascript/codechunk.o \
mediascript/function.o \
Commit: 0aaa1a4f28c77ca48374884c1dd15d73625223f2
https://github.com/scummvm/scummvm/commit/0aaa1a4f28c77ca48374884c1dd15d73625223f2
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Stub out Text asset
Changed paths:
A engines/mediastation/assets/text.cpp
A engines/mediastation/assets/text.h
engines/mediastation/assetheader.cpp
engines/mediastation/assetheader.h
engines/mediastation/context.cpp
engines/mediastation/module.mk
diff --git a/engines/mediastation/assetheader.cpp b/engines/mediastation/assetheader.cpp
index 0daa5985a39..885b9d52df7 100644
--- a/engines/mediastation/assetheader.cpp
+++ b/engines/mediastation/assetheader.cpp
@@ -50,6 +50,7 @@ AssetHeader::~AssetHeader() {
delete _name;
delete _startPoint;
delete _endPoint;
+ delete _text;
}
void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk) {
@@ -267,6 +268,43 @@ void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk)
break;
}
+ case kAssetHeaderEditable: {
+ _editable = Datum(chunk).u.i;
+ break;
+ }
+
+ case kAssetHeaderFontId: {
+ _fontAssetId = Datum(chunk).u.i;
+ break;
+ }
+
+ case kAssetHeaderTextMaxLength: {
+ _maxTextLength = Datum(chunk).u.i;
+ break;
+ }
+
+ case kAssetHeaderInitialText: {
+ _text = Datum(chunk).u.string;
+ break;
+ }
+
+ case kAssetHeaderTextJustification: {
+ _justification = static_cast<TextJustification>(Datum(chunk).u.i);
+ break;
+ }
+
+ case kAssetHeaderTextPosition: {
+ _position = static_cast<TextPosition>(Datum(chunk).u.i);
+ break;
+ }
+
+ case kAssetHeaderTextCharacterClass: {
+ CharacterClass characterClass;
+ characterClass.firstAsciiCode = Datum(chunk).u.i;
+ characterClass.lastAsciiCode = Datum(chunk).u.i;
+ _acceptedInput.push_back(characterClass);
+ break;
+ }
default: {
error("AssetHeader::readSection(): Unknown section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
diff --git a/engines/mediastation/assetheader.h b/engines/mediastation/assetheader.h
index 90e41d54c4c..f62e1bbd9c8 100644
--- a/engines/mediastation/assetheader.h
+++ b/engines/mediastation/assetheader.h
@@ -119,6 +119,34 @@ enum AssetHeaderSectionType {
kAssetHeaderCylindricalX = 0x0772,
kAssetHeaderCylindricalY = 0x0773,
kAssetHeaderAssetName = 0x0bb8,
+
+ // TEXT FIELDS.
+ kAssetHeaderEditable = 0x03eb,
+ kAssetHeaderFontId = 0x0258,
+ kAssetHeaderInitialText = 0x0259,
+ kAssetHeaderTextMaxLength = 0x25a,
+ kAssetHeaderTextJustification = 0x025b,
+ kAssetHeaderTextPosition = 0x25f,
+ kAssetHeaderTextUnk1 = 0x262,
+ kAssetHeaderTextUnk2 = 0x263,
+ kAssetHeaderTextCharacterClass = 0x0266
+};
+
+enum TextJustification {
+ kTextJustificationLeft = 0x25c,
+ kTextJustificationRight = 0x25d,
+ kTextJustificationCenter = 0x25e
+};
+
+enum TextPosition {
+ kTextPositionMiddle = 0x25e,
+ kTextPositionTop = 0x260,
+ kTextPositionBotom = 0x261
+};
+
+struct CharacterClass {
+ uint firstAsciiCode = 0;
+ uint lastAsciiCode = 0;
};
enum SoundEncoding {
@@ -174,6 +202,14 @@ public:
Common::Array<EventHandler *> _inputHandlers;
Common::Array<EventHandler *> _loadCompleteHandlers;
+ // TEXT FIELDS.
+ Common::String *_text = nullptr;
+ uint _maxTextLength = 0;
+ uint _fontAssetId = 0;
+ TextJustification _justification;
+ TextPosition _position;
+ Common::Array<CharacterClass> _acceptedInput;
+
private:
void readSection(AssetHeaderSectionType sectionType, Chunk &chunk);
AssetHeaderSectionType getSectionType(Chunk &chunk);
diff --git a/engines/mediastation/assets/text.cpp b/engines/mediastation/assets/text.cpp
new file mode 100644
index 00000000000..d82996a8466
--- /dev/null
+++ b/engines/mediastation/assets/text.cpp
@@ -0,0 +1,52 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "mediastation/assets/text.h"
+
+namespace MediaStation {
+
+Operand Text::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
+ switch (methodId) {
+ case kTextMethod: {
+ assert(args.empty());
+ error("Text::callMethod(): Text() method not implemented yet");
+ }
+
+ case kSetTextMethod: {
+ assert(args.size() == 1);
+ error("Text::callMethod(): getText() method not implemented yet");
+ }
+
+ default: {
+ error("Got unimplemented method ID %d", methodId);
+ }
+ }
+}
+
+Common::String *Text::text() const {
+ return _header->_text;
+}
+
+void Text::setText(Common::String *text) {
+ error("Text::setText(): Setting text not implemented yet");
+}
+
+} // End of namespace MediaStation
diff --git a/engines/mediastation/assets/text.h b/engines/mediastation/assets/text.h
new file mode 100644
index 00000000000..4b2eff653cc
--- /dev/null
+++ b/engines/mediastation/assets/text.h
@@ -0,0 +1,45 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MEDIASTATION_TEXT_H
+#define MEDIASTATION_TEXT_H
+
+#include "mediastation/asset.h"
+#include "mediastation/assetheader.h"
+#include "mediastation/mediascript/operand.h"
+
+namespace MediaStation {
+
+class Text : public Asset {
+public:
+ Text(AssetHeader *header) : Asset(header) {};
+
+ virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override;
+
+private:
+ // Method implementations.
+ Common::String *text() const;
+ void setText(Common::String *text);
+};
+
+} // End of namespace MediaStation
+
+#endif
\ No newline at end of file
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index b35fd309467..0036136929e 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -36,6 +36,7 @@
#include "mediastation/assets/timer.h"
#include "mediastation/assets/screen.h"
#include "mediastation/assets/font.h"
+#include "mediastation/assets/text.h"
namespace MediaStation {
@@ -241,6 +242,10 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
asset = new Font(header);
break;
+ case kAssetTypeText:
+ asset = new Text(header);
+ break;
+
default:
error("Context::readHeaderSection(): No class for asset type 0x%x (@0x%llx)", static_cast<uint>(header->_type), static_cast<long long int>(chunk.pos()));
}
diff --git a/engines/mediastation/module.mk b/engines/mediastation/module.mk
index 4cc0ea75a87..d69678e6df4 100644
--- a/engines/mediastation/module.mk
+++ b/engines/mediastation/module.mk
@@ -19,6 +19,7 @@ MODULE_OBJS = \
assets/canvas.o \
assets/screen.o \
assets/font.o \
+ assets/text.o \
mediascript/eventhandler.o \
mediascript/codechunk.o \
mediascript/function.o \
Commit: d9acff937af6593618fe3a897a8951905e3e0daf
https://github.com/scummvm/scummvm/commit/d9acff937af6593618fe3a897a8951905e3e0daf
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Read the mouse active polygon as a point array
Changed paths:
engines/mediastation/assetheader.cpp
engines/mediastation/assetheader.h
diff --git a/engines/mediastation/assetheader.cpp b/engines/mediastation/assetheader.cpp
index 885b9d52df7..4c36c20c644 100644
--- a/engines/mediastation/assetheader.cpp
+++ b/engines/mediastation/assetheader.cpp
@@ -45,7 +45,7 @@ AssetHeader::AssetHeader(Chunk &chunk) {
AssetHeader::~AssetHeader() {
delete _boundingBox;
- delete _mouseActiveArea;
+ _mouseActiveArea.clear();
delete _palette;
delete _name;
delete _startPoint;
@@ -149,7 +149,11 @@ void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk)
}
case kAssetHeaderMouseActiveArea: {
- _mouseActiveArea = Datum(chunk, kDatumTypePolygon).u.polygon;
+ uint16 total_points = Datum(chunk, kDatumTypeUint16_1).u.i;
+ for (int i = 0; i < total_points; i++) {
+ Common::Point *point = Datum(chunk, kDatumTypePoint2).u.point;
+ _mouseActiveArea.push_back(point);
+ }
break;
}
diff --git a/engines/mediastation/assetheader.h b/engines/mediastation/assetheader.h
index f62e1bbd9c8..6489afbcea1 100644
--- a/engines/mediastation/assetheader.h
+++ b/engines/mediastation/assetheader.h
@@ -168,7 +168,7 @@ public:
ChunkReference _audioChunkReference = 0;
ChunkReference _animationChunkReference = 0;
Common::Rect *_boundingBox = nullptr;
- Common::Array<Common::Point *> *_mouseActiveArea = nullptr;
+ Common::Array<Common::Point *> _mouseActiveArea;
int _zIndex = 0;
uint32 _assetReference = 0;
uint32 _startup = 0;
Commit: 4edb0751df2d2706bf3b407f1b99770e9683bb15
https://github.com/scummvm/scummvm/commit/4edb0751df2d2706bf3b407f1b99770e9683bb15
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Remove unused warning code in Sound
Changed paths:
engines/mediastation/assets/sound.cpp
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index 9a6dce6e98a..13a1f42f2a2 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -81,9 +81,6 @@ void Sound::readChunk(Chunk &chunk) {
}
void Sound::readSubfile(Subfile &subfile, Chunk &chunk) {
- //if (_streams.size() != 0) {
- // warning("Sound::readSubfile(): Some audio has already been read.");
- //}
uint32 totalChunks = _header->_chunkCount;
uint32 expectedChunkId = chunk._id;
Commit: 74be4240530864942532bf2c41268da93005cea5
https://github.com/scummvm/scummvm/commit/74be4240530864942532bf2c41268da93005cea5
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Fix off-by-one bug in Sound chunk reading
The previous code wasn't respecting the priming read, so we tried to read 1 too many chunks.
Changed paths:
engines/mediastation/assets/sound.cpp
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index 13a1f42f2a2..00c737a7fd2 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -85,7 +85,7 @@ void Sound::readSubfile(Subfile &subfile, Chunk &chunk) {
uint32 expectedChunkId = chunk._id;
readChunk(chunk);
- for (uint i = 0; i < totalChunks; i++) {
+ for (uint i = 1; i < totalChunks; i++) {
chunk = subfile.nextChunk();
if (chunk._id != expectedChunkId) {
// TODO: Make this show the chunk IDs as strings, not numbers.
Commit: d0fc75d86e0bfbcf911c3b8d79841b64e0a33cd1
https://github.com/scummvm/scummvm/commit/d0fc75d86e0bfbcf911c3b8d79841b64e0a33cd1
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Add debug statements to Sound chunk reading
Changed paths:
engines/mediastation/assets/sound.cpp
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index 00c737a7fd2..32bcb026260 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -84,11 +84,12 @@ void Sound::readSubfile(Subfile &subfile, Chunk &chunk) {
uint32 totalChunks = _header->_chunkCount;
uint32 expectedChunkId = chunk._id;
+ debugC(5, kDebugLoading, "Sound::readSubfile(): Reading %d chunks", totalChunks);
readChunk(chunk);
for (uint i = 1; i < totalChunks; i++) {
+ debugC(5, kDebugLoading, "Sound::readSubfile(): Reading chunk %d of %d", i, totalChunks);
chunk = subfile.nextChunk();
if (chunk._id != expectedChunkId) {
- // TODO: Make this show the chunk IDs as strings, not numbers.
error("Sound::readSubfile(): Expected chunk %s, got %s", tag2str(expectedChunkId), tag2str(chunk._id));
}
readChunk(chunk);
Commit: 29cf83504206125008865dc11e44eef609be2284
https://github.com/scummvm/scummvm/commit/29cf83504206125008865dc11e44eef609be2284
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Explain setting sprite frame rate to 10
Changed paths:
engines/mediastation/assets/sprite.cpp
diff --git a/engines/mediastation/assets/sprite.cpp b/engines/mediastation/assets/sprite.cpp
index e6c1bee444a..136bd58b3d2 100644
--- a/engines/mediastation/assets/sprite.cpp
+++ b/engines/mediastation/assets/sprite.cpp
@@ -122,6 +122,8 @@ void Sprite::timePlay() {
g_engine->addPlayingAsset(this);
if (_header->_frameRate == 0) {
+ // It seems that the frame rate is 10 if it's not set in the asset
+ // header, or even if it's set to zero.
_header->_frameRate = 10;
}
Commit: 3ea63df349752ed95eecab782de4f747d63d786d
https://github.com/scummvm/scummvm/commit/3ea63df349752ed95eecab782de4f747d63d786d
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Partially implement Unk2 opcode
Changed paths:
engines/mediastation/mediascript/codechunk.cpp
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 436504dbd9a..28f79e8412a 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -142,6 +142,13 @@ Operand CodeChunk::executeNextStatement() {
return returnValue;
}
+ case kOpcodeUnk2: {
+ // TODO: Figure out what else must be done with this opcode.
+ Operand value = executeNextStatement();
+ warning("CodeChunk::executeNextStatement(): Opcode kOpcodeUnk2 isn't fully implemented");
+ return value;
+ }
+
default: {
error("CodeChunk::getNextStatement(): Got unknown opcode 0x%x (%d)", opcode, opcode);
}
Commit: 07d1b38ab77c5e5153c4e272b5215aa1b1ecafd9
https://github.com/scummvm/scummvm/commit/07d1b38ab77c5e5153c4e272b5215aa1b1ecafd9
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T12:45:56-05:00
Commit Message:
MEDIASTATION: Implement reading string operand
Changed paths:
engines/mediastation/mediascript/codechunk.cpp
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 28f79e8412a..3a18df3791f 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -189,6 +189,19 @@ Operand CodeChunk::executeNextStatement() {
return operand;
}
+ case kOperandTypeString: {
+ // This is indeed a raw string anot not a string wrapped in a datum!
+ // TODO: This copies the string. Can we read it directly from the chunk?
+ int size = Datum(*_bytecode, kDatumTypeUint16_1).u.i;
+ char *buffer = new char[size + 1];
+ _bytecode->read(buffer, size);
+ buffer[size] = '\0';
+ Common::String *string = new Common::String(buffer);
+ operand.putString(string);
+ delete[] buffer;
+ return operand;
+ }
+
default: {
error("CodeChunk::getNextStatement(): Got unknown operand type 0x%d", operandType);
}
Commit: 681fbe53b24e6c27b4a048fb97bebebbd110fc89
https://github.com/scummvm/scummvm/commit/681fbe53b24e6c27b4a048fb97bebebbd110fc89
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-11T13:27:14-05:00
Commit Message:
MEDIASTATION: Partially implement calling methods through variables
Changed paths:
engines/mediastation/mediascript/codechunk.cpp
engines/mediastation/mediascript/variable.cpp
engines/mediastation/mediascript/variable.h
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 3a18df3791f..c998cb6b49a 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -103,26 +103,19 @@ Operand CodeChunk::executeNextStatement() {
}
case kOpcodeCallMethod: {
+ // In Media Station, all methods seem be built-in - there don't
+ // seem to be custom objects or methods individual titles can
+ // define. Functions, however, CAN be title-defined.
+ // But here, we're only looking for built-in methods.
BuiltInMethod methodId = static_cast<BuiltInMethod>(Datum(*_bytecode).u.i);
uint32 parameterCount = Datum(*_bytecode).u.i;
Operand selfObject = executeNextStatement();
- if (selfObject.getType() != kOperandTypeAssetId) {
- error("CodeChunk::executeNextStatement(): (Opcode::CallMethod) Attempt to call method on operand that is not an asset (type 0x%x)", static_cast<uint>(selfObject.getType()));
- }
Common::Array<Operand> args;
for (uint i = 0; i < parameterCount; i++) {
debugC(8, kDebugScript, " -- Argument %d of %d --", (i + 1), parameterCount);
Operand arg = executeNextStatement();
args.push_back(arg);
}
-
- // Call the method.
- // TODO: Resolve asset IDs to names in this decompilation so
- // itʻe easier to read.
- debugC(5, kDebugScript, "SCRIPT: @[ %d ].[ %d ]()", selfObject.getAssetId(), methodId);
- // TODO: Where do we get the method from? And can we define
- // our own methods? Or are only the built-in methods
- // supported?
Operand returnValue = callBuiltInMethod(methodId, selfObject, args);
return returnValue;
}
@@ -353,20 +346,36 @@ Operand CodeChunk::callBuiltInFunction(BuiltInFunction id, Common::Array<Operand
}
Operand CodeChunk::callBuiltInMethod(BuiltInMethod method, Operand self, Common::Array<Operand> &args) {
- if (self.getAssetId() == 1) {
- // This is a "document" method that we need to handle specially.
- // The document (@doc) accepts engine-level methods like changing the
- // active screen.
- // HACK: This is so we don't have to implement a separate document class
- // just to house these methods. Rather, we just call in the engine.
- Operand returnValue = g_engine->callMethod(method, args);
- return returnValue;
- } else {
- // This is a regular asset that we can process directly.
- Asset *selfAsset = self.getAsset();
- assert(selfAsset != nullptr);
- Operand returnValue = selfAsset->callMethod(method, args);
+ switch (self.getType()) {
+ case kOperandTypeAssetId: {
+ if (self.getAssetId() == 1) {
+ // This is a "document" method that we need to handle specially.
+ // The document (@doc) accepts engine-level methods like changing the
+ // active screen.
+ // HACK: This is so we don't have to implement a separate document class
+ // just to house these methods. Rather, we just call in the engine.
+ debugC(5, kDebugScript, "SCRIPT: @doc.[ %d ]()", method);
+ Operand returnValue = g_engine->callMethod(method, args);
+ return returnValue;
+ } else {
+ // This is a regular asset that we can process directly.
+ Asset *selfAsset = self.getAsset();
+ assert(selfAsset != nullptr);
+ Operand returnValue = selfAsset->callMethod(method, args);
+ return returnValue;
+ }
+ }
+
+ case kOperandTypeVariableDeclaration: {
+ Variable *variable = self.getVariable();
+ Operand returnValue = variable->callMethod(method, args);
return returnValue;
+ break;
+ }
+
+ default:
+ error("CodeChunk::callBuiltInMethod(): Attempt to call method on unsupported operand type 0x%x", (uint)self.getType());
+ break;
}
}
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index d12d3eb2a1c..b7dbc685d2a 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -24,6 +24,7 @@
#include "mediastation/datum.h"
#include "mediastation/datafile.h"
#include "mediastation/debugchannels.h"
+#include "mediastation/mediascript/operand.h"
namespace MediaStation {
@@ -113,4 +114,25 @@ Variable::~Variable() {
}
}
+Operand Variable::callMethod(BuiltInMethod method, Common::Array<Operand> &args) {
+ switch (_type) {
+ case kVariableTypeAssetId: {
+ error("Variable::callMethod(): Calling method on an asset in a variable not implemented yet");
+ break;
+ }
+
+ case kVariableTypeCollection: {
+ // TODO: This is just a warning for now so we can get past the
+ // IBM/Crayola opening screen.
+ warning("Variable::callMethod(): Calling method on a collection not implemented yet");
+ return Operand();
+ break;
+ }
+
+ default: {
+ error("Variable::callMethod(): Calling method on unknown variable type 0x%x", static_cast<uint>(_type));
+ }
+ }
+}
+
} // End of namespace MediaStation
diff --git a/engines/mediastation/mediascript/variable.h b/engines/mediastation/mediascript/variable.h
index ffb11c9a723..ad60098a04f 100644
--- a/engines/mediastation/mediascript/variable.h
+++ b/engines/mediastation/mediascript/variable.h
@@ -25,9 +25,12 @@
#include "mediastation/chunk.h"
#include "mediastation/datafile.h"
#include "mediastation/datum.h"
+#include "mediastation/mediascript/builtins.h"
namespace MediaStation {
+class Operand;
+
enum VariableType {
// This is an invalid type used for initialization only.
kVariableTypeEmpty = 0x0000,
@@ -68,6 +71,7 @@ public:
Variable();
Variable(Chunk &chunk, bool readId = true);
+ Operand callMethod(BuiltInMethod method, Common::Array<Operand> &args);
~Variable();
};
More information about the Scummvm-git-logs
mailing list