[Scummvm-git-logs] scummvm master -> ce78554746b739011e330bf577bd64f50ccc4efe
moralrecordings
noreply at scummvm.org
Thu Jan 26 15:37:00 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ce78554746 DIRECTOR: Check current cast archive for CURS resources
Commit: ce78554746b739011e330bf577bd64f50ccc4efe
https://github.com/scummvm/scummvm/commit/ce78554746b739011e330bf577bd64f50ccc4efe
Author: Scott Percival (code at moral.net.au)
Date: 2023-01-26T23:36:17+08:00
Commit Message:
DIRECTOR: Check current cast archive for CURS resources
Changed paths:
engines/director/cursor.cpp
engines/director/cursor.h
diff --git a/engines/director/cursor.cpp b/engines/director/cursor.cpp
index dbb2d123377..18c14cc19be 100644
--- a/engines/director/cursor.cpp
+++ b/engines/director/cursor.cpp
@@ -23,6 +23,7 @@
#include "graphics/wincursor.h"
#include "director/director.h"
+#include "director/cast.h"
#include "director/cursor.h"
#include "director/movie.h"
#include "director/castmember.h"
@@ -175,25 +176,17 @@ void Cursor::readFromResource(Datum resourceId) {
default:
bool readSuccessful = false;
- for (Common::HashMap<Common::String, Archive *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo>::iterator it = g_director->_allOpenResFiles.begin(); it != g_director->_allOpenResFiles.end(); ++it) {
- MacArchive *arch = (MacArchive *)it->_value;
- Common::SeekableReadStreamEndian *cursorStream = nullptr;
- if (arch->hasResource(MKTAG('C', 'U', 'R', 'S'), resourceId.asInt()))
- cursorStream = arch->getResource(MKTAG('C', 'U', 'R', 'S'), resourceId.asInt());
-
- if (!cursorStream && arch->hasResource(MKTAG('C', 'R', 'S', 'R'), resourceId.asInt()))
- cursorStream = arch->getResource(MKTAG('C', 'R', 'S', 'R'), resourceId.asInt());
-
- if (cursorStream && readFromStream(*((Common::SeekableReadStream *)cursorStream), false, 0)) {
- _usePalette = true;
- _keyColor = 0xff;
- readSuccessful = true;
+ Cast *cast = g_director->getCurrentMovie()->getCast();
+ if (cast && cast->getArchive()) {
+ readSuccessful = readFromArchive(cast->getArchive(), resourceId.asInt());
+ if (readSuccessful)
+ break;
+ }
- resetCursor(Graphics::kMacCursorCustom, false, resourceId);
- delete cursorStream;
+ for (Common::HashMap<Common::String, Archive *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo>::iterator it = g_director->_allOpenResFiles.begin(); it != g_director->_allOpenResFiles.end(); ++it) {
+ readSuccessful = readFromArchive(it->_value, resourceId.asInt());
+ if (readSuccessful)
break;
- }
- delete cursorStream;
}
// TODO: figure out where to read custom cursor in windows platform
@@ -223,6 +216,26 @@ void Cursor::readFromResource(Datum resourceId) {
}
}
+bool Cursor::readFromArchive(Archive *archive, uint16 resourceId) {
+ bool readSuccessful = false;
+ Common::SeekableReadStreamEndian *cursorStream = nullptr;
+ if (archive->hasResource(MKTAG('C', 'U', 'R', 'S'), resourceId))
+ cursorStream = archive->getResource(MKTAG('C', 'U', 'R', 'S'), resourceId);
+
+ if (!cursorStream && archive->hasResource(MKTAG('C', 'R', 'S', 'R'), resourceId))
+ cursorStream = archive->getResource(MKTAG('C', 'R', 'S', 'R'), resourceId);
+
+ if (cursorStream && readFromStream(*((Common::SeekableReadStream *)cursorStream), false, 0)) {
+ _usePalette = true;
+ _keyColor = 0xff;
+ readSuccessful = true;
+
+ resetCursor(Graphics::kMacCursorCustom, false, resourceId);
+ }
+ delete cursorStream;
+ return readSuccessful;
+}
+
void Cursor::resetCursor(Graphics::MacCursorType type, bool shouldClear, Datum resId) {
if (shouldClear)
clear();
diff --git a/engines/director/cursor.h b/engines/director/cursor.h
index 4d28a6b6db0..0211713abbd 100644
--- a/engines/director/cursor.h
+++ b/engines/director/cursor.h
@@ -34,6 +34,7 @@ class MacCursor;
namespace Director {
+class Archive;
struct CursorRef;
class Cursor : public Graphics::MacCursor {
@@ -45,6 +46,7 @@ class Cursor : public Graphics::MacCursor {
void readFromCast(Datum casts);
void readFromResource(Datum resourceId);
void readBuiltinType(Datum resourceId);
+ bool readFromArchive(Archive *archive, uint16 resourceId);
bool isEmpty() {return Datum(0).equalTo(_cursorResId);}
bool operator==(const Cursor &c);
More information about the Scummvm-git-logs
mailing list