[Scummvm-git-logs] scummvm master -> 045f9e61f74a56b72a8f5d33d096c405e6a0ca65

bluegr noreply at scummvm.org
Tue Sep 1 22:48:04 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
045f9e61f7 NANCY: Clean up and refactor the AR factory code


Commit: 045f9e61f74a56b72a8f5d33d096c405e6a0ca65
    https://github.com/scummvm/scummvm/commit/045f9e61f74a56b72a8f5d33d096c405e6a0ca65
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-09-02T01:47:55+03:00

Commit Message:
NANCY: Clean up and refactor the AR factory code

- Change game version checks to be incremental
- Use enums for all different AR variants, instead of types

This makes the whole AR variant code easier to read and understand

Changed paths:
    engines/nancy/action/arfactory.cpp
    engines/nancy/action/conversation.cpp
    engines/nancy/action/datarecords.cpp
    engines/nancy/action/datarecords.h
    engines/nancy/action/miscrecords.cpp
    engines/nancy/action/miscrecords.h
    engines/nancy/action/overlay.cpp
    engines/nancy/action/overlay.h
    engines/nancy/action/puzzle/peepholepuzzle.cpp
    engines/nancy/action/puzzle/peepholepuzzle.h
    engines/nancy/action/puzzle/telephone.cpp
    engines/nancy/action/puzzle/telephone.h
    engines/nancy/action/secondarymovie.cpp
    engines/nancy/action/secondarymovie.h


diff --git a/engines/nancy/action/arfactory.cpp b/engines/nancy/action/arfactory.cpp
index 92949b01e26..0be2d009e72 100644
--- a/engines/nancy/action/arfactory.cpp
+++ b/engines/nancy/action/arfactory.cpp
@@ -213,41 +213,39 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 			return new LightningOn(); // Only used in TVD
 		else
 			return new SpecialEffect();
-	case 41:	// Nancy14
-	case 44:	// Nancy14 (adds a trailing volume byte)
-		return new PlaySecondaryMovie();
+	case 41:	// Nancy13
+		return new PlaySecondaryMovie(PlaySecondaryMovie::kSecondaryMovieTerse);
 	case 42:	// Nancy14
 	case 43:	// Nancy14
 	case 45:	// Nancy11
-		return new PlaySecondaryMovie(true);
+		return new PlaySecondaryMovie(PlaySecondaryMovie::kRandomMovie);
+	case 44:	// Nancy14 (adds a trailing volume byte)
+		return new PlaySecondaryMovie(PlaySecondaryMovie::kMovieWithVolume);
 	case 46:	// Nancy11
 		return new PlayRandomMovieControl();
 	case 47:	// Nancy14
-		// A PlaySecondaryMovie subclass that appends a named {value, flag} list.
-		// Handled inside PlaySecondaryMovie via _type == 47.
-		return new PlaySecondaryMovie();
+		// A PlaySecondaryMovie subclass that appends a named {value, flag} list
+		return new PlaySecondaryMovie(PlaySecondaryMovie::kInteractiveMovie);
 	case 50:
 		return new ConversationVideo(); // PlayPrimaryVideoChan0
 	case 51:
 	case 52:
 		return new PlaySecondaryVideo();
 	case 53:
-		if (g_nancy->getGameType() >= kGameTypeNancy14)
-			return new RolloverOverlay();
+		if (g_nancy->getGameType() <= kGameTypeNancy13)
+			return new PlaySecondaryMovie(PlaySecondaryMovie::kSecondaryMovie);
 		else
-			return new PlaySecondaryMovie();
+			return new RolloverOverlay();
 	case 54:
 		if (g_nancy->getGameType() <= kGameTypeNancy1)
-			return new Overlay(false); // PlayStaticBitmapAnimation
+			return new Overlay(Overlay::kStaticAnimation); // PlayStaticBitmapAnimation
 		else
-			return new Overlay(true);
+			return new Overlay(Overlay::kInterruptibleAnimation);
 	case 55:
 		if (g_nancy->getGameType() <= kGameTypeNancy1)
-			return new Overlay(true); // PlayIntStaticBitmapAnimation
-		else if (g_nancy->getGameType() >= kGameTypeNancy7)
-			return new OverlayStaticTerse();
+			return new Overlay(Overlay::kInterruptibleAnimation); // PlayIntStaticBitmapAnimation
 		else
-			return nullptr;
+			return new OverlayStaticTerse();
 	case 56:
 		if (g_nancy->getGameType() <= kGameTypeNancy6)
 			return new ConversationVideo();
@@ -281,19 +279,19 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 66:
 		return new TableIndexPlaySound();
 	case 67:
-		if (g_nancy->getGameType() >= kGameTypeNancy10)
-			return new Autotext();		// Moved from 61 in Nancy 10
-		else
+		if (g_nancy->getGameType() <= kGameTypeNancy9)
 			return new TableIndexSetValueHS();
+		else
+			return new Autotext();		// Moved from 61 in Nancy 10
 	case 68:
-		if (g_nancy->getGameType() >= kGameTypeNancy12)
-			return new TextLineOverlay();
+		if (g_nancy->getGameType() <= kGameTypeNancy11)
+			return new TextScroll(TextScroll::kTextScroll);
 		else
-			return new TextScroll(false);
+			return new TextLineOverlay();
 	case 69:	// Nancy11
 		return new TimerControl();
 	case 70:
-		return new TextScroll(true); // AutotextEntryList
+		return new TextScroll(TextScroll::kAutotextEntryList);
 	case 71:
 		return new ModifyListEntry(ModifyListEntry::kAdd);
 	case 72:
@@ -301,11 +299,12 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 73:
 		return new ModifyListEntry(ModifyListEntry::kMark);
 	case 74:	// Nancy10 only: writes the full, taskbar-covering box
-		return new FrameTextBox(true);
+		return new FrameTextBox(FrameTextBox::kFullBox);
 	case 75:
 		if (g_nancy->getGameType() <= kGameTypeNancy9)
-			return new TextBoxWrite();
-		return new FrameTextBox(false);
+			return new TextBoxWrite(TextBoxWrite::kTextBoxWrite);
+		else
+			return new FrameTextBox(FrameTextBox::kNormalBox);
 	case 76:
 		return new TextboxClear();
 	case 77:
@@ -315,19 +314,19 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 79:
 		return new ValueTest();
 	case 81:	// Nancy11
-		return new TextBoxWrite(true);
+		return new TextBoxWrite(TextBoxWrite::kAutotextWrite);
 	case 94:	// Nancy12
-		return new EventFlagsMultiHS(false);	// moved from 106
+		return new EventFlagsMultiHS(EventFlagsMultiHS::kMultiHS);	// moved from 106
 	case 95:	// Nancy12
-		return new EventFlags();	// moved from 107
+		return new EventFlags(EventFlags::kEventFlags);	// moved from 107
 	case 96:	// Nancy11
 		return new RandomizeEventFlags();
 	case 97:
-		return new EventFlags(true);
+		return new EventFlags(EventFlags::kEventFlagsTerse);
 	case 98:
-		return new EventFlagsMultiHS(true, true);
+		return new EventFlagsMultiHS(EventFlagsMultiHS::kHSTerse);
 	case 99:
-		return new EventFlagsMultiHS(true);
+		return new EventFlagsMultiHS(EventFlagsMultiHS::kCursorHS);
 	case 100:
 		return new BumpPlayerClock();
 	case 101:
@@ -341,9 +340,9 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 105:
 		return new StopTimer();
 	case 106:
-		return new EventFlagsMultiHS(false);
+		return new EventFlagsMultiHS(EventFlagsMultiHS::kMultiHS);
 	case 107:
-		return new EventFlags();
+		return new EventFlags(EventFlags::kEventFlags);
 	case 108:
 		if (g_nancy->getGameType() <= kGameTypeNancy6)
 			return new OrderingPuzzle(OrderingPuzzle::kOrdering);
@@ -364,7 +363,7 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 115:
 		return new LeverPuzzle();
 	case 116:
-		return new Telephone(false);
+		return new Telephone(Telephone::kTelephone);
 	case 117:
 		return new SliderPuzzle();
 	case 118:
@@ -403,10 +402,10 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 		// TODO: not yet implemented (depends on the PCUI/LDSN player-char UI)
 		return nullptr;
 	case 140:
-		if (g_nancy->getGameType() >= kGameTypeNancy12)
-			return new SetPlayerClock();	// Moved from 170 in Nancy12
-		else
+		if (g_nancy->getGameType() <= kGameTypeNancy11)
 			return new SetVolume();			// Legacy SetVolume slot (used up to Nancy8)
+		else
+			return new SetPlayerClock();	// Moved from 170 in Nancy12
 	case 141:	// Nancy12
 		return new MakeScreenFile();	// Moved from 148 in Nancy12
 	case 143:	// Nancy14
@@ -418,30 +417,29 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 146:	// Nancy13
 		return new FadeSoundToSilence(); // Moved from 147 in Nancy13
 	case 147:	// Nancy11
-		if (g_nancy->getGameType() >= kGameTypeNancy13)
-			return new SetVolume();			// Moved from 148 in Nancy13
-		return new FadeSoundToSilence();	// Nancy11
-	case 148:
-		if (g_nancy->getGameType() >= kGameTypeNancy13)
-			return new StopSound();	// Nancy13: StopSound moved here (was 154)
-		if (g_nancy->getGameType() >= kGameTypeNancy12)
-			return new SetVolume();	// Moved from 149 in Nancy12
-		if (g_nancy->getGameType() >= kGameTypeNancy9)
+		if (g_nancy->getGameType() <= kGameTypeNancy12)
+			return new FadeSoundToSilence();
+		else
+			return new SetVolume();				// Moved from 148 in Nancy13
+	case 148:	// Nancy11
+		if (g_nancy->getGameType() <= kGameTypeNancy11)
 			return new MakeScreenFile();	// Moved to 141 in Nancy12
-		return nullptr;
-	case 149:
-		if (g_nancy->getGameType() >= kGameTypeNancy13)
-			return new StopSound();	// Nancy13: StopAndUnloadSound moved here (was 155)
-		if (g_nancy->getGameType() >= kGameTypeNancy12)
+		else if (g_nancy->getGameType() <= kGameTypeNancy12)
+			return new SetVolume();			// Moved from 149 in Nancy12
+		else
+			return new StopSound();			// Nancy13: StopSound moved here (was 154)
+	case 149:	// Nancy11
+		if (g_nancy->getGameType() <= kGameTypeNancy11)
+			return new SetVolume();					// Moved from 140 in Nancy9, then to 148 in Nancy12
+		else if (g_nancy->getGameType() <= kGameTypeNancy12)
 			return new PlaySoundEventFlagTerse();	// Moved from 161 in Nancy12
-		else if (g_nancy->getGameType() >= kGameTypeNancy9)
-			return new SetVolume();	// Moved from 140 in Nancy9, then to 148 in Nancy12
 		else
-			return nullptr;
+			return new StopSound();					// Nancy13: StopAndUnloadSound moved here (was 155)
 	case 150:
-		if (g_nancy->getGameType() >= kGameTypeNancy14)
-			return new SetMovieVolume();	// PlaySound moved to 145 in Nancy13
-		return new PlaySound();
+		if (g_nancy->getGameType() <= kGameTypeNancy13)
+			return new PlaySound();			// Moved to 145 in Nancy13
+		else
+			return new SetMovieVolume();
 	case 151:
 		if (g_nancy->getGameType() <= kGameTypeNancy6)
 			return new PlaySound(); // PlayStreamSound
@@ -461,17 +459,20 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 158:
 		return new PlayRandomSound();
 	case 159:
-		if (g_nancy->getGameType() >= kGameTypeNancy14)
-			return new GridMapPuzzle();	// moved from 244
-		return new PlaySoundTerse();
+		if (g_nancy->getGameType() <= kGameTypeNancy13)
+			return new PlaySoundTerse();
+		else
+			return new GridMapPuzzle();	// Moved from 244 in Nancy14
 	case 160:
-		if (g_nancy->getGameType() >= kGameTypeNancy12)
+		if (g_nancy->getGameType() <= kGameTypeNancy11)
+			return new HintSystem();
+		else
 			return new DrivingPuzzle(DrivingPuzzle::kDriving);
-		return new HintSystem();
 	case 161:
-		if (g_nancy->getGameType() >= kGameTypeNancy12)
+		if (g_nancy->getGameType() <= kGameTypeNancy11)
+			return new PlaySoundEventFlagTerse();
+		else
 			return new MinigolfPuzzle();
-		return new PlaySoundEventFlagTerse();
 	// -- Nancy 12 new puzzles/action records --
 	case 162:
 		return new SewingMachinePuzzle();
@@ -491,9 +492,10 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 169:
 		return new StepObjectsPuzzle();
 	case 170:
-		if (g_nancy->getGameType() >= kGameTypeNancy13)
+		if (g_nancy->getGameType() <= kGameTypeNancy12)
+			return new SetPlayerClock();	// Moved to 140 in Nancy12
+		else
 			return new WordFindPuzzle();
-		return new SetPlayerClock();	// moved to 140 in Nancy12
 	case 171:
 		return new TurningPuzzle();	// moved from 209 in Nancy13
 	case 172:
@@ -590,7 +592,7 @@ ActionRecord *ActionManager::createActionRecord(uint16 type, Common::SeekableRea
 	case 229:
 		return new ArcadePuzzle();
 	case 230:
-		return new Telephone(true);
+		return new Telephone(Telephone::kNewPhone);
 	case 231:
 		return new QuizPuzzle();
 	case 232:
diff --git a/engines/nancy/action/conversation.cpp b/engines/nancy/action/conversation.cpp
index b975a2b484f..378ea2b384e 100644
--- a/engines/nancy/action/conversation.cpp
+++ b/engines/nancy/action/conversation.cpp
@@ -438,7 +438,7 @@ void ConversationSound::execute() {
 
 					// Nancy 11+: play a fresh random sequence as the character's response anim.
 					if (PlaySecondaryMovie *active = NancySceneState.getActiveMovie()) {
-						if (active->_isRandom) {
+						if (active->isRandom()) {
 							active->playRandomSequence();
 						}
 					}
diff --git a/engines/nancy/action/datarecords.cpp b/engines/nancy/action/datarecords.cpp
index ebeb8cbf9d4..d557d35b5cc 100644
--- a/engines/nancy/action/datarecords.cpp
+++ b/engines/nancy/action/datarecords.cpp
@@ -323,7 +323,7 @@ void ValueTest::execute() {
 }
 
 void EventFlags::readData(Common::SeekableReadStream &stream) {
-	if (!_isTerse) {
+	if (_flagsType == kEventFlags) {
 		_flags.readData(stream);
 	} else {
 		// Terse version only has 2 flags
@@ -342,7 +342,7 @@ void EventFlags::execute() {
 void EventFlagsMultiHS::readData(Common::SeekableReadStream &stream) {
 	EventFlags::readData(stream);
 
-	if (_isCursor) {
+	if (_hotspotType != kMultiHS) {
 		_hoverCursor = (CursorManager::CursorType)stream.readUint16LE();
 	}
 
@@ -359,7 +359,7 @@ void EventFlagsMultiHS::readData(Common::SeekableReadStream &stream) {
 bool EventFlagsMultiHS::cursorSetFromScript() const {
 	if (g_nancy->getGameType() >= kGameTypeNancy10 && NancySceneState.getHeldItem() >= 0)
 		return false;
-	return _isCursor;
+	return _hotspotType != kMultiHS;
 }
 
 CursorManager::CursorType EventFlagsMultiHS::getHoverCursor() const {
diff --git a/engines/nancy/action/datarecords.h b/engines/nancy/action/datarecords.h
index c734bc5318f..0e17e8d1af6 100644
--- a/engines/nancy/action/datarecords.h
+++ b/engines/nancy/action/datarecords.h
@@ -111,23 +111,28 @@ protected:
 // Sets up to 10 flags at once.
 class EventFlags : public ActionRecord {
 public:
-	EventFlags(bool terse = false) : _isTerse(terse) {}
+	enum FlagsType { kEventFlags, kEventFlagsTerse };
+
+	EventFlags(FlagsType flagsType) : _flagsType(flagsType) {}
 	virtual ~EventFlags() {}
 
 	void readData(Common::SeekableReadStream &stream) override;
 	void execute() override;
 
 	MultiEventFlagDescription _flags;
-	bool _isTerse;
+	FlagsType _flagsType;
 
 protected:
-	Common::String getRecordTypeName() const override { return _isTerse ? "EventFlagsTerse" : "EventFlags"; }
+	Common::String getRecordTypeName() const override { return _flagsType == kEventFlagsTerse ? "EventFlagsTerse" : "EventFlags"; }
 };
 
 // Sets up to 10 flags when clicked. Hotspot can move alongside background frame.
 class EventFlagsMultiHS : public EventFlags {
 public:
-	EventFlagsMultiHS(bool isCursor, bool terse = false) : EventFlags(terse), _isCursor(isCursor) {}
+	enum HotspotType { kMultiHS, kCursorHS, kHSTerse };
+
+	EventFlagsMultiHS(HotspotType hotspotType) :
+		EventFlags(hotspotType == kHSTerse ? kEventFlagsTerse : kEventFlags), _hotspotType(hotspotType) {}
 	virtual ~EventFlagsMultiHS() {}
 
 	void readData(Common::SeekableReadStream &stream) override;
@@ -139,12 +144,21 @@ public:
 	CursorManager::CursorType _hoverCursor = CursorManager::kHotspot;
 	Common::Array<HotspotDescription> _hotspots;
 
-	bool _isCursor;
+	HotspotType _hotspotType;
 
 	bool canHaveHotspot() const override { return true; }
 
 protected:
-	Common::String getRecordTypeName() const override { return _isCursor ? (_isTerse ? "EventFlagsHSTerse" : "EventFlagsCursorHS") : "EventFlagsMultiHS"; }
+	Common::String getRecordTypeName() const override {
+		switch (_hotspotType) {
+		case kCursorHS:
+			return "EventFlagsCursorHS";
+		case kHSTerse:
+			return "EventFlagsHSTerse";
+		default:
+			return "EventFlagsMultiHS";
+		}
+	}
 };
 
 // Nancy 11+ AR 96. Sets each of a list of event flags to a random boolean value.
diff --git a/engines/nancy/action/miscrecords.cpp b/engines/nancy/action/miscrecords.cpp
index 4ecd1a880dc..7dbe8e1f24f 100644
--- a/engines/nancy/action/miscrecords.cpp
+++ b/engines/nancy/action/miscrecords.cpp
@@ -141,7 +141,7 @@ static void readTextboxText(Common::SeekableReadStream &stream, Common::String &
 }
 
 void TextBoxWrite::readData(Common::SeekableReadStream &stream) {
-	if (_isAutotext) {
+	if (_writeType == kAutotextWrite) {
 		// AR 81 prefixes the body with a wait header (runtime state at 0x00 is
 		// always 0 in the data, so skip it)
 		stream.skip(2);
@@ -152,7 +152,7 @@ void TextBoxWrite::readData(Common::SeekableReadStream &stream) {
 
 	readTextboxText(stream, _text);
 
-	if (_isAutotext) {
+	if (_writeType == kAutotextWrite) {
 		// The original terminates the body with the "<e>" end-of-line hypertext tag
 		_text += "<e>";
 	}
@@ -167,7 +167,7 @@ void TextBoxWrite::execute() {
 		}
 		tb.setVisible(true);
 
-		if (!_isAutotext) {
+		if (_writeType == kTextBoxWrite) {
 			// Plain TextBoxWrite completes immediately
 			finishExecution();
 			return;
@@ -230,7 +230,7 @@ void FrameTextBox::execute() {
 	if (!_text.empty())
 		tb.addTextLine(_text);
 
-	tb.setFullMode(_fullMode);
+	tb.setFullMode(_boxMode == kFullBox);
 	finishExecution();
 }
 
diff --git a/engines/nancy/action/miscrecords.h b/engines/nancy/action/miscrecords.h
index 6f387b8e88a..9af6b67c0c2 100644
--- a/engines/nancy/action/miscrecords.h
+++ b/engines/nancy/action/miscrecords.h
@@ -95,8 +95,9 @@ protected:
 class TextBoxWrite : public ActionRecord {
 public:
 	enum WaitMode { kWaitNone = 0, kWaitForSound = 1, kWaitForTimer = 2 };
+	enum WriteType { kTextBoxWrite, kAutotextWrite };
 
-	TextBoxWrite(bool isAutotext = false) : _isAutotext(isAutotext) {}
+	TextBoxWrite(WriteType writeType) : _writeType(writeType) {}
 
 	void readData(Common::SeekableReadStream &stream) override;
 	void execute() override;
@@ -104,13 +105,13 @@ public:
 	Common::String _text;
 
 	// Nancy 11+ AR 81 only
-	bool _isAutotext;
+	WriteType _writeType;
 	int16 _waitMode = 0;
 	uint16 _soundChannel = 0;
 	uint32 _waitTimeMs = 0;
 
 protected:
-	Common::String getRecordTypeName() const override { return _isAutotext ? "AutotextTextBoxWrite" : "TextBoxWrite"; }
+	Common::String getRecordTypeName() const override { return _writeType == kAutotextWrite ? "AutotextTextBoxWrite" : "TextBoxWrite"; }
 
 private:
 	uint32 _endTime = 0;
@@ -130,12 +131,14 @@ protected:
 // text into the new (UICO-driven) textbox
 class FrameTextBox : public ActionRecord {
 public:
-	FrameTextBox(bool fullMode) : _fullMode(fullMode) {}
+	enum BoxMode { kNormalBox, kFullBox };
+
+	FrameTextBox(BoxMode boxMode) : _boxMode(boxMode) {}
 
 	void readData(Common::SeekableReadStream &stream) override;
 	void execute() override;
 
-	bool _fullMode;
+	BoxMode _boxMode;
 	Common::String _text;
 
 protected:
diff --git a/engines/nancy/action/overlay.cpp b/engines/nancy/action/overlay.cpp
index c2d1d809ec5..5a6ba185153 100644
--- a/engines/nancy/action/overlay.cpp
+++ b/engines/nancy/action/overlay.cpp
@@ -151,7 +151,7 @@ void Overlay::readData(Common::SeekableReadStream &stream) {
 
 	ser.syncAsUint16LE(_z, kGameTypeNancy1, kGameTypeNancy1);
 
-	if (_isInterruptible) {
+	if (_animationType == kInterruptibleAnimation) {
 			ser.syncAsSint16LE(_interruptCondition.label);
 			ser.syncAsUint16LE(_interruptCondition.flag);
 		} else {
@@ -413,7 +413,7 @@ void Overlay::execute() {
 
 Common::String Overlay::getRecordTypeName() const {
 	if (g_nancy->getGameType() <= kGameTypeNancy1) {
-		if (_isInterruptible) {
+		if (_animationType == kInterruptibleAnimation) {
 			return "PlayIntStaticBitmapAnimation";
 		} else {
 			return "PlayStaticBitmapAnimation";
diff --git a/engines/nancy/action/overlay.h b/engines/nancy/action/overlay.h
index 88f9f145ab9..449c63fc6b9 100644
--- a/engines/nancy/action/overlay.h
+++ b/engines/nancy/action/overlay.h
@@ -43,7 +43,9 @@ namespace Action {
 // that was also when static mode got introduced.
 class Overlay : public RenderActionRecord {
 public:
-	Overlay(bool interruptible) : RenderActionRecord(7), _isInterruptible(interruptible), _usesAutotext(false) {}
+	enum AnimationType { kStaticAnimation, kInterruptibleAnimation };
+
+	Overlay(AnimationType animationType) : RenderActionRecord(7), _animationType(animationType), _usesAutotext(false) {}
 	virtual ~Overlay() { _fullSurface.free(); }
 
 	void init() override;
@@ -80,7 +82,7 @@ public:
 	int16 _currentFrame = -1;
 	int16 _currentViewportFrame = -1;
 	uint32 _nextFrameTime = 0;
-	bool _isInterruptible;
+	AnimationType _animationType;
 	bool _usesAutotext;
 
 	bool canHaveHotspot() const override { return true; }
@@ -97,7 +99,7 @@ protected:
 // Short version of a static overlay; assumes scene background doesn't move
 class OverlayStaticTerse : public Overlay {
 public:
-	OverlayStaticTerse() : Overlay(true) {}
+	OverlayStaticTerse() : Overlay(kInterruptibleAnimation) {}
 	virtual ~OverlayStaticTerse() {}
 
 	void readData(Common::SeekableReadStream &stream) override;
@@ -109,7 +111,7 @@ protected:
 // Short version of an animated overlay; assumes scene background doesn't move
 class OverlayAnimTerse : public Overlay {
 public:
-	OverlayAnimTerse() : Overlay(true) {}
+	OverlayAnimTerse() : Overlay(kInterruptibleAnimation) {}
 	virtual ~OverlayAnimTerse() {}
 
 	void readData(Common::SeekableReadStream &stream) override;
@@ -120,7 +122,7 @@ protected:
 
 class TableIndexOverlay : public Overlay {
 public:
-	TableIndexOverlay() : Overlay(true) {}
+	TableIndexOverlay() : Overlay(kInterruptibleAnimation) {}
 	virtual ~TableIndexOverlay() {}
 
 	void readData(Common::SeekableReadStream &stream) override;
diff --git a/engines/nancy/action/puzzle/peepholepuzzle.cpp b/engines/nancy/action/puzzle/peepholepuzzle.cpp
index aa3c614405e..3fc832aefee 100644
--- a/engines/nancy/action/puzzle/peepholepuzzle.cpp
+++ b/engines/nancy/action/puzzle/peepholepuzzle.cpp
@@ -350,7 +350,7 @@ void TextScroll::readExtraData(Common::SeekableReadStream &stream) {
 
 	_pixelsToScroll = stream.readByte();
 
-	if (!_isEntryList) {
+	if (_scrollType == kTextScroll) {
 		Autotext::readExtraData(stream);
 	}
 }
diff --git a/engines/nancy/action/puzzle/peepholepuzzle.h b/engines/nancy/action/puzzle/peepholepuzzle.h
index 8dab2fced55..8ed36073230 100644
--- a/engines/nancy/action/puzzle/peepholepuzzle.h
+++ b/engines/nancy/action/puzzle/peepholepuzzle.h
@@ -82,7 +82,9 @@ protected:
 // on the fly and replaces the TextScroll/AutotextEntryList
 class TextScroll : public Autotext, public PeepholePuzzle {
 public:
-	TextScroll(bool isEntryList) : _isEntryList(isEntryList) { _selfDisplay = false; _hasPlacementDescriptor = false; }
+	enum ScrollType { kTextScroll, kAutotextEntryList };
+
+	TextScroll(ScrollType scrollType) : _scrollType(scrollType) { _selfDisplay = false; _hasPlacementDescriptor = false; }
 
 	void init() override;
 	void execute() override { PeepholePuzzle::execute(); }
@@ -91,10 +93,10 @@ public:
 	void readData(Common::SeekableReadStream &stream) override;
 
 protected:
-	Common::String getRecordTypeName() const override { return _isEntryList ? "AutotextEntryList" : "TextScroll"; }
+	Common::String getRecordTypeName() const override { return _scrollType == kAutotextEntryList ? "AutotextEntryList" : "TextScroll"; }
 	void readExtraData(Common::SeekableReadStream &stream) override;
 
-	bool _isEntryList;
+	ScrollType _scrollType;
 };
 
 } // End of namespace Action
diff --git a/engines/nancy/action/puzzle/telephone.cpp b/engines/nancy/action/puzzle/telephone.cpp
index 05d75514592..a8953a17398 100644
--- a/engines/nancy/action/puzzle/telephone.cpp
+++ b/engines/nancy/action/puzzle/telephone.cpp
@@ -45,7 +45,7 @@ void Telephone::init() {
 	g_nancy->_resource->loadImage(_imageName, _image);
 	g_nancy->_resource->loadImage(_displayAnimName, _animImage);
 
-	if (_isNewPhone) {
+	if (_phoneType == kNewPhone) {
 		_font = g_nancy->_graphics->getFont(_displayFont);
 	}
 
@@ -61,9 +61,9 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 	readFilename(stream, _imageName);
 
 	uint16 numButtons = 12;
-	uint16 maxNumButtons = _isNewPhone ? 20 : 12;
+	uint16 maxNumButtons = _phoneType == kNewPhone ? 20 : 12;
 
-	if (_isNewPhone) {
+	if (_phoneType == kNewPhone) {
 		_hasDisplay = stream.readByte();
 		_displayFont = stream.readUint16LE();
 		readFilename(stream, _displayAnimName);
@@ -79,7 +79,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 	readRectArray(stream, _srcRects, numButtons, maxNumButtons);
 	readRectArray(stream, _destRects, numButtons, maxNumButtons);
 
-	if (_isNewPhone) {
+	if (_phoneType == kNewPhone) {
 		readRect(stream, _dirHighlightSrc);
 		readRect(stream, _dialHighlightSrc);
 
@@ -91,7 +91,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 		readRect(stream, _displayDialingSrc);
 	}
 
-	if (!_isNewPhone) {
+	if (_phoneType == kTelephone) {
 		_genericDialogueSound.readNormal(stream);
 		_genericButtonSound.readNormal(stream);
 		_ringSound.readNormal(stream);
@@ -110,7 +110,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 	stream.skip(33 * (maxNumButtons - numButtons));
 
 	char textBuf[200];
-	if (!_isNewPhone) {
+	if (_phoneType == kTelephone) {
 		stream.read(textBuf, 200);
 		textBuf[199] = '\0';
 		_addressBookString = textBuf;
@@ -134,7 +134,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 	for (uint i = 0; i < numCalls; ++i) {
 		PhoneCall &call = _calls[i];
 
-		if (_isNewPhone) {
+		if (_phoneType == kNewPhone) {
 			call.directoryDisplayCondition = stream.readSint16LE();
 		}
 
@@ -143,7 +143,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 			call.phoneNumber[j] = stream.readByte();
 		}
 
-		if (!_isNewPhone) {
+		if (_phoneType == kTelephone) {
 			readFilename(stream, call.soundName);
 			stream.read(textBuf, 200);
 			textBuf[199] = '\0';
@@ -171,7 +171,7 @@ void Telephone::execute() {
 	case kRun:
 		switch (_callState) {
 		case kWaiting:
-			if (_isNewPhone && !_animIsStopped) {
+			if (_phoneType == kNewPhone && !_animIsStopped) {
 				if (g_nancy->getTotalPlayTime() > _displayAnimEnd) {
 					if (_displayAnimEnd == 0) {
 						_displayAnimEnd = g_nancy->getTotalPlayTime() + _displayAnimFrameTime;
@@ -506,14 +506,14 @@ void Telephone::handleInput(NancyInput &input) {
 
 					if (_hasDisplay) {
 						_drawSurface.fillRect(_displayDest, _drawSurface.getTransparentColor());
-					} else if (_isNewPhone) {
+					} else if (_phoneType == kNewPhone) {
 						NancySceneState.getTextbox().clear();
 					}
 
 					_checkNumbers = false;
 				}
 
-				if (_isNewPhone && _calledNumber.size()) {
+				if (_phoneType == kNewPhone && _calledNumber.size()) {
 					Common::String numberString;
 					for (uint j = 0; j < _calledNumber.size(); ++j) {
 						numberString += '0' + _calledNumber[j];
diff --git a/engines/nancy/action/puzzle/telephone.h b/engines/nancy/action/puzzle/telephone.h
index 9e1511395df..b1655fb1139 100644
--- a/engines/nancy/action/puzzle/telephone.h
+++ b/engines/nancy/action/puzzle/telephone.h
@@ -44,8 +44,9 @@ public:
 	};
 
 	enum CallState { kWaiting, kButtonPress, kRinging, kBadNumber, kPreCall, kCall, kHangUp };
+	enum PhoneType { kTelephone, kNewPhone };
 
-	Telephone(bool isNewPhone) :
+	Telephone(PhoneType phoneType) :
 		RenderActionRecord(7),
 		_callState(kWaiting),
 		_buttonLastPushed(-1),
@@ -53,7 +54,7 @@ public:
 		_checkNumbers(false),
 		_font(nullptr),
 		_animIsStopped(false),
-		_isNewPhone(isNewPhone) {}
+		_phoneType(phoneType) {}
 	virtual ~Telephone() {}
 
 	void init() override;
@@ -65,7 +66,7 @@ public:
 	bool isViewportRelative() const override { return true; }
 
 protected:
-	Common::String getRecordTypeName() const override { return _isNewPhone ? "NewPhone" : "Telephone"; }
+	Common::String getRecordTypeName() const override { return _phoneType == kNewPhone ? "NewPhone" : "Telephone"; }
 
 	Common::Path _imageName;
 	Common::Array<Common::Rect> _srcRects;
@@ -122,7 +123,7 @@ protected:
 
 	const Font *_font;
 
-	bool _isNewPhone;
+	PhoneType _phoneType;
 };
 
 } // End of namespace Action
diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index 146d0bed8a8..5c1f90ac3a2 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -39,9 +39,9 @@
 namespace Nancy {
 namespace Action {
 
-PlaySecondaryMovie::PlaySecondaryMovie(bool isRandom)
-		: RenderActionRecord(8), _isRandom(isRandom) {
-	if (_isRandom) {
+PlaySecondaryMovie::PlaySecondaryMovie(MovieType movieType)
+		: RenderActionRecord(8), _movieType(movieType) {
+	if (isRandom()) {
 		NancySceneState.notifyRandomMovieARLoaded();
 	}
 }
@@ -64,7 +64,7 @@ bool PlaySecondaryMovie::survivesSceneChange(bool nextSceneIsNoArt) const {
 	// reloaded if it's re-entered. A plain (non-random) cinematic movie is
 	// self-contained and does not persist, not even into a NO_ART_SCENE — so the
 	// NO_ART flag is deliberately ignored here.
-	return _isRandom && g_nancy->getGameType() < kGameTypeNancy13 && !_isDone && !_randomStopRequested;
+	return isRandom() && g_nancy->getGameType() < kGameTypeNancy13 && !_isDone && !_randomStopRequested;
 }
 
 void PlaySecondaryMovie::handleInput(NancyInput &input) {
@@ -349,7 +349,7 @@ void PlaySecondaryMovie::resolveSentinelFrames() {
 }
 
 void PlaySecondaryMovie::stopRandomNow() {
-	if (!_isRandom) {
+	if (!isRandom()) {
 		return;
 	}
 
@@ -367,7 +367,7 @@ void PlaySecondaryMovie::stopRandomNow() {
 
 void PlaySecondaryMovie::pauseRandom(bool pause) {
 	// The decoder counts pause levels, so only follow an actual change.
-	if (!_isRandom || _randomPaused == pause) {
+	if (!isRandom() || _randomPaused == pause) {
 		return;
 	}
 
@@ -376,7 +376,7 @@ void PlaySecondaryMovie::pauseRandom(bool pause) {
 }
 
 void PlaySecondaryMovie::playRandomSequence() {
-	if (!_isRandom || _sequences.empty()) {
+	if (!isRandom() || _sequences.empty()) {
 		return;
 	}
 	int picked = g_nancy->_randomSource->getRandomNumber(_sequences.size() - 1);
@@ -552,7 +552,7 @@ void PlaySecondaryMovie::readDataNancy14(Common::Serializer &ser, Common::Seekab
 
 	// AR 44 and its subclass AR 47 read the play-style field (retail "mode 0");
 	// AR 41 ("mode 1") does not.
-	if (isNancy15 && (_type == 44 || _type == 47)) {
+	if (isNancy15 && (_movieType == kMovieWithVolume || _movieType == kInteractiveMovie)) {
 		ser.syncAsUint16LE(_playStyle);
 	}
 
@@ -578,7 +578,7 @@ void PlaySecondaryMovie::readDataNancy14(Common::Serializer &ser, Common::Seekab
 	// Per-movie volume. AR 44 always carries it. AR 47 does too, but only from
 	// Nancy15 - the retail flipped the "mode" convention, and Nancy14's AR 47
 	// omits the byte.
-	if (_type == 44 || (_type == 47 && isNancy15)) {
+	if (_movieType == kMovieWithVolume || (_movieType == kInteractiveMovie && isNancy15)) {
 		ser.syncAsByte(_movieVolume);
 		_movieVolume = MIN<byte>(_movieVolume, 100);
 	}
@@ -603,7 +603,7 @@ void PlaySecondaryMovie::readDataNancy14(Common::Serializer &ser, Common::Seekab
 
 	// AR 47 ("InteractiveVideo") appends a name, a flag byte, and a list of
 	// named {value, flag} entries on top of the AR-44 movie data.
-	if (_type == 47) {
+	if (_movieType == kInteractiveMovie) {
 		readFilename(ser, _interactiveName);
 		byte flag = 0;
 		ser.syncAsByte(flag);
@@ -624,7 +624,7 @@ void PlaySecondaryMovie::readData(Common::SeekableReadStream &stream) {
 	Common::Serializer ser(&stream, nullptr);
 	ser.setVersion(g_nancy->getGameType());
 
-	if (_isRandom) {
+	if (isRandom()) {
 		// Nancy14 reworked the random-movie layout (Nancy13 and earlier use the
 		// older secondaryMovie-record + hotspot-list form).
 		if (g_nancy->getGameType() >= kGameTypeNancy14) {
@@ -640,8 +640,8 @@ void PlaySecondaryMovie::readData(Common::SeekableReadStream &stream) {
 		return;
 	}
 
-	// Nancy13's AR 53 shares this class but carries a different chunk.
-	if (g_nancy->getGameType() == kGameTypeNancy13 && _type == 41) {
+	// Nancy13's AR 41 shares this class but carries a more compact chunk.
+	if (g_nancy->getGameType() == kGameTypeNancy13 && _movieType == kSecondaryMovieTerse) {
 		readDataNancy13(ser, stream);
 		return;
 	}
@@ -742,7 +742,7 @@ void PlaySecondaryMovie::init() {
 		}
 	}
 
-	if (_isRandom) {
+	if (isRandom()) {
 		resolveSentinelFrames();
 	}
 
@@ -803,7 +803,7 @@ void PlaySecondaryMovie::execute() {
 		// Random-movie chain: while paused, wait for the pause to expire
 		// then re-roll. The roll itself may set up another pause, swap to
 		// the next sequence, or finish the AR if stop was requested.
-		if (_isRandom && _randomChainState == kRandomPaused) {
+		if (isRandom() && _randomChainState == kRandomPaused) {
 			if (_randomStopRequested) {
 				_state = kActionTrigger;
 				break;
@@ -863,7 +863,7 @@ void PlaySecondaryMovie::execute() {
 					_hotspot = _screenPosition;
 					_hasHotspot = true;
 				}
-			} else if (_isRandom && _videoDescs.empty()) {
+			} else if (isRandom() && _videoDescs.empty()) {
 				// A random movie with no descriptors isn't tied to a specific
 				// background frame: play it across the full viewport.
 				_screenPosition = NancySceneState.getViewport().getBounds();
@@ -960,7 +960,7 @@ void PlaySecondaryMovie::execute() {
 				_isFinished = true;
 			}
 
-			if (_isRandom) {
+			if (isRandom()) {
 				// Sequence finished: roll for next. If stop was requested
 				// by a PlayRandomMovieControl, wind the AR down normally.
 				if (_randomStopRequested) {
@@ -1031,7 +1031,7 @@ void PlaySecondaryMovie::execute() {
 }
 
 void PlaySecondaryMovie::skip() {
-	if (_isRandom || _state != kRun || _playerCursorAllowed != kNoPlayerCursorAllowed) {
+	if (isRandom() || _state != kRun || _playerCursorAllowed != kNoPlayerCursorAllowed) {
 		return;
 	}
 
@@ -1058,7 +1058,7 @@ void PlayRandomMovieControl::readData(Common::SeekableReadStream &stream) {
 
 void PlayRandomMovieControl::execute() {
 	PlaySecondaryMovie *target = NancySceneState.getActiveMovie();
-	if (target && target->_isRandom) {
+	if (target && target->isRandom()) {
 		if (_hasSceneChange) {
 			target->stopRandom();
 		} else {
diff --git a/engines/nancy/action/secondarymovie.h b/engines/nancy/action/secondarymovie.h
index 0ef9a4dadc7..1500824c2a8 100644
--- a/engines/nancy/action/secondarymovie.h
+++ b/engines/nancy/action/secondarymovie.h
@@ -80,7 +80,16 @@ public:
 		Common::Array<NextSequenceRef> nextSequences;
 	};
 
-	PlaySecondaryMovie(bool isRandom = false);
+	// Which of the action record types sharing this class is being played.
+	enum MovieType {
+		kSecondaryMovie,		// AR 53, up to Nancy13
+		kSecondaryMovieTerse,	// AR 41, Nancy13 and up
+		kRandomMovie,			// ARs 42, 43, 45
+		kMovieWithVolume,		// AR 44
+		kInteractiveMovie		// AR 47
+	};
+
+	PlaySecondaryMovie(MovieType movieType);
 	virtual ~PlaySecondaryMovie();
 
 	void init() override;
@@ -147,8 +156,11 @@ public:
 
 	MoviePlayer _decoder;
 
-	// Random-movie state (only populated when _isRandom).
-	bool _isRandom = false;
+	MovieType _movieType;
+
+	bool isRandom() const { return _movieType == kRandomMovie; }
+
+	// Random-movie state (only populated for kRandomMovie).
 	// "RandomMovie" picks any sequence; otherwise it names the starting one.
 	Common::String _startingSequenceName;
 	uint16 _randomPlayerCursorAllowed = kPlayerCursorAllowed;
@@ -209,7 +221,7 @@ public:
 	// hovering plays the recognition ("turn around") movie.
 	void handleInput(NancyInput &input) override;
 	CursorManager::CursorType getHoverCursor() const override;
-	bool cursorSetFromScript() const override { return _isRandom && _talkSceneID != kNoScene; }
+	bool cursorSetFromScript() const override { return isRandom() && _talkSceneID != kNoScene; }
 
 	Common::String getRecordExtraInfo() const override {
 		return Common::String::format("Scene %d, file %s", _sceneChange.sceneID, _videoName.baseName().c_str());
@@ -217,7 +229,7 @@ public:
 
 protected:
 	Common::String getRecordTypeName() const override {
-		return _isRandom ? "PlayRandomMovie" : "PlaySecondaryMovie";
+		return isRandom() ? "PlayRandomMovie" : "PlaySecondaryMovie";
 	}
 
 	// `ser` and `stream` must wrap the same input; `stream` is only
@@ -258,7 +270,7 @@ protected:
 
 	// A Nancy13 talkable character: has a conversation scene and a recognition
 	// movie to swap to on hover.
-	bool isTalkable() const { return _isRandom && _talkSceneID != kNoScene && !_secondaryMovie.name.empty(); }
+	bool isTalkable() const { return isRandom() && _talkSceneID != kNoScene && !_secondaryMovie.name.empty(); }
 
 	// Pick the next sequence (or "stay") per the weighted random rules.
 	// Returns -1 if "stay" was picked (and sets up the pause state),




More information about the Scummvm-git-logs mailing list