[Scummvm-git-logs] scummvm master -> 8492662279c62824a11c33bbb70fc1850cd91779
npjg
noreply at scummvm.org
Sat Jan 4 23:42:11 UTC 2025
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
21a9c4e91e MEDIASTATION: Convert enum classes to pure enums
7c56d35e77 MEDIASTATION: Fix more format GCC compiler warnings
5b157f5357 MEDIASTATION: Fix unused varable compiler warnings
e6186152a5 MEDIASTATION: Relocate header include guards
3f80111cc4 MEDIASTATION: Fix variable names not using camelCase.
609bb913c3 MEDIASTATION: Make sure class member names start with "_"
8492662279 MEDIASTATION: Static cast enum values printed as integers
Commit: 21a9c4e91ee1d8c3ee1a90038f32afb183d0a68b
https://github.com/scummvm/scummvm/commit/21a9c4e91ee1d8c3ee1a90038f32afb183d0a68b
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Convert enum classes to pure enums
This is much simpler and also addresses the recent GCC format compiler warnings.
Changed paths:
engines/mediastation/asset.cpp
engines/mediastation/asset.h
engines/mediastation/assetheader.cpp
engines/mediastation/assetheader.h
engines/mediastation/assets/canvas.cpp
engines/mediastation/assets/hotspot.cpp
engines/mediastation/assets/movie.cpp
engines/mediastation/assets/movie.h
engines/mediastation/assets/path.cpp
engines/mediastation/assets/sound.cpp
engines/mediastation/assets/sound.h
engines/mediastation/assets/sprite.cpp
engines/mediastation/assets/timer.cpp
engines/mediastation/bitmap.cpp
engines/mediastation/bitmap.h
engines/mediastation/boot.cpp
engines/mediastation/boot.h
engines/mediastation/context.cpp
engines/mediastation/context.h
engines/mediastation/contextparameters.cpp
engines/mediastation/contextparameters.h
engines/mediastation/datum.cpp
engines/mediastation/datum.h
engines/mediastation/mediascript/builtins.h
engines/mediastation/mediascript/codechunk.cpp
engines/mediastation/mediascript/codechunk.h
engines/mediastation/mediascript/eventhandler.cpp
engines/mediastation/mediascript/eventhandler.h
engines/mediastation/mediascript/function.cpp
engines/mediastation/mediascript/operand.cpp
engines/mediastation/mediascript/operand.h
engines/mediastation/mediascript/variable.cpp
engines/mediastation/mediascript/variable.h
engines/mediastation/mediastation.cpp
diff --git a/engines/mediastation/asset.cpp b/engines/mediastation/asset.cpp
index 39848548310..f8f05492619 100644
--- a/engines/mediastation/asset.cpp
+++ b/engines/mediastation/asset.cpp
@@ -20,7 +20,6 @@
*/
#include "mediastation/asset.h"
-#include "mediastation/assetheader.h"
namespace MediaStation {
diff --git a/engines/mediastation/asset.h b/engines/mediastation/asset.h
index c75f1856440..2f35db7b727 100644
--- a/engines/mediastation/asset.h
+++ b/engines/mediastation/asset.h
@@ -28,10 +28,10 @@
#include "mediastation/chunk.h"
#include "mediastation/mediascript/builtins.h"
#include "mediastation/mediascript/operand.h"
+#include "mediastation/assetheader.h"
namespace MediaStation {
-enum class AssetType;
class AssetHeader;
class Asset {
diff --git a/engines/mediastation/assetheader.cpp b/engines/mediastation/assetheader.cpp
index 525f3a0fc4a..ee96c491640 100644
--- a/engines/mediastation/assetheader.cpp
+++ b/engines/mediastation/assetheader.cpp
@@ -34,12 +34,12 @@ AssetHeader::AssetHeader(Chunk &chunk) {
_id = Datum(chunk).u.i;
debugC(4, kDebugLoading, "AssetHeader::AssetHeader(): _type = 0x%x, _id = 0x%x (@0x%llx)", _type, _id, static_cast<long long int>(chunk.pos()));
- AssetHeader::SectionType sectionType = getSectionType(chunk);
- bool moreSectionsToRead = (AssetHeader::SectionType::EMPTY != sectionType);
+ AssetHeaderSectionType sectionType = getSectionType(chunk);
+ bool moreSectionsToRead = (kAssetHeaderEmptySection != sectionType);
while (moreSectionsToRead) {
readSection(sectionType, chunk);
sectionType = getSectionType(chunk);
- moreSectionsToRead = (AssetHeader::SectionType::EMPTY != sectionType);
+ moreSectionsToRead = (kAssetHeaderEmptySection != sectionType);
}
}
@@ -52,38 +52,39 @@ AssetHeader::~AssetHeader() {
delete _endPoint;
}
-void AssetHeader::readSection(AssetHeader::SectionType sectionType, Chunk& chunk) {
- debugC(5, kDebugLoading, "AssetHeader::AssetHeader(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk) {
+ debugC(5, kDebugLoading, "AssetHeader::AssetHeader(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
switch (sectionType) {
- case AssetHeader::SectionType::EMPTY: {
+ case kAssetHeaderEmptySection: {
break;
}
- case AssetHeader::SectionType::EVENT_HANDLER: {
+ case kAssetHeaderEventHandler: {
EventHandler *eventHandler = new EventHandler(chunk);
switch (eventHandler->_type) {
- case EventHandler::Type::Time: {
+ case kTimerEvent: {
_timeHandlers.push_back(eventHandler);
break;
}
- case EventHandler::Type::KeyDown: {
+ case kKeyDownEvent: {
_keyDownHandlers.push_back(eventHandler);
break;
}
- case EventHandler::Type::Input: {
+ case kInputEvent: {
_inputHandlers.push_back(eventHandler);
break;
}
- case EventHandler::Type::LoadComplete: {
+ case kLoadCompleteEvent: {
_loadCompleteHandlers.push_back(eventHandler);
break;
}
default: {
- if (eventHandler->_argumentType != EventHandler::ArgumentType::Null && eventHandler->_argumentType != EventHandler::ArgumentType::Unk1) {
+ if (eventHandler->_argumentType != kNullEventHandlerArgument && \
+ eventHandler->_argumentType != kUnk1EventHandlerArgument) {
error("AssetHeader::readSection(): Event handler of type %d has a non-null argument type %d", eventHandler->_type, eventHandler->_argumentType);
}
@@ -98,12 +99,12 @@ void AssetHeader::readSection(AssetHeader::SectionType sectionType, Chunk& chunk
break;
}
- case AssetHeader::SectionType::STAGE_ID: {
+ case kAssetHeaderStageId: {
_stageId = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::ASSET_ID: {
+ case kAssetHeaderAssetId: {
// We already have this asset's ID, so we will just verify it is the same
// as the ID we have already read.
uint32 duplicateAssetId = Datum(chunk).u.i;
@@ -113,94 +114,94 @@ void AssetHeader::readSection(AssetHeader::SectionType sectionType, Chunk& chunk
break;
}
- case AssetHeader::SectionType::CHUNK_REFERENCE: {
+ case kAssetHeaderChunkReference: {
// These are references to the chunk(s) that hold the data for this asset.
// The references and the chunks have the following format "a501".
// There is no guarantee where these chunk(s) might actually be located:
// - They might be in the same RIFF subfile as this header,
// - They might be in a different RIFF subfile in the same CXT file,
// - They might be in a different CXT file entirely.
- _chunkReference = Datum(chunk, DatumType::REFERENCE).u.i;
+ _chunkReference = Datum(chunk, kDatumTypeReference).u.i;
break;
}
- case AssetHeader::SectionType::MOVIE_AUDIO_CHUNK_REFERENCE: {
- _audioChunkReference = Datum(chunk, DatumType::REFERENCE).u.i;
+ case kAssetHeaderMovieAudioChunkReference: {
+ _audioChunkReference = Datum(chunk, kDatumTypeReference).u.i;
break;
}
- case AssetHeader::SectionType::MOVIE_ANIMATION_CHUNK_REFERENCE: {
- _animationChunkReference = Datum(chunk, DatumType::REFERENCE).u.i;
+ case kAssetHeaderMovieAnimationChunkReference: {
+ _animationChunkReference = Datum(chunk, kDatumTypeReference).u.i;
break;
}
- case AssetHeader::SectionType::BOUNDING_BOX: {
- _boundingBox = Datum(chunk, DatumType::BOUNDING_BOX).u.bbox;
+ case kAssetHeaderBoundingBox: {
+ _boundingBox = Datum(chunk, kDatumTypeBoundingBox).u.bbox;
break;
}
- case AssetHeader::SectionType::MOUSE_ACTIVE_AREA: {
- _mouseActiveArea = Datum(chunk, DatumType::POLYGON).u.polygon;
+ case kAssetHeaderMouseActiveArea: {
+ _mouseActiveArea = Datum(chunk, kDatumTypePolygon).u.polygon;
break;
}
- case AssetHeader::SectionType::Z_INDEX: {
+ case kAssetHeaderZIndex: {
_zIndex = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::ASSET_REFERENCE: {
+ case kAssetHeaderAssetReference: {
_assetReference = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::STARTUP: {
+ case kAssetHeaderStartup: {
_startup = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::TRANSPARENCY: {
+ case kAssetHeaderTransparency: {
_transparency = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::HAS_OWN_SUBFILE: {
+ case kAssetHeaderHasOwnSubfile: {
_hasOwnSubfile = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::CURSOR_RESOURCE_ID: {
+ case kAssetHeaderCursorResourceId: {
_cursorResourceId = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::FRAME_RATE: {
+ case kAssetHeaderFrameRate: {
_frameRate = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::LOAD_TYPE: {
+ case kAssetHeaderLoadType: {
_loadType = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::SOUND_INFO: {
+ case kAssetHeaderSoundInfo: {
_totalChunks = Datum(chunk).u.i;
_rate = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::MOVIE_LOAD_TYPE: {
+ case kAssetHeaderMovieLoadType: {
_loadType = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::GET_OFFSTAGE_EVENTS: {
+ case kAssetHeaderGetOffstageEvents: {
_getOffstageEvents = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::PALETTE: {
+ case kAssetHeaderPalette: {
// TODO: Avoid the copying here!
const uint PALETTE_ENTRIES = 256;
const uint PALETTE_BYTES = PALETTE_ENTRIES * 3;
@@ -211,38 +212,38 @@ void AssetHeader::readSection(AssetHeader::SectionType sectionType, Chunk& chunk
break;
}
- case AssetHeader::SectionType::DISSOLVE_FACTOR: {
+ case kAssetHeaderDissolveFactor: {
_dissolveFactor = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::SOUND_ENCODING_1:
- case AssetHeader::SectionType::SOUND_ENCODING_2: {
+ case kAssetHeaderSoundEncoding1:
+ case kAssetHeaderSoundEncoding2: {
_soundEncoding = SoundEncoding(Datum(chunk).u.i);
break;
}
- case AssetHeader::SectionType::SPRITE_CHUNK_COUNT: {
+ case kAssetHeaderSpriteChunkCount: {
_chunkCount = Datum(chunk).u.i;
break;
}
- case AssetHeader::SectionType::START_POINT: {
- _startPoint = Datum(chunk, DatumType::POINT_2).u.point;
+ case kAssetHeaderStartPoint: {
+ _startPoint = Datum(chunk, kDatumTypePoint2).u.point;
break;
}
- case AssetHeader::SectionType::END_POINT: {
- _endPoint = Datum(chunk, DatumType::POINT_2).u.point;
+ case kAssetHeaderEndPoint: {
+ _endPoint = Datum(chunk, kDatumTypePoint2).u.point;
break;
}
- case AssetHeader::SectionType::STEP_RATE: {
- _stepRate = (uint32)(Datum(chunk, DatumType::FLOAT64_2).u.f);
+ case kAssetHeaderStepRate: {
+ _stepRate = (uint32)(Datum(chunk, kDatumTypeFloat64_2).u.f);
break;
}
- case AssetHeader::SectionType::DURATION: {
+ case kAssetHeaderDuration: {
// These are stored in the file as fractional seconds,
// but we want milliseconds.
_duration = (uint32)(Datum(chunk).u.f * 1000);
@@ -250,15 +251,15 @@ void AssetHeader::readSection(AssetHeader::SectionType sectionType, Chunk& chunk
}
default: {
- error("AssetHeader::readSection(): Unknown section type 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ error("AssetHeader::readSection(): Unknown section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
break;
}
}
}
-AssetHeader::SectionType AssetHeader::getSectionType(Chunk &chunk) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
- AssetHeader::SectionType sectionType = static_cast<AssetHeader::SectionType>(datum.u.i);
+AssetHeaderSectionType AssetHeader::getSectionType(Chunk &chunk) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
+ AssetHeaderSectionType sectionType = static_cast<AssetHeaderSectionType>(datum.u.i);
return sectionType;
}
diff --git a/engines/mediastation/assetheader.h b/engines/mediastation/assetheader.h
index f8ffe3eb41d..b442baef9c9 100644
--- a/engines/mediastation/assetheader.h
+++ b/engines/mediastation/assetheader.h
@@ -23,31 +23,11 @@
#define MEDIASTATION_ASSET_HEADER_H
#include "common/hashmap.h"
-#include "common/str.h"
#include "graphics/palette.h"
#include "mediastation/chunk.h"
#include "mediastation/mediascript/eventhandler.h"
-// Specialize the Common::Hash template for EventHandler::Type and ArgumentType
-namespace Common {
-
-template <>
-struct Hash<MediaStation::EventHandler::Type> {
- uint operator()(const MediaStation::EventHandler::Type &key) const {
- return static_cast<uint>(key);
- }
-};
-
-template <>
-struct Hash<MediaStation::EventHandler::ArgumentType> {
- uint operator()(const MediaStation::EventHandler::ArgumentType &key) const {
- return static_cast<uint>(key);
- }
-};
-
-} // End of namespace Common
-
namespace MediaStation {
struct MovieChunkReference {
@@ -58,93 +38,91 @@ struct MovieChunkReference {
typedef uint32 ChunkReference;
-enum class AssetType {
- SCREEN = 0x0001, // SCR
- STAGE = 0x0002, // STG
- PATH = 0x0004, // PTH
- SOUND = 0x0005, // SND
- TIMER = 0x0006, // TMR
- IMAGE = 0x0007, // IMG
- HOTSPOT = 0x000b, // HSP
- SPRITE = 0x000e, // SPR
- LK_ZAZU = 0x000f,
- LK_CONSTELLATIONS = 0x0010,
- IMAGE_SET = 0x001d,
- CURSOR = 0x000c, // CSR
- PRINTER = 0x0019, // PRT
- MOVIE = 0x0016, // MOV
- PALETTE = 0x0017,
- TEXT = 0x001a, // TXT
- FONT = 0x001b, // FON
- CAMERA = 0x001c, // CAM
- CANVAS = 0x001e, // CVS
+typedef uint32 AssetId;
+
+enum AssetType {
+ kAssetTypeScreen = 0x0001, // SCR
+ kAssetTypeStage = 0x0002, // STG
+ kAssetTypePath = 0x0004, // PTH
+ kAssetTypeSound = 0x0005, // SND
+ kAssetTypeTimer = 0x0006, // TMR
+ kAssetTypeImage = 0x0007, // IMG
+ kAssetTypeHotspot = 0x000b, // HSP
+ kAssetTypeSprite = 0x000e, // SPR
+ kAssetTypeLKZazu = 0x000f,
+ kAssetTypeLKConstellations = 0x0010,
+ kAssetTypeImageSet = 0x001d,
+ kAssetTypeCursor = 0x000c, // CSR
+ kAssetTypePrinter = 0x0019, // PRT
+ kAssetTypeMovie = 0x0016, // MOV
+ kAssetTypePalette = 0x0017,
+ kAssetTypeText = 0x001a, // TXT
+ kAssetTypeFont = 0x001b, // FON
+ kAssetTypeCamera = 0x001c, // CAM
+ kAssetTypeCanvas = 0x001e, // CVS
// TODO: Discover how the XSND differs from regular sounds.
// Only appears in Ariel.
- XSND = 0x001f,
- XSND_MIDI = 0x0020,
+ kAssetTypeXsnd= 0x001f,
+ kAssetTypeXsndMidi = 0x0020,
// TODO: Figure out what this is. Only appears in Ariel.
- RECORDER = 0x0021,
- FUNCTION = 0x0069 // FUN
+ kAssetTypeRecorder = 0x0021,
+ kAssetTypeFunction = 0x0069 // FUN
};
-typedef uint32 AssetId;
+enum AssetHeaderSectionType {
+ kAssetHeaderEmptySection = 0x0000,
+ kAssetHeaderSoundEncoding1 = 0x0001,
+ kAssetHeaderSoundEncoding2 = 0x0002,
+ kAssetHeaderEventHandler = 0x0017,
+ kAssetHeaderStageId = 0x0019,
+ kAssetHeaderAssetId = 0x001a,
+ kAssetHeaderChunkReference = 0x001b,
+ kAssetHeaderMovieAnimationChunkReference = 0x06a4,
+ kAssetHeaderMovieAudioChunkReference = 0x06a5,
+ kAssetHeaderAssetReference = 0x077b,
+ kAssetHeaderBoundingBox = 0x001c,
+ kAssetHeaderMouseActiveArea = 0x001d,
+ kAssetHeaderZIndex = 0x001e,
+ kAssetHeaderStartup = 0x001f,
+ kAssetHeaderTransparency = 0x0020,
+ kAssetHeaderHasOwnSubfile = 0x0021,
+ kAssetHeaderCursorResourceId = 0x0022,
+ kAssetHeaderFrameRate = 0x0024,
+ kAssetHeaderLoadType = 0x0032,
+ kAssetHeaderSoundInfo = 0x0033,
+ kAssetHeaderMovieLoadType = 0x0037,
+ kAssetHeaderSpriteChunkCount = 0x03e8,
+ kAssetHeaderPalette = 0x05aa,
+ kAssetHeaderDissolveFactor = 0x05dc,
+ kAssetHeaderGetOffstageEvents = 0x05dd,
+ kAssetHeaderX = 0x05de,
+ kAssetHeaderY = 0x05df,
+
+ // PATH FIELDS.
+ kAssetHeaderStartPoint = 0x060e,
+ kAssetHeaderEndPoint = 0x060f,
+ kAssetHeaderPathUnk1 = 0x0610,
+ kAssetHeaderStepRate = 0x0611,
+ kAssetHeaderDuration = 0x0612,
+
+ // CAMERA FIELDS.
+ kAssetHeaderViewportOrigin = 0x076f,
+ kAssetHeaderLensOpen = 0x0770,
+
+ // STAGE FIELDS.
+ kAssetHeaderStageUnk1 = 0x0771,
+ kAssetHeaderCylindricalX = 0x0772,
+ kAssetHeaderCylindricalY = 0x0773,
+ kAssetHeaderAssetName = 0x0bb8,
+};
+
+enum SoundEncoding {
+ PCM_S16LE_MONO_22050 = 0x0010, // Uncompressed linear PCM
+ IMA_ADPCM_S16LE_MONO_22050 = 0x0004 // IMA ADPCM encoding, must be decoded
+};
class AssetHeader {
public:
- enum class SectionType {
- EMPTY = 0x0000,
- SOUND_ENCODING_1 = 0x0001,
- SOUND_ENCODING_2 = 0x0002,
- EVENT_HANDLER = 0x0017,
- STAGE_ID = 0x0019,
- ASSET_ID = 0x001a,
- CHUNK_REFERENCE = 0x001b,
- MOVIE_ANIMATION_CHUNK_REFERENCE = 0x06a4,
- MOVIE_AUDIO_CHUNK_REFERENCE = 0x06a5,
- ASSET_REFERENCE = 0x077b,
- BOUNDING_BOX = 0x001c,
- MOUSE_ACTIVE_AREA = 0x001d,
- Z_INDEX = 0x001e,
- STARTUP = 0x001f,
- TRANSPARENCY = 0x0020,
- HAS_OWN_SUBFILE = 0x0021,
- CURSOR_RESOURCE_ID = 0x0022,
- FRAME_RATE = 0x0024,
- LOAD_TYPE = 0x0032,
- SOUND_INFO = 0x0033,
- MOVIE_LOAD_TYPE = 0x0037,
- SPRITE_CHUNK_COUNT = 0x03e8,
-
- PALETTE = 0x05aa,
- DISSOLVE_FACTOR = 0x05dc,
- GET_OFFSTAGE_EVENTS = 0x05dd,
- X = 0x05de,
- Y = 0x05df,
-
- // PATH FIELDS.
- START_POINT = 0x060e,
- END_POINT = 0x060f,
- PATH_UNK1 = 0x0610,
- STEP_RATE = 0x0611,
- DURATION = 0x0612,
-
- // CAMERA FIELDS.
- VIEWPORT_ORIGIN = 0x076f,
- LENS_OPEN = 0x770,
-
- // STAGE FIELDS.
- STAGE_UNK1 = 0x771,
- CYLINDRICAL_X = 0x772,
- CYLINDRICAL_Y = 0x773,
-
- ASSET_NAME = 0x0bb8,
- };
-
- enum class SoundEncoding {
- PCM_S16LE_MONO_22050 = 0x0010, // Uncompressed linear PCM
- IMA_ADPCM_S16LE_MONO_22050 = 0x0004 // IMA ADPCM encoding, must be decoded
- };
-
AssetHeader(Chunk &chunk);
~AssetHeader();
@@ -186,15 +164,15 @@ public:
uint32 _duration = 0;
// EVENT HANDLER FIELDS.
- Common::HashMap<EventHandler::Type, EventHandler *> _eventHandlers;
+ Common::HashMap<uint, EventHandler *> _eventHandlers;
Common::Array<EventHandler *> _timeHandlers;
Common::Array<EventHandler *> _keyDownHandlers;
Common::Array<EventHandler *> _inputHandlers;
Common::Array<EventHandler *> _loadCompleteHandlers;
private:
- void readSection(AssetHeader::SectionType sectionType, Chunk &chunk);
- AssetHeader::SectionType getSectionType(Chunk &chunk);
+ void readSection(AssetHeaderSectionType sectionType, Chunk &chunk);
+ AssetHeaderSectionType getSectionType(Chunk &chunk);
};
} // End of namespace MediaStation
diff --git a/engines/mediastation/assets/canvas.cpp b/engines/mediastation/assets/canvas.cpp
index a945d172805..eda5da541a4 100644
--- a/engines/mediastation/assets/canvas.cpp
+++ b/engines/mediastation/assets/canvas.cpp
@@ -25,7 +25,7 @@ namespace MediaStation {
Operand Canvas::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
switch (methodId) {
- case BuiltInMethod::clearToPalette: {
+ case kClearToPaletteMethod: {
error("Canvas::callMethod(): BuiltInFunction::clearToPalette is not implemented yet");
}
diff --git a/engines/mediastation/assets/hotspot.cpp b/engines/mediastation/assets/hotspot.cpp
index 6f181a3c292..8d501e1ea12 100644
--- a/engines/mediastation/assets/hotspot.cpp
+++ b/engines/mediastation/assets/hotspot.cpp
@@ -25,13 +25,13 @@ namespace MediaStation {
Operand Hotspot::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
switch (methodId) {
- case BuiltInMethod::mouseActivate: {
+ case kMouseActivateMethod: {
assert(args.empty());
warning("Hotspot::callMethod(): BuiltInFunction::mouseActivate is not implemented");
return Operand();
}
- case BuiltInMethod::mouseDeactivate: {
+ case kMouseDeactivateMethod: {
assert(args.empty());
warning("Hotspot::callMethod(): BuiltInFunction::mouseDeactivate is not implemented");
return Operand();
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index 8a7b977f7b3..7916b0ad680 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -170,7 +170,7 @@ Movie::~Movie() {
Operand Movie::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
switch (methodId) {
- case BuiltInMethod::timePlay: {
+ case kTimePlayMethod: {
assert(args.empty());
timePlay();
return Operand();
@@ -218,7 +218,7 @@ void Movie::timePlay() {
}
// RUN THE MOVIE START EVENT HANDLER.
- EventHandler *startEvent = _header->_eventHandlers.getValOrDefault(EventHandler::Type::MovieBegin);
+ EventHandler *startEvent = _header->_eventHandlers.getValOrDefault(kMovieBeginEvent);
if (startEvent != nullptr) {
debugC(5, kDebugScript, "Movie::timePlay(): Executing movie start event handler");
startEvent->execute(_header->_id);
@@ -234,7 +234,7 @@ void Movie::timeStop() {
_lastProcessedTime = 0;
// RUN THE MOVIE STOPPED EVENT HANDLER.
- EventHandler *endEvent = _header->_eventHandlers.getValOrDefault(EventHandler::Type::MovieStopped);
+ EventHandler *endEvent = _header->_eventHandlers.getValOrDefault(kMovieStoppedEvent);
if (endEvent != nullptr) {
debugC(5, kDebugScript, "Movie::play(): Executing movie stopped event handler");
endEvent->execute(_header->_id);
@@ -283,7 +283,7 @@ bool Movie::drawNextFrame() {
_lastProcessedTime = 0;
// Run the movie end event handler.
- EventHandler *endEvent = _header->_eventHandlers.getValOrDefault(EventHandler::Type::MovieEnd);
+ EventHandler *endEvent = _header->_eventHandlers.getValOrDefault(kMovieEndEvent);
if (endEvent != nullptr) {
debugC(5, kDebugScript, "Movie::drawNextFrame(): Executing movie end event handler");
endEvent->execute(_header->_id);
@@ -320,8 +320,8 @@ bool Movie::drawNextFrame() {
void Movie::readChunk(Chunk &chunk) {
// Individual chunks are "stills" and are stored in the first subfile.
uint sectionType = Datum(chunk).u.i;
- switch ((SectionType)sectionType) {
- case SectionType::FRAME: {
+ switch ((MovieSectionType)sectionType) {
+ case kMovieFrameSection: {
debugC(5, kDebugLoading, "Movie::readStill(): Reading frame");
MovieFrameHeader *header = new MovieFrameHeader(chunk);
MovieFrame *frame = new MovieFrame(chunk, header);
@@ -329,7 +329,7 @@ void Movie::readChunk(Chunk &chunk) {
break;
}
- case SectionType::FOOTER: {
+ case kMovieFooterSection: {
debugC(5, kDebugLoading, "Movie::readStill(): Reading footer");
MovieFrameFooter *footer = new MovieFrameFooter(chunk);
_footers.push_back(footer);
@@ -346,7 +346,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
// READ THE METADATA FOR THE WHOLE MOVIE.
uint expectedRootSectionType = Datum(chunk).u.i;
debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", expectedRootSectionType, chunk.pos());
- if (Movie::SectionType::ROOT != (Movie::SectionType)expectedRootSectionType) {
+ if (kMovieRootSection != (MovieSectionType)expectedRootSectionType) {
error("Expected ROOT section type, got 0x%x", expectedRootSectionType);
}
uint chunkCount = Datum(chunk).u.i;
@@ -378,15 +378,15 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
while (isAnimationChunk) {
uint sectionType = Datum(chunk).u.i;
debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", sectionType, chunk.pos());
- switch (Movie::SectionType(sectionType)) {
- case Movie::SectionType::FRAME: {
+ switch (MovieSectionType(sectionType)) {
+ case kMovieFrameSection: {
header = new MovieFrameHeader(chunk);
frame = new MovieFrame(chunk, header);
_frames.push_back(frame);
break;
}
- case Movie::SectionType::FOOTER: {
+ case kMovieFooterSection: {
MovieFrameFooter *footer = new MovieFrameFooter(chunk);
// _footers.push_back(footer);
// TODO: This does NOT handle the case where there are
@@ -421,11 +421,11 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
chunk.read((void *)buffer, chunk.length);
Audio::SeekableAudioStream *stream = nullptr;
switch (_header->_soundEncoding) {
- case AssetHeader::SoundEncoding::PCM_S16LE_MONO_22050:
+ case SoundEncoding::PCM_S16LE_MONO_22050:
stream = Audio::makeRawStream(buffer, chunk.length, 22050, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN, DisposeAfterUse::YES);
break;
- case AssetHeader::SoundEncoding::IMA_ADPCM_S16LE_MONO_22050:
+ case SoundEncoding::IMA_ADPCM_S16LE_MONO_22050:
// TODO: The interface here is different. We can't pass in the
// buffers directly. We have to make a stream first.
// stream = Audio::makeADPCMStream(buffer, chunk.length,
diff --git a/engines/mediastation/assets/movie.h b/engines/mediastation/assets/movie.h
index 32e548d7569..e1a565770c7 100644
--- a/engines/mediastation/assets/movie.h
+++ b/engines/mediastation/assets/movie.h
@@ -83,14 +83,13 @@ private:
MovieFrameFooter *_footer;
};
-class Movie : public Asset {
-private:
- enum class SectionType {
- ROOT = 0x06a8,
- FRAME = 0x06a9,
- FOOTER = 0x06aa
- };
+enum MovieSectionType {
+ kMovieRootSection = 0x06a8,
+ kMovieFrameSection = 0x06a9,
+ kMovieFooterSection = 0x06aa
+};
+class Movie : public Asset {
public:
Movie(AssetHeader *header) : Asset(header) {};
virtual ~Movie() override;
diff --git a/engines/mediastation/assets/path.cpp b/engines/mediastation/assets/path.cpp
index b51f3fbfda0..d5d0ca038bc 100644
--- a/engines/mediastation/assets/path.cpp
+++ b/engines/mediastation/assets/path.cpp
@@ -30,22 +30,22 @@ Path::~Path() {
Operand Path::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
switch (methodId) {
- case BuiltInMethod::timePlay: {
+ case kTimePlayMethod: {
assert(args.size() == 0);
timePlay();
return Operand();
}
- case BuiltInMethod::setDuration: {
+ case kSetDurationMethod: {
assert(args.size() == 1);
uint durationInMilliseconds = (uint)(args[0].getDouble() * 1000);
setDuration(durationInMilliseconds);
return Operand();
}
- case BuiltInMethod::percentComplete: {
+ case kPercentCompleteMethod: {
assert(args.size() == 0);
- Operand returnValue(Operand::Type::Float1);
+ Operand returnValue(kOperandTypeFloat1);
returnValue.putDouble(percentComplete());
return returnValue;
}
@@ -79,7 +79,7 @@ void Path::timePlay() {
}
// STEP THE PATH.
- EventHandler *pathStepHandler = _header->_eventHandlers[EventHandler::Type::Step];
+ EventHandler *pathStepHandler = _header->_eventHandlers[kStepEvent];
for (uint i = 0; i < totalSteps; i++) {
_percentComplete = (double)(i + 1) / totalSteps;
debugC(5, kDebugScript, "Path::timePlay(): Step %d of %d", i, totalSteps);
@@ -97,7 +97,7 @@ void Path::timePlay() {
}
// RUN THE END EVENT HANDLER.
- EventHandler *endEventHandler = _header->_eventHandlers[EventHandler::Type::PathEnd];
+ EventHandler *endEventHandler = _header->_eventHandlers[kPathEndEvent];
if (endEventHandler != nullptr) {
debugC(5, kDebugScript, "Path::timePlay(): Running PathEnd event handler");
endEventHandler->execute(_header->_id);
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index c2b29a58217..783b182fe93 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -59,13 +59,13 @@ void Sound::readChunk(Chunk &chunk) {
chunk.read((void *)buffer, chunk.length);
switch (_encoding) {
- case AssetHeader::SoundEncoding::PCM_S16LE_MONO_22050: {
+ case SoundEncoding::PCM_S16LE_MONO_22050: {
// Audio::SeekableAudioStream *stream = Audio::makeRawStream(buffer, chunk.length, Sound::RATE, Sound::FLAGS, DisposeAfterUse::NO);
//_streams.push_back(stream);
break;
}
- case AssetHeader::SoundEncoding::IMA_ADPCM_S16LE_MONO_22050: {
+ case SoundEncoding::IMA_ADPCM_S16LE_MONO_22050: {
// TODO: Support ADPCM decoding.
// Audio::SeekableAudioStream *stream = nullptr; // Audio::makeADPCMStream(buffer, chunk.length, DisposeAfterUse::NO, Audio::ADPCMType::kADPCMMSIma, Sound::RATE, 1, 4);
//_streams.push_back(stream);
diff --git a/engines/mediastation/assets/sound.h b/engines/mediastation/assets/sound.h
index a9fcc00d17c..666d09ced19 100644
--- a/engines/mediastation/assets/sound.h
+++ b/engines/mediastation/assets/sound.h
@@ -56,7 +56,7 @@ public:
static const byte FLAGS = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
private:
- AssetHeader::SoundEncoding _encoding;
+ SoundEncoding _encoding;
byte *_samples = nullptr;
};
diff --git a/engines/mediastation/assets/sprite.cpp b/engines/mediastation/assets/sprite.cpp
index 2d14f49fffe..34209c3b3e8 100644
--- a/engines/mediastation/assets/sprite.cpp
+++ b/engines/mediastation/assets/sprite.cpp
@@ -29,7 +29,7 @@ namespace MediaStation {
SpriteFrameHeader::SpriteFrameHeader(Chunk &chunk) : BitmapHeader(chunk) {
_index = Datum(chunk).u.i;
debugC(5, kDebugLoading, "SpriteFrameHeader::SpriteFrameHeader(): _index = 0x%x (@0x%llx)", _index, chunk.pos());
- _boundingBox = Datum(chunk, DatumType::POINT_2).u.point;
+ _boundingBox = Datum(chunk, kDatumTypePoint2).u.point;
debugC(5, kDebugLoading, "SpriteFrameHeader::SpriteFrameHeader(): _boundingBox (@0x%llx)", chunk.pos());
}
@@ -72,19 +72,19 @@ Sprite::~Sprite() {
Operand Sprite::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
switch (methodId) {
- case BuiltInMethod::spatialShow: {
+ case kSpatialShowMethod: {
assert(args.size() == 0);
spatialShow();
return Operand();
}
- case BuiltInMethod::timePlay: {
+ case kTimePlayMethod: {
assert(args.size() == 0);
timePlay();
return Operand();
}
- case BuiltInMethod::movieReset: {
+ case kMovieResetMethod: {
assert(args.size() == 0);
movieReset();
return Operand();
@@ -126,7 +126,7 @@ void Sprite::timePlay() {
}
// RUN THE MOVIE START EVENT HANDLER.
- EventHandler *startEvent = _header->_eventHandlers.getValOrDefault(EventHandler::Type::MovieBegin);
+ EventHandler *startEvent = _header->_eventHandlers.getValOrDefault(kMovieBeginEvent);
if (startEvent != nullptr) {
debugC(5, kDebugScript, "Sprite::timePlay(): Executing start event handler");
startEvent->execute(_header->_id);
@@ -208,7 +208,7 @@ void Sprite::drawNextFrame() {
_nextFrameTime = 0;
// RUN THE SPRITE END EVENT HANDLER.
- EventHandler *endEvent = _header->_eventHandlers.getValOrDefault(EventHandler::Type::MovieEnd);
+ EventHandler *endEvent = _header->_eventHandlers.getValOrDefault(kMovieEndEvent);
if (endEvent != nullptr) {
debugC(5, kDebugScript, "Sprite::drawNextFrame(): Executing end event handler");
endEvent->execute(_header->_id);
diff --git a/engines/mediastation/assets/timer.cpp b/engines/mediastation/assets/timer.cpp
index 35e9cf9d82c..dda6eb6b3f3 100644
--- a/engines/mediastation/assets/timer.cpp
+++ b/engines/mediastation/assets/timer.cpp
@@ -28,13 +28,13 @@ namespace MediaStation {
Operand Timer::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
switch (methodId) {
- case BuiltInMethod::timePlay: {
+ case kTimePlayMethod: {
assert(args.size() == 0);
timePlay();
return Operand();
}
- case BuiltInMethod::timeStop: {
+ case kTimeStopMethod: {
assert(args.size() == 0);
timeStop();
return Operand();
diff --git a/engines/mediastation/bitmap.cpp b/engines/mediastation/bitmap.cpp
index c6eff26eb93..f7d980406a4 100644
--- a/engines/mediastation/bitmap.cpp
+++ b/engines/mediastation/bitmap.cpp
@@ -26,15 +26,15 @@
namespace MediaStation {
BitmapHeader::BitmapHeader(Chunk &chunk) {
- /*uint header_size_in_bytes =*/ Datum(chunk, DatumType::UINT16_1).u.i;
+ /*uint header_size_in_bytes =*/ Datum(chunk, kDatumTypeUint16_1).u.i;
dimensions = Datum(chunk).u.point;
- compression_type = BitmapHeader::CompressionType(Datum(chunk, DatumType::UINT16_1).u.i);
+ compression_type = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", compression_type);
// TODO: Figure out what this is.
// This has something to do with the width of the bitmap but is always
// a few pixels off from the width. And in rare cases it seems to be
// the true width!
- unk2 = Datum(chunk, DatumType::UINT16_1).u.i;
+ unk2 = Datum(chunk, kDatumTypeUint16_1).u.i;
}
BitmapHeader::~BitmapHeader() {
@@ -43,8 +43,7 @@ BitmapHeader::~BitmapHeader() {
}
bool BitmapHeader::isCompressed() {
- return (compression_type != BitmapHeader::CompressionType::UNCOMPRESSED) &&
- (compression_type != BitmapHeader::CompressionType::UNCOMPRESSED_2);
+ return (compression_type != kUncompressedBitmap1) && (compression_type != kUncompressedBitmap2);
}
Bitmap::Bitmap(Chunk &chunk, BitmapHeader *bitmapHeader) :
diff --git a/engines/mediastation/bitmap.h b/engines/mediastation/bitmap.h
index 6e1efe1407e..da274067ca2 100644
--- a/engines/mediastation/bitmap.h
+++ b/engines/mediastation/bitmap.h
@@ -29,22 +29,22 @@
namespace MediaStation {
+enum BitmapCompressionType {
+ kUncompressedBitmap1 = 0,
+ kRleCompressedBitmap = 1,
+ kUnk1CompressedBitmap = 6,
+ kUncompressedBitmap2 = 7,
+};
+
class BitmapHeader {
public:
- enum class CompressionType {
- UNCOMPRESSED = 0,
- RLE_COMPRESSED = 1,
- UNK1 = 6,
- UNCOMPRESSED_2 = 7,
- };
-
BitmapHeader(Chunk &chunk);
~BitmapHeader();
bool isCompressed();
Common::Point *dimensions = nullptr;
- CompressionType compression_type;
+ BitmapCompressionType compression_type;
uint unk2;
};
diff --git a/engines/mediastation/boot.cpp b/engines/mediastation/boot.cpp
index c5c67d24d8c..938374cb160 100644
--- a/engines/mediastation/boot.cpp
+++ b/engines/mediastation/boot.cpp
@@ -29,10 +29,10 @@ namespace MediaStation {
#pragma region VersionInfo
VersionInfo::VersionInfo(Chunk &chunk) {
- majorVersion = Datum(chunk, DatumType::UINT16_1).u.i;
- minorVersion = Datum(chunk, DatumType::UINT16_1).u.i;
- revision = Datum(chunk, DatumType::UINT16_1).u.i;
- string = Datum(chunk, DatumType::STRING).u.string;
+ majorVersion = Datum(chunk, kDatumTypeUint16_1).u.i;
+ minorVersion = Datum(chunk, kDatumTypeUint16_1).u.i;
+ revision = Datum(chunk, kDatumTypeUint16_1).u.i;
+ string = Datum(chunk, kDatumTypeString).u.string;
}
VersionInfo::~VersionInfo() {
@@ -45,8 +45,8 @@ VersionInfo::~VersionInfo() {
#pragma region ContextDeclaration
ContextDeclaration::ContextDeclaration(Chunk &chunk) {
// ENSURE WE HAVEN'T REACHED THE END OF THE DECLARATIONS.
- ContextDeclaration::SectionType sectionType = getSectionType(chunk);
- if (ContextDeclaration::SectionType::EMPTY == sectionType) {
+ ContextDeclarationSectionType sectionType = getSectionType(chunk);
+ if (kContextDeclarationEmptySection == sectionType) {
isLast = true;
return;
} else {
@@ -55,17 +55,17 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
}
// READ THE FILE REFERENCES.
- while (ContextDeclaration::SectionType::FILE_REFERENCE == sectionType) {
+ while (kContextDeclarationFileReference == sectionType) {
int fileReference = Datum(chunk).u.i;
fileReferences.push_back(fileReference);
sectionType = getSectionType(chunk);
}
// READ THE OTHER CONTEXT METADATA.
- if (ContextDeclaration::SectionType::PLACEHOLDER == sectionType) {
+ if (kContextDeclarationPlaceholder == sectionType) {
// READ THE FILE NUMBER.
sectionType = getSectionType(chunk);
- if (ContextDeclaration::SectionType::FILE_NUMBER_1 == sectionType) {
+ if (kContextDeclarationFileNumber1 == sectionType) {
fileNumber = Datum(chunk).u.i;
} else {
error("ContextDeclaration(): Expected section type FILE_NUMBER_1, got 0x%x", sectionType);
@@ -73,11 +73,11 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
// I don't know why the file number is always repeated.
// Is it just for data integrity, or is there some other reason?
sectionType = getSectionType(chunk);
- if (ContextDeclaration::SectionType::FILE_NUMBER_2 == sectionType) {
+ if (kContextDeclarationFileNumber2 == sectionType) {
uint32 repeatedFileNumber = Datum(chunk).u.i;
if (repeatedFileNumber != fileNumber) {
warning("ContextDeclaration(): Expected file numbers to match, but 0x%d != 0x%d", fileNumber, repeatedFileNumber);
- }
+ }
} else {
error("ContextDeclaration(): Expected section type FILE_NUMBER_2, got 0x%x", sectionType);
}
@@ -90,23 +90,23 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
// on reading and rewinding.
int rewindOffset = chunk.pos();
sectionType = getSectionType(chunk);
- if (ContextDeclaration::SectionType::CONTEXT_NAME == sectionType) {
- contextName = Datum(chunk, DatumType::STRING).u.string;
+ if (kContextDeclarationName == sectionType) {
+ contextName = Datum(chunk, kDatumTypeString).u.string;
} else {
// THERE IS NO CONTEXT NAME.
// We have instead read into the next declaration, so let's undo that.
chunk.seek(rewindOffset);
}
- } else if (ContextDeclaration::SectionType::EMPTY == sectionType) {
+ } else if (kContextDeclarationEmptySection == sectionType) {
isLast = true;
} else {
error("ContextDeclaration::ContextDeclaration(): Unknown section type 0x%x", sectionType);
}
}
-ContextDeclaration::SectionType ContextDeclaration::getSectionType(Chunk &chunk) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
- ContextDeclaration::SectionType sectionType = static_cast<ContextDeclaration::SectionType>(datum.u.i);
+ContextDeclarationSectionType ContextDeclaration::getSectionType(Chunk &chunk) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
+ ContextDeclarationSectionType sectionType = static_cast<ContextDeclarationSectionType>(datum.u.i);
return sectionType;
}
@@ -119,8 +119,8 @@ ContextDeclaration::~ContextDeclaration() {
#pragma region UnknownDeclaration
UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
// ENSURE THIS DECLARATION IS NOT EMPTY.
- UnknownDeclaration::SectionType sectionType = getSectionType(chunk);
- if (UnknownDeclaration::SectionType::EMPTY == sectionType) {
+ UnknownDeclarationSectionType sectionType = getSectionType(chunk);
+ if (kUnknownDeclarationEmptySection == sectionType) {
_isLast = true;
return;
} else {
@@ -130,14 +130,14 @@ UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
// READ THE UNKNOWN VALUE.
sectionType = getSectionType(chunk);
- if (UnknownDeclaration::SectionType::UNK_1 == sectionType) {
- _unk = Datum(chunk, DatumType::UINT16_1).u.i;
+ if (kUnknownDeclarationUnk1 == sectionType) {
+ _unk = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
error("UnknownDeclaration(): Expected section type UNK_1, got 0x%x", sectionType);
}
sectionType = getSectionType(chunk);
- if (UnknownDeclaration::SectionType::UNK_2 == sectionType) {
- uint16 repeatedUnk = Datum(chunk, DatumType::UINT16_1).u.i;
+ if (kUnknownDeclarationUnk2 == sectionType) {
+ uint16 repeatedUnk = Datum(chunk, kDatumTypeUint16_1).u.i;
if (repeatedUnk != _unk) {
warning("UnknownDeclaration(): Expected unknown values to match, but 0x%x != 0x%x", _unk, repeatedUnk);
}
@@ -146,9 +146,9 @@ UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
}
}
-UnknownDeclaration::SectionType UnknownDeclaration::getSectionType(Chunk &chunk) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
- UnknownDeclaration::SectionType sectionType = static_cast<UnknownDeclaration::SectionType>(datum.u.i);
+UnknownDeclarationSectionType UnknownDeclaration::getSectionType(Chunk &chunk) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
+ UnknownDeclarationSectionType sectionType = static_cast<UnknownDeclarationSectionType>(datum.u.i);
return sectionType;
}
#pragma endregion
@@ -156,8 +156,8 @@ UnknownDeclaration::SectionType UnknownDeclaration::getSectionType(Chunk &chunk)
#pragma region FileDeclaration
FileDeclaration::FileDeclaration(Chunk &chunk) {
// ENSURE THIS DECLARATION IS NOT EMPTY.
- FileDeclaration::SectionType sectionType = getSectionType(chunk);
- if (FileDeclaration::SectionType::EMPTY == sectionType) {
+ FileDeclarationSectionType sectionType = getSectionType(chunk);
+ if (kFileDeclarationEmptySection == sectionType) {
_isLast = true;
return;
} else {
@@ -167,18 +167,18 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
// READ THE FILE ID.
sectionType = getSectionType(chunk);
- if (FileDeclaration::SectionType::FILE_ID == sectionType) {
- _id = Datum(chunk, DatumType::UINT16_1).u.i;
+ if (kFileDeclarationFileId == sectionType) {
+ _id = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
error("FileDeclaration(): Expected section type FILE_ID, got 0x%x", sectionType);
}
// READ THE INTENDED LOCATION OF THE FILE.
sectionType = getSectionType(chunk);
- if (FileDeclaration::SectionType::FILE_NAME_AND_TYPE == sectionType) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
+ if (kFileDeclarationFileNameAndType == sectionType) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
// TODO: Verify we actually read a valid enum member.
- _intendedLocation = static_cast<FileDeclaration::IntendedLocation>(datum.u.i);
+ _intendedLocation = static_cast<IntendedFileLocation>(datum.u.i);
} else {
error("FileDeclaration(): Expected section type FILE_NAME_AND_TYPE, got 0x%x", sectionType);
}
@@ -187,12 +187,12 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
// Since the platforms that Media Station originally targeted were case-insensitive,
// the case of these filenames might not match the case of the files actually in
// the directory. All files should be matched case-insensitively.
- _name = Datum(chunk, DatumType::FILENAME).u.string;
+ _name = Datum(chunk, kDatumTypeFilename).u.string;
}
-FileDeclaration::SectionType FileDeclaration::getSectionType(Chunk &chunk) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
- FileDeclaration::SectionType sectionType = static_cast<FileDeclaration::SectionType>(datum.u.i);
+FileDeclarationSectionType FileDeclaration::getSectionType(Chunk &chunk) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
+ FileDeclarationSectionType sectionType = static_cast<FileDeclarationSectionType>(datum.u.i);
return sectionType;
}
@@ -205,8 +205,8 @@ FileDeclaration::~FileDeclaration() {
#pragma region SubfileDeclaration
SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
// ENSURE THIS DECLARATION IS NOT EMPTY.
- SubfileDeclaration::SectionType sectionType = getSectionType(chunk);
- if (SubfileDeclaration::SectionType::EMPTY == sectionType) {
+ SubfileDeclarationSectionType sectionType = getSectionType(chunk);
+ if (kSubfileDeclarationEmptySection == sectionType) {
_isLast = true;
return;
} else {
@@ -216,16 +216,16 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
// READ THE ASSET ID.
sectionType = getSectionType(chunk);
- if (SubfileDeclaration::SectionType::ASSET_ID == sectionType) {
- _assetId = Datum(chunk, DatumType::UINT16_1).u.i;
+ if (kSubfileDeclarationAssetId == sectionType) {
+ _assetId = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
error("SubfileDeclaration(): Expected section type ASSET_ID, got 0x%x", sectionType);
}
// READ THE FILE ID.
sectionType = getSectionType(chunk);
- if (SubfileDeclaration::SectionType::FILE_ID == sectionType) {
- _fileId = Datum(chunk, DatumType::UINT16_1).u.i;
+ if (kSubfileDeclarationFileId == sectionType) {
+ _fileId = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
error("SubfileDeclaration(): Expected section type FILE_ID, got 0x%x", sectionType);
}
@@ -233,16 +233,16 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
// READ THE START OFFSET IN THE GIVEN FILE.
// This is from the absolute start of the given file.
sectionType = getSectionType(chunk);
- if (SubfileDeclaration::SectionType::START_OFFSET == sectionType) {
- _startOffsetInFile = Datum(chunk, DatumType::UINT32_1).u.i;
+ if (kSubfileDeclarationStartOffset == sectionType) {
+ _startOffsetInFile = Datum(chunk, kDatumTypeUint32_1).u.i;
} else {
error("SubfileDeclaration(): Expected section type START_OFFSET, got 0x%x", sectionType);
}
}
-SubfileDeclaration::SectionType SubfileDeclaration::getSectionType(Chunk &chunk) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
- SubfileDeclaration::SectionType sectionType = static_cast<SubfileDeclaration::SectionType>(datum.u.i);
+SubfileDeclarationSectionType SubfileDeclaration::getSectionType(Chunk &chunk) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
+ SubfileDeclarationSectionType sectionType = static_cast<SubfileDeclarationSectionType>(datum.u.i);
return sectionType;
}
#pragma endregion
@@ -250,10 +250,10 @@ SubfileDeclaration::SectionType SubfileDeclaration::getSectionType(Chunk &chunk)
#pragma region CursorDeclaration
CursorDeclaration::CursorDeclaration(Chunk& chunk) {
// READ THE CURSOR RESOURCE.
- uint16 unk1 = Datum(chunk, DatumType::UINT16_1).u.i; // Always 0x0001
- _id = Datum(chunk, DatumType::UINT16_1).u.i;
- _unk = Datum(chunk, DatumType::UINT16_1).u.i;
- _name = Datum(chunk, DatumType::FILENAME).u.string;
+ uint16 unk1 = Datum(chunk, kDatumTypeUint16_1).u.i; // Always 0x0001
+ _id = Datum(chunk, kDatumTypeUint16_1).u.i;
+ _unk = Datum(chunk, kDatumTypeUint16_1).u.i;
+ _name = Datum(chunk, kDatumTypeFilename).u.string;
debugC(5, kDebugLoading, " - CursorDeclaration(): unk1 = 0x%x, id = 0x%x, unk = 0x%x, name = %s", unk1, _id, _unk, _name->c_str());
}
@@ -278,44 +278,44 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
subfile = Subfile(_stream);
Chunk chunk = subfile.nextChunk();
- uint32 beforeSectionTypeUnk = Datum(chunk, DatumType::UINT16_1).u.i; // Usually 0x0001
+ uint32 beforeSectionTypeUnk = Datum(chunk, kDatumTypeUint16_1).u.i; // Usually 0x0001
debugC(5, kDebugLoading, "Boot::Boot(): unk1 = 0x%x", beforeSectionTypeUnk);
- Boot::SectionType sectionType = getSectionType(chunk);
- bool notLastSection = (Boot::SectionType::LAST != sectionType);
+ BootSectionType sectionType = getSectionType(chunk);
+ bool notLastSection = (kBootLastSection != sectionType);
while (notLastSection) {
debugC(5, kDebugLoading, "Boot::Boot(): sectionType = 0x%x", sectionType);
switch (sectionType) {
- case Boot::SectionType::VERSION_INFORMATION: {
- _gameTitle = Datum(chunk, DatumType::STRING).u.string;
+ case kBootVersionInformation: {
+ _gameTitle = Datum(chunk, kDatumTypeString).u.string;
debugC(5, kDebugLoading, " - gameTitle = %s", _gameTitle->c_str());
uint32 unk = chunk.readUint16LE();
debugC(5, kDebugLoading, " - unk = 0x%x", unk);
_versionInfo = new VersionInfo(chunk);
debugC(5, kDebugLoading, " - versionInfo = %d.%d.%d (%s)", _versionInfo->majorVersion, _versionInfo->minorVersion, _versionInfo->revision, _versionInfo->string->c_str());
- _sourceString = Datum(chunk, DatumType::STRING).u.string;
+ _sourceString = Datum(chunk, kDatumTypeString).u.string;
debugC(5, kDebugLoading, " - sourceString = %s", _sourceString->c_str());
break;
}
- case Boot::SectionType::UNK1:
- case Boot::SectionType::UNK2:
- case Boot::SectionType::UNK3: {
+ case kBootUnk1:
+ case kBootUnk2:
+ case kBootUnk3: {
uint32 unk = Datum(chunk).u.i;
debugC(5, kDebugLoading, " - unk = 0x%x", unk);
break;
}
- case Boot::SectionType::UNK4: {
+ case kBootUnk4: {
double unk = Datum(chunk).u.f;
debugC(5, kDebugLoading, " - unk = %f", unk);
break;
}
- case Boot::SectionType::ENGINE_RESOURCE: {
- Common::String *resourceName = Datum(chunk, DatumType::STRING).u.string;
+ case kBootEngineResource: {
+ Common::String *resourceName = Datum(chunk, kDatumTypeString).u.string;
sectionType = getSectionType(chunk);
- if (sectionType == Boot::SectionType::ENGINE_RESOURCE_ID) {
+ if (sectionType == kBootEngineResourceId) {
int resourceId = Datum(chunk).u.i;
EngineResourceDeclaration *resourceDeclaration = new EngineResourceDeclaration(resourceName, resourceId);
_engineResourceDeclarations.setVal(resourceId, resourceDeclaration);
@@ -325,7 +325,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
break;
}
- case Boot::SectionType::CONTEXT_DECLARATION: {
+ case kBootContextDeclaration: {
ContextDeclaration *contextDeclaration = new ContextDeclaration(chunk);
while (!contextDeclaration->isLast) {
_contextDeclarations.setVal(contextDeclaration->fileNumber, contextDeclaration);
@@ -334,7 +334,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
break;
}
- case Boot::SectionType::UNKNOWN_DECLARATION: {
+ case kBootUnknownDeclaration: {
UnknownDeclaration *unknownDeclaration = new UnknownDeclaration(chunk);
while (!unknownDeclaration->_isLast) {
_unknownDeclarations.push_back(unknownDeclaration);
@@ -343,7 +343,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
break;
}
- case Boot::SectionType::FILE_DECLARATION: {
+ case kBootFileDeclaration: {
FileDeclaration *fileDeclaration = new FileDeclaration(chunk);
while (!fileDeclaration->_isLast) {
_fileDeclarations.setVal(fileDeclaration->_id, fileDeclaration);
@@ -352,7 +352,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
break;
}
- case Boot::SectionType::SUBFILE_DECLARATION: {
+ case kBootSubfileDeclaration: {
SubfileDeclaration *subfileDeclaration = new SubfileDeclaration(chunk);
while (!subfileDeclaration->_isLast) {
_subfileDeclarations.setVal(subfileDeclaration->_assetId, subfileDeclaration);
@@ -361,38 +361,38 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
break;
}
- case Boot::SectionType::CURSOR_DECLARATION: {
+ case kBootCursorDeclaration: {
CursorDeclaration *cursorDeclaration = new CursorDeclaration(chunk);
_cursorDeclarations.setVal(cursorDeclaration->_id, cursorDeclaration);
break;
}
- case Boot::SectionType::EMPTY: {
+ case kBootEmptySection: {
// This semems to separate the cursor declarations from whatever comes
// after it (what I formerly called the "footer"), but it has no data
// itself.
break;
}
- case Boot::SectionType::ENTRY_SCREEN: {
+ case kBootEntryScreen: {
_entryContextId = Datum(chunk).u.i;
debugC(5, kDebugLoading, " - _entryContextId = %d", _entryContextId);
break;
}
- case Boot::SectionType::ALLOW_MULTIPLE_SOUNDS: {
+ case kBootAllowMultipleSounds: {
_allowMultipleSounds = (Datum(chunk).u.i == 1);
debugC(5, kDebugLoading, " - _allowMultipleSounds = %d", _allowMultipleSounds);
break;
}
- case Boot::SectionType::ALLOW_MULTIPLE_STREAMS: {
+ case kBootAllowMultipleStreams: {
_allowMultipleStreams = (Datum(chunk).u.i == 1);
debugC(5, kDebugLoading, " - _allowMultipleStreams = %d", _allowMultipleStreams);
break;
}
- case Boot::SectionType::UNK5: {
+ case kBootUnk5: {
uint32 unk1 = Datum(chunk).u.i;
uint32 unk2 = Datum(chunk).u.i;
debugC(5, kDebugLoading, " - unk1 = 0x%x, unk2 = 0x%x", unk1, unk2);
@@ -406,13 +406,13 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
}
sectionType = getSectionType(chunk);
- notLastSection = Boot::SectionType::LAST != sectionType;
+ notLastSection = kBootLastSection != sectionType;
}
}
-Boot::SectionType Boot::getSectionType(Chunk& chunk) {
- Datum datum = Datum(chunk, DatumType::UINT16_1);
- Boot::SectionType sectionType = static_cast<Boot::SectionType>(datum.u.i);
+BootSectionType Boot::getSectionType(Chunk& chunk) {
+ Datum datum = Datum(chunk, kDatumTypeUint16_1);
+ BootSectionType sectionType = static_cast<BootSectionType>(datum.u.i);
return sectionType;
}
diff --git a/engines/mediastation/boot.h b/engines/mediastation/boot.h
index fc95d59ffe1..6aee0cfa435 100644
--- a/engines/mediastation/boot.h
+++ b/engines/mediastation/boot.h
@@ -48,17 +48,17 @@ public:
Common::String *string;
};
+enum ContextDeclarationSectionType {
+ kContextDeclarationEmptySection = 0x0000,
+ kContextDeclarationPlaceholder = 0x0003,
+ kContextDeclarationFileNumber1 = 0x0004,
+ kContextDeclarationFileNumber2 = 0x0005,
+ kContextDeclarationFileReference = 0x0006,
+ kContextDeclarationName = 0x0bb8
+};
+
class ContextDeclaration {
public:
- enum class SectionType {
- EMPTY = 0x0000,
- PLACEHOLDER = 0x0003,
- FILE_NUMBER_1 = 0x0004,
- FILE_NUMBER_2 = 0x0005,
- FILE_REFERENCE = 0x0006,
- CONTEXT_NAME = 0x0bb8
- };
-
ContextDeclaration(Chunk &chunk);
~ContextDeclaration();
@@ -69,17 +69,17 @@ public:
bool isLast;
private:
- ContextDeclaration::SectionType getSectionType(Chunk &chunk);
+ ContextDeclarationSectionType getSectionType(Chunk &chunk);
+};
+
+enum UnknownDeclarationSectionType {
+ kUnknownDeclarationEmptySection = 0x0000,
+ kUnknownDeclarationUnk1 = 0x0009,
+ kUnknownDeclarationUnk2 = 0x0004
};
class UnknownDeclaration {
public:
- enum class SectionType {
- EMPTY = 0x0000,
- UNK_1 = 0x0009,
- UNK_2 = 0x0004
- };
-
uint16 _unk;
// Signal that there are no more declarations to read.
bool _isLast;
@@ -87,51 +87,51 @@ public:
UnknownDeclaration(Chunk &chunk);
private:
- UnknownDeclaration::SectionType getSectionType(Chunk& chunk);
+ UnknownDeclarationSectionType getSectionType(Chunk& chunk);
+};
+
+enum FileDeclarationSectionType {
+ kFileDeclarationEmptySection = 0x0000,
+ kFileDeclarationFileId = 0x002b,
+ kFileDeclarationFileNameAndType = 0x002d
+};
+
+// Indicates where a file is intended to be stored.
+// NOTE: This might not be correct and this might be a more general "file type".
+enum IntendedFileLocation {
+ // Usually all files that have numbers remain on the CD-ROM.
+ kFileIntendedOnCdRom = 0x0007,
+ // These UNKs only appear in George Shrinks.
+ kFileIntendedForUnk1 = 0x0008,
+ kFileIntendedForUnk2 = 0x0009,
+ // Usually only INSTALL.CXT is copied to the hard disk.
+ kFileIntendedOnHardDisk = 0x000b
};
class FileDeclaration {
public:
- enum class SectionType {
- EMPTY = 0x0000,
- FILE_ID = 0x002b,
- FILE_NAME_AND_TYPE = 0x002d
- };
-
- // Indicates where this file is intended to be stored.
- // NOTE: This might not be correct and this might be a more general "file type".
- enum class IntendedLocation {
- // Usually all files that have numbers remain on the CD-ROM.
- CD_ROM = 0x0007,
- // These UNKs only appear in George Shrinks.
- UNK1 = 0x0008,
- UNK2 = 0x0009,
- // Usually only INSTALL.CXT is copied to the hard disk.
- HARD_DISK = 0x000b
- };
-
FileDeclaration(Chunk &chunk);
~FileDeclaration();
uint32 _id;
- IntendedLocation _intendedLocation;
+ IntendedFileLocation _intendedLocation;
Common::String *_name;
// Signal that there are no more declarations to read.
bool _isLast;
private:
- FileDeclaration::SectionType getSectionType(Chunk &chunk);
+ FileDeclarationSectionType getSectionType(Chunk &chunk);
+};
+
+enum SubfileDeclarationSectionType {
+ kSubfileDeclarationEmptySection = 0x0000,
+ kSubfileDeclarationAssetId = 0x002a,
+ kSubfileDeclarationFileId = 0x002b,
+ kSubfileDeclarationStartOffset = 0x002c
};
class SubfileDeclaration {
public:
- enum class SectionType {
- EMPTY = 0x0000,
- ASSET_ID = 0x002a,
- FILE_ID = 0x002b,
- START_OFFSET = 0x002c
- };
-
SubfileDeclaration(Chunk &chunk);
uint16 _assetId;
@@ -141,7 +141,7 @@ public:
bool _isLast;
private:
- SubfileDeclaration::SectionType getSectionType(Chunk &chunk);
+ SubfileDeclarationSectionType getSectionType(Chunk &chunk);
};
// Declares a cursor, which is stored as a cursor resource in the game executable.
@@ -164,32 +164,32 @@ public:
~EngineResourceDeclaration();
};
+enum BootSectionType {
+ kBootLastSection = 0x0000,
+ kBootEmptySection = 0x002e,
+ kBootContextDeclaration = 0x0002,
+ kBootVersionInformation = 0x0190,
+ kBootUnk1 = 0x0191,
+ kBootUnk2 = 0x0192,
+ kBootUnk3 = 0x0193,
+ kBootEngineResource = 0x0bba,
+ kBootEngineResourceId = 0x0bbb,
+ kBootUnknownDeclaration = 0x0007,
+ kBootFileDeclaration = 0x000a,
+ kBootSubfileDeclaration = 0x000b,
+ kBootUnk5 = 0x000c,
+ kBootCursorDeclaration = 0x0015,
+ kBootEntryScreen = 0x002f,
+ kBootAllowMultipleSounds = 0x0035,
+ kBootAllowMultipleStreams = 0x0036,
+ kBootUnk4 = 0x057b
+};
+
class Boot : Datafile {
private:
- enum class SectionType {
- LAST = 0x0000,
- EMPTY = 0x002e,
- CONTEXT_DECLARATION = 0x0002,
- VERSION_INFORMATION = 0x0190,
- UNK1 = 0x0191,
- UNK2 = 0x0192,
- UNK3 = 0x0193,
- ENGINE_RESOURCE = 0x0bba,
- ENGINE_RESOURCE_ID = 0x0bbb,
- UNKNOWN_DECLARATION = 0x0007,
- FILE_DECLARATION = 0x000a,
- SUBFILE_DECLARATION = 0x000b,
- UNK5 = 0x000c,
- CURSOR_DECLARATION = 0x0015,
- ENTRY_SCREEN = 0x002f,
- ALLOW_MULTIPLE_SOUNDS = 0x0035,
- ALLOW_MULTIPLE_STREAMS = 0x0036,
- UNK4 = 0x057b
- };
-
Subfile subfile;
- Boot::SectionType getSectionType(Chunk &chunk);
+ BootSectionType getSectionType(Chunk &chunk);
public:
Common::String *_gameTitle = nullptr;
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index 66474b20d8d..c20ef795541 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -107,7 +107,7 @@ void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
while (moreSectionsToRead) {
// VERIFY THIS CHUNK IS A HEADER.
// TODO: What are the situations when it's not?
- uint16 sectionType = Datum(chunk, DatumType::UINT16_1).u.i;
+ uint16 sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
debugC(5, kDebugLoading, "Context::readNewStyleHeaderSections(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
bool chunkIsHeader = (sectionType == 0x000d);
if (!chunkIsHeader) {
@@ -154,10 +154,10 @@ void Context::readAssetFromLaterSubfile(Subfile &subfile) {
}
bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
- uint16 sectionType = Datum(chunk, DatumType::UINT16_1).u.i;
+ uint16 sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
debugC(5, kDebugLoading, "Context::readHeaderSection(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
- switch ((SectionType)sectionType) {
- case SectionType::PARAMETERS: {
+ switch (sectionType) {
+ case kContextParametersSection: {
if (_parameters != nullptr) {
error("Context::readHeaderSection(): Got multiple parameters (@0x%llx)", static_cast<long long int>(chunk.pos()));
}
@@ -165,12 +165,12 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
break;
}
- case SectionType::ASSET_LINK: {
+ case kContextAssetLinkSection: {
warning("Context::readHeaderSection(): ASSET_LINK not implemented yet");
break;
}
- case SectionType::PALETTE: {
+ case kContextPaletteSection: {
if (_palette != nullptr) {
error("Context::readHeaderSection(): Got multiple palettes (@0x%llx)", static_cast<long long int>(chunk.pos()));
}
@@ -183,51 +183,51 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
delete[] buffer;
debugC(5, kDebugLoading, "Context::readHeaderSection(): Read palette");
// This is likely just an ending flag that we expect to be zero.
- Datum(chunk, DatumType::UINT16_1).u.i;
+ Datum(chunk, kDatumTypeUint16_1).u.i;
break;
}
- case SectionType::ASSET_HEADER: {
+ case kContextAssetHeaderSection: {
Asset *asset = nullptr;
AssetHeader *header = new AssetHeader(chunk);
switch (header->_type) {
- case AssetType::IMAGE:
+ case kAssetTypeImage:
asset = new Image(header);
break;
- case AssetType::MOVIE:
+ case kAssetTypeMovie:
asset = new Movie(header);
break;
- case AssetType::SOUND:
+ case kAssetTypeSound:
asset = new Sound(header);
break;
- case AssetType::PALETTE:
+ case kAssetTypePalette:
asset = new Palette(header);
break;
- case AssetType::PATH:
+ case kAssetTypePath:
asset = new Path(header);
break;
- case AssetType::TIMER:
+ case kAssetTypeTimer:
asset = new Timer(header);
break;
- case AssetType::HOTSPOT:
+ case kAssetTypeHotspot:
asset = new Hotspot(header);
break;
- case AssetType::SPRITE:
+ case kAssetTypeSprite:
asset = new Sprite(header);
break;
- case AssetType::CANVAS:
+ case kAssetTypeCanvas:
asset = new Canvas(header);
break;
- case AssetType::SCREEN:
+ case kAssetTypeScreen:
if (_screenAsset != nullptr) {
error("Context::readHeaderSection(): Got multiple screen assets in the same context");
}
@@ -258,7 +258,7 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
break;
}
- case SectionType::FUNCTION: {
+ case kContextFunctionSection: {
Function *function = new Function(chunk);
g_engine->_functions.setVal(function->_id, function);
if (!g_engine->isFirstGenerationEngine()) {
@@ -267,17 +267,17 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
break;
}
- case SectionType::END: {
+ case kContextEndSection: {
error("Context::readHeaderSection(): END Not implemented yet");
return false;
}
- case SectionType::EMPTY: {
+ case kContextEmptySection: {
error("Context::readHeaderSection(): EMPTY Not implemented yet");
break;
}
- case SectionType::POOH: {
+ case kContextPoohSection: {
error("Context::readHeaderSection(): POOH Not implemented yet");
break;
}
@@ -297,7 +297,7 @@ void Context::play() {
if (_screenAsset == nullptr) {
error("Context::play(): No entry script exists for this context, cannot play it");
}
- //EventHandler *entryHandler = nullptr; //_screenAsset->_eventHandlers.getVal(uint32(EventHandler::Type::Entry));
+ //EventHandler *entryHandler = nullptr; //_screenAsset->_eventHandlers.getVal(uint32(EventType::Entry));
// So how can we actually execute this script?
// FIND AND EXECUTE THE EXIT SCRIPT.
diff --git a/engines/mediastation/context.h b/engines/mediastation/context.h
index 4e67c92205f..bf8500acc38 100644
--- a/engines/mediastation/context.h
+++ b/engines/mediastation/context.h
@@ -29,6 +29,18 @@
namespace MediaStation {
+enum ContextSectionType {
+ kContextEmptySection = 0x0000,
+ kContextOldStyleSection = 0x000d,
+ kContextParametersSection = 0x000e,
+ kContextPaletteSection = 0x05aa,
+ kContextEndSection = 0x0010,
+ kContextAssetHeaderSection = 0x0011,
+ kContextPoohSection = 0x057a,
+ kContextAssetLinkSection = 0x0013,
+ kContextFunctionSection = 0x0031
+};
+
class Context : Datafile {
public:
Context(const Common::Path &path);
@@ -44,17 +56,6 @@ public:
AssetHeader *_screenAsset = nullptr;
private:
- enum class SectionType {
- EMPTY = 0x0000,
- OLD_STYLE = 0x000d,
- PARAMETERS = 0x000e,
- PALETTE = 0x05aa,
- END = 0x0010,
- ASSET_HEADER = 0x0011,
- POOH = 0x057a,
- ASSET_LINK = 0x0013,
- FUNCTION = 0x0031
- };
void readOldStyleHeaderSections(Subfile &subfile, Chunk &chunk);
void readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk);
bool readHeaderSection(Subfile &subfile, Chunk &chunk);
diff --git a/engines/mediastation/contextparameters.cpp b/engines/mediastation/contextparameters.cpp
index 1b498882904..904641d38df 100644
--- a/engines/mediastation/contextparameters.cpp
+++ b/engines/mediastation/contextparameters.cpp
@@ -28,29 +28,29 @@
namespace MediaStation {
ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
- fileNumber = Datum(chunk, DatumType::UINT16_1).u.i;
- uint sectionType = Datum(chunk, DatumType::UINT16_1).u.i;
- while ((SectionType)sectionType != SectionType::EMPTY) {
+ fileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
+ uint sectionType = static_cast<ContextParametersSectionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
+ while (sectionType != kContextParametersEmptySection) {
debugC(5, kDebugLoading, "ContextParameters::ContextParameters: sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
- switch ((SectionType)sectionType) {
- case SectionType::NAME: {
- uint repeatedFileNumber = Datum(chunk, DatumType::UINT16_1).u.i;
+ switch (sectionType) {
+ case kContextParametersName: {
+ uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
if (repeatedFileNumber != fileNumber) {
warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, fileNumber);
}
- contextName = Datum(chunk, DatumType::STRING).u.string;
+ contextName = Datum(chunk, kDatumTypeString).u.string;
// TODO: This is likely just an end flag.
- /*uint unk1 =*/ Datum(chunk, DatumType::UINT16_1).u.i;
+ /*uint unk1 =*/ Datum(chunk, kDatumTypeUint16_1).u.i;
break;
}
- case SectionType::FILE_NUMBER: {
+ case kContextParametersFileNumber: {
error("ContextParameters::ContextParameters(): Section type FILE_NUMBER not implemented yet");
break;
}
- case SectionType::VARIABLE: {
- uint repeatedFileNumber = Datum(chunk, DatumType::UINT16_1).u.i;
+ case kContextParametersVariable: {
+ uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
if (repeatedFileNumber != fileNumber) {
warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, fileNumber);
}
@@ -67,7 +67,7 @@ ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
break;
}
- case SectionType::BYTECODE: {
+ case kContextParametersBytecode: {
Function *function = new Function(chunk);
_functions.setVal(function->_id, function);
break;
@@ -77,7 +77,7 @@ ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
error("ContextParameters::ContextParameters(): Unknown section type 0x%x", sectionType);
}
}
- sectionType = Datum(chunk, DatumType::UINT16_1).u.i;
+ sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
}
}
diff --git a/engines/mediastation/contextparameters.h b/engines/mediastation/contextparameters.h
index ff4114bfbb0..127a4d663ab 100644
--- a/engines/mediastation/contextparameters.h
+++ b/engines/mediastation/contextparameters.h
@@ -28,16 +28,15 @@
namespace MediaStation {
-class ContextParameters {
-private:
- enum class SectionType {
- EMPTY = 0x0000,
- VARIABLE = 0x0014,
- NAME = 0x0bb9,
- FILE_NUMBER = 0x0011,
- BYTECODE = 0x0017
- };
+enum ContextParametersSectionType {
+ kContextParametersEmptySection = 0x0000,
+ kContextParametersVariable = 0x0014,
+ kContextParametersName = 0x0bb9,
+ kContextParametersFileNumber = 0x0011,
+ kContextParametersBytecode = 0x0017
+};
+class ContextParameters {
public:
ContextParameters(Chunk &chunk);
~ContextParameters();
diff --git a/engines/mediastation/datum.cpp b/engines/mediastation/datum.cpp
index ee560656359..bdcca95cfa5 100644
--- a/engines/mediastation/datum.cpp
+++ b/engines/mediastation/datum.cpp
@@ -27,7 +27,7 @@
namespace MediaStation {
Datum::Datum() {
- t = DatumType::INVALID;
+ t = kDatumTypeInvalid;
u.i = 0;
}
@@ -46,54 +46,54 @@ Datum::Datum(Common::SeekableReadStream &chunk, DatumType expectedType) {
void Datum::readWithType(Common::SeekableReadStream &chunk) {
debugC(9, kDebugLoading, "Datum::Datum(): Type 0x%x (@0x%llx)", t, static_cast<long long int>(chunk.pos()));
- if (DatumType::UINT8 == t) {
+ if (kDatumTypeUint8 == t) {
u.i = chunk.readByte();
- } else if (DatumType::UINT16_1 == t || DatumType::UINT16_2 == t) {
+ } else if (kDatumTypeUint16_1 == t || kDatumTypeUint16_2 == t) {
u.i = chunk.readUint16LE();
- } else if (DatumType::INT16_1 == t || DatumType::INT16_2 == t) {
+ } else if (kDatumTypeInt16_1 == t || kDatumTypeInt16_2 == t) {
u.i = chunk.readSint16LE();
- } else if (DatumType::UINT32_1 == t || DatumType::UINT32_2 == t) {
+ } else if (kDatumTypeUint32_1 == t || kDatumTypeUint32_2 == t) {
u.i = chunk.readUint32LE();
- } else if (DatumType::FLOAT64_1 == t || DatumType::FLOAT64_2 == t) {
+ } else if (kDatumTypeFloat64_1 == t || kDatumTypeFloat64_2 == t) {
u.f = chunk.readDoubleLE();
- } else if (DatumType::STRING == t || DatumType::FILENAME == t) {
+ } else if (kDatumTypeString == t || kDatumTypeFilename == t) {
// TODO: This copies the string. Can we read it directly from the chunk?
- int size = Datum(chunk, DatumType::UINT32_1).u.i;
+ int size = Datum(chunk, kDatumTypeUint32_1).u.i;
char *buffer = new char[size + 1];
chunk.read(buffer, size);
buffer[size] = '\0';
u.string = new Common::String(buffer);
delete[] buffer;
- } else if (DatumType::POINT_1 == t || DatumType::POINT_2 == t) {
- uint16 x = Datum(chunk, DatumType::INT16_2).u.i;
- uint16 y = Datum(chunk, DatumType::INT16_2).u.i;
+ } else if (kDatumTypePoint1 == t || kDatumTypePoint2 == t) {
+ uint16 x = Datum(chunk, kDatumTypeInt16_2).u.i;
+ uint16 y = Datum(chunk, kDatumTypeInt16_2).u.i;
u.point = new Common::Point(x, y);
- } else if (DatumType::BOUNDING_BOX == t) {
- Common::Point *left_top = Datum(chunk, DatumType::POINT_2).u.point;
- Common::Point *dimensions = Datum(chunk, DatumType::POINT_1).u.point;
+ } else if (kDatumTypeBoundingBox == t) {
+ Common::Point *left_top = Datum(chunk, kDatumTypePoint2).u.point;
+ Common::Point *dimensions = Datum(chunk, kDatumTypePoint1).u.point;
u.bbox = new Common::Rect(*left_top, dimensions->x, dimensions->y);
delete left_top;
delete dimensions;
- } else if (DatumType::POLYGON == t) {
- uint16 total_points = Datum(chunk, DatumType::UINT16_1).u.i;
+ } else if (kDatumTypePolygon == t) {
+ uint16 total_points = Datum(chunk, kDatumTypeUint16_1).u.i;
for (int i = 0; i < total_points; i++) {
- Common::Point *point = Datum(chunk, DatumType::POINT_1).u.point;
+ Common::Point *point = Datum(chunk, kDatumTypePoint1).u.point;
u.polygon->push_back(point);
}
- } else if (DatumType::PALETTE == t) {
+ } else if (kDatumTypePalette == t) {
u.palette = new unsigned char[0x300];
chunk.read(u.palette, 0x300);
- } else if (DatumType::REFERENCE == t) {
+ } else if (kDatumTypeReference == t) {
u.chunkRef = chunk.readUint32BE();
} else {
diff --git a/engines/mediastation/datum.h b/engines/mediastation/datum.h
index 2336bd06c9f..f0d6326c56f 100644
--- a/engines/mediastation/datum.h
+++ b/engines/mediastation/datum.h
@@ -29,39 +29,39 @@
namespace MediaStation {
-enum class DatumType {
- // The INVALID type isn't a type we see in data files; it is just a
+class Point;
+class BoundingBox;
+class Polygon;
+class Reference;
+
+enum DatumType {
+ // This type isn't a type we see in data files; it is just a
// default initialization value.
- INVALID = 0x0000,
+ kDatumTypeInvalid = 0x0000,
- UINT8 = 0x0002,
+ kDatumTypeUint8 = 0x0002,
// TODO: Understand why there are different (u)int16 type codes.
- UINT16_1 = 0x0003,
- UINT16_2 = 0x0013,
- INT16_1 = 0x0006,
- INT16_2 = 0x0010,
+ kDatumTypeUint16_1 = 0x0003,
+ kDatumTypeUint16_2 = 0x0013,
+ kDatumTypeInt16_1 = 0x0006,
+ kDatumTypeInt16_2 = 0x0010,
// TODO: Understand why there are two different uint32 type codes.
- UINT32_1 = 0x0004,
- UINT32_2 = 0x0007,
+ kDatumTypeUint32_1 = 0x0004,
+ kDatumTypeUint32_2 = 0x0007,
// TODO: Understand why there are two different float64 type codes.
- FLOAT64_1 = 0x0011,
- FLOAT64_2 = 0x0009,
- STRING = 0x0012,
- FILENAME = 0x000a,
- POINT_1 = 0x000f,
- POINT_2 = 0x000e,
- BOUNDING_BOX = 0x000d,
- POLYGON = 0x001d,
+ kDatumTypeFloat64_1 = 0x0011,
+ kDatumTypeFloat64_2 = 0x0009,
+ kDatumTypeString = 0x0012,
+ kDatumTypeFilename = 0x000a,
+ kDatumTypePoint1 = 0x000f,
+ kDatumTypePoint2 = 0x000e,
+ kDatumTypeBoundingBox = 0x000d,
+ kDatumTypePolygon = 0x001d,
// These are other types.
- PALETTE = 0x05aa,
- REFERENCE = 0x001b
+ kDatumTypePalette = 0x05aa,
+ kDatumTypeReference = 0x001b
};
-class Point;
-class BoundingBox;
-class Polygon;
-class Reference;
-
// It is the caller's responsibility to delete any heap items
// that are created as part of a datum. The datum is really
// just a container.
diff --git a/engines/mediastation/mediascript/builtins.h b/engines/mediastation/mediascript/builtins.h
index cf7afedcb64..40ad73880ec 100644
--- a/engines/mediastation/mediascript/builtins.h
+++ b/engines/mediastation/mediascript/builtins.h
@@ -24,94 +24,94 @@
namespace MediaStation {
-enum class BuiltInFunction {
+enum BuiltInFunction {
// TODO: Figure out if effectTransitionOnSync = 13 is consistent across titles?
- effectTransition = 12, // PARAMS: 1
- drawing = 37, // PARAMS: 5
+ kEffectTransitionFunction = 12, // PARAMS: 1
+ kDrawingFunction = 37, // PARAMS: 5
// TODO: Figure out if TimeOfDay = 101 is consistent across titles.
- DebugPrint = 180, // PARAMS: 1+
+ kDebugPrintFunction = 180, // PARAMS: 1+
// TODO: Figure out code for DebugPrint.
// TODO: Figure out code for Quit.
};
-enum class BuiltInMethod {
+enum BuiltInMethod {
// TODO: What object types does CursorSet apply to?
// Currently it's only in var_7be1_cursor_currentTool in
// IBM/Crayola.
- cursorSet = 200, // PARAMS: 0
- spatialHide = 203, // PARAMS: 1
- spatialMoveTo = 204, // PARAMS: 2
- spatialZMoveTo = 216, // PARAMS: 1
- spatialShow = 202, // PARAMS: 1
- timePlay = 206, // PARAMS: 1
- timeStop = 207, // PARAMS: 0
- isPlaying = 372, // PARAMS: 0
- setDissolveFactor = 241, // PARAMS: 1
+ kCursorSetMethod = 200, // PARAMS: 0
+ kSpatialHideMethod = 203, // PARAMS: 1
+ kSpatialMoveToMethod = 204, // PARAMS: 2
+ kSpatialZMoveToMethod = 216, // PARAMS: 1
+ kSpatialShowMethod = 202, // PARAMS: 1
+ kTimePlayMethod = 206, // PARAMS: 1
+ kTimeStopMethod = 207, // PARAMS: 0
+ kIsPlayingMethod = 372, // PARAMS: 0
+ kSetDissolveFactorMethod = 241, // PARAMS: 1
// HOTSPOT METHODS.
- mouseActivate = 210, // PARAMS: 1
- mouseDeactivate = 211, // PARAMS: 0
- xPosition = 233, // PARAMS: 0
- yPosiion = 234, // PARAMS: 0
- TriggerAbsXPosition = 321, // PARAMS: 0
- TriggerAbsYPosition = 322, // PARAMS: 0
- isActive = 371, // PARAMS: 0
+ kMouseActivateMethod = 210, // PARAMS: 1
+ kMouseDeactivateMethod = 211, // PARAMS: 0
+ kXPositionMethod = 233, // PARAMS: 0
+ kYPositionMethod = 234, // PARAMS: 0
+ kTriggerAbsXPositionMethod = 321, // PARAMS: 0
+ kTriggerAbsYPositionMethod = 322, // PARAMS: 0
+ kIsActiveMethod = 371, // PARAMS: 0
// IMAGE METHODS.
- Width = 235, // PARAMS: 0
- Height = 236, // PARAMS: 0
- isVisible = 269,
+ kWidthMethod = 235, // PARAMS: 0
+ kHeightMethod = 236, // PARAMS: 0
+ kIsVisibleMethod = 269,
// SPRITE METHODS.
- movieReset = 219, // PARAMS: 0
+ kMovieResetMethod = 219, // PARAMS: 0
// STAGE METHODS.
- setWorldSpaceExtent = 363, // PARAMS: 2
- setBounds = 287, // PARAMS: 4
+ kSetWorldSpaceExtentMethod = 363, // PARAMS: 2
+ kSetBoundsMethod = 287, // PARAMS: 4
// CAMERA METHODS.
- stopPan = 350, // PARAMS: 0
- viewportMoveTo = 352, // PARAMS: 2
- yViewportPosition = 357, // PARAMS: 0
- panTo = 370, // PARAMS: 4
+ kStopPanMethod = 350, // PARAMS: 0
+ kViewportMoveToMethod = 352, // PARAMS: 2
+ kYViewportPositionMethod = 357, // PARAMS: 0
+ kPanToMethod = 370, // PARAMS: 4
// CANVAS METHODS.
- clearToPalette = 379, // PARAMS: 1
+ kClearToPaletteMethod = 379, // PARAMS: 1
// DOCUMENT METHODS.
- loadContext = 374, // PARAMS: 1
- releaseContext = 375, // PARAMS: 1
- branchToScreen = 201, // PARAMS: 1
- isLoaded = 376, // PARAMS: 1
+ kLoadContextMethod = 374, // PARAMS: 1
+ kReleaseContextMethod = 375, // PARAMS: 1
+ kBranchToScreenMethod = 201, // PARAMS: 1
+ kIsLoadedMethod = 376, // PARAMS: 1
// PATH METHODS.
- setDuration = 262, // PARAMS: 1
- percentComplete = 263,
+ kSetDurationMethod = 262, // PARAMS: 1
+ kPercentCompleteMethod = 263,
// TEXT METHODS.
- text = 290,
- setText = 291,
- setMaximumTextLength = 293, // PARAM: 1
+ kTextMethod = 290,
+ kSetTextMethod = 291,
+ kSetMaximumTextLengthMethod = 293, // PARAM: 1
// COLLECTION METHODS.
// These aren't assets but arrays used in Media Script.
- isEmpty = 254, // PARAMS: 0
- empty = 252, // PARAMS: 0
- append = 247, // PARAMS: 1+
- getAt = 253, // PARAMS: 1
- count = 249, // PARAMS: 0
+ kIsEmptyMethod = 254, // PARAMS: 0
+ kEmptyMethod = 252, // PARAMS: 0
+ kAppendMethod = 247, // PARAMS: 1+
+ kGetAtMethod = 253, // PARAMS: 1
+ kCountMethod = 249, // PARAMS: 0
// Looks like this lets you call a method on all the items in a collection.
// Examples look like : var_7be1_collect_shapes.send(spatialHide);
- send = 257, // PARAMS: 1+. Looks like the first param is the function,
- // and the next params are any arguments you want to send.
+ kSendMethod = 257, // PARAMS: 1+. Looks like the first param is the function,
// Seeking seems to be finding the index where a certain item is.
- seek = 256, // PARAMS: 1
- sort = 266, // PARAMS: 0
- deleteAt = 258, // PARAMS: 1
+ // and the next params are any arguments you want to send.
+ kSeekMethod = 256, // PARAMS: 1
+ kSortMethod = 266, // PARAMS: 0
+ kDeleteAtMethod = 258, // PARAMS: 1
// PRINTER METHODS.
- openLens = 346, // PARAMS: 0
- closeLens = 347, // PARAMS: 0
+ kOpenLensMethod = 346, // PARAMS: 0
+ kCloseLensMethod = 347, // PARAMS: 0
};
} // End of namespace MediaStation
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index ffed27f6815..1cf5c2b6e1b 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -31,7 +31,7 @@
namespace MediaStation {
CodeChunk::CodeChunk(Common::SeekableReadStream &chunk) : _args(nullptr) {
- uint lengthInBytes = Datum(chunk, DatumType::UINT32_1).u.i;
+ uint lengthInBytes = Datum(chunk, kDatumTypeUint32_1).u.i;
debugC(5, kDebugLoading, "CodeChunk::CodeChunk(): Length 0x%x (@0x%llx)", lengthInBytes, static_cast<long long int>(chunk.pos()));
_bytecode = chunk.readStream(lengthInBytes);
}
@@ -61,15 +61,15 @@ Operand CodeChunk::executeNextStatement() {
InstructionType instructionType = InstructionType(Datum(*_bytecode).u.i);
debugC(8, kDebugScript, " instructionType = %d", (uint)instructionType);
switch (instructionType) {
- case InstructionType::EMPTY: {
+ case kInstructionTypeEmpty: {
return Operand();
}
- case InstructionType::FUNCTION_CALL: {
+ case kInstructionTypeFunctionCall: {
Opcode opcode = Opcode(Datum(*_bytecode).u.i);
debugC(8, kDebugScript, " *** Opcode %d ***", (uint)opcode);
switch (opcode) {
- case Opcode::AssignVariable: {
+ case kOpcodeAssignVariable: {
uint32 id = Datum(*_bytecode).u.i;
VariableScope scope = VariableScope(Datum(*_bytecode).u.i);
Operand newValue = executeNextStatement();
@@ -79,7 +79,7 @@ Operand CodeChunk::executeNextStatement() {
return Operand();
}
- case Opcode::CallRoutine: {
+ case kOpcodeCallRoutine: {
uint functionId = Datum(*_bytecode).u.i;
uint32 parameterCount = Datum(*_bytecode).u.i;
Common::Array<Operand> args;
@@ -101,11 +101,11 @@ Operand CodeChunk::executeNextStatement() {
return returnValue;
}
- case Opcode::CallMethod: {
+ case kOpcodeCallMethod: {
uint32 methodId = Datum(*_bytecode).u.i;
uint32 parameterCount = Datum(*_bytecode).u.i;
Operand selfObject = executeNextStatement();
- if (selfObject.getType() != Operand::Type::AssetId) {
+ if (selfObject.getType() != kOperandTypeAssetId) {
error("CodeChunk::executeNextStatement(): (Opcode::CallMethod) Attempt to call method on operand that is not an asset (type 0x%x)", selfObject.getType());
}
Common::Array<Operand> args;
@@ -126,14 +126,14 @@ Operand CodeChunk::executeNextStatement() {
return returnValue;
}
- case Opcode::DeclareVariables: {
+ case kOpcodeDeclareVariables: {
uint32 localVariableCount = Datum(*_bytecode).u.i;
debugC(5, kDebugScript, " Declaring %d local variables", localVariableCount);
_locals.resize(localVariableCount);
return Operand();
}
- case Opcode::Subtract: {
+ case kOpcodeSubtract: {
Operand value1 = executeNextStatement();
Operand value2 = executeNextStatement();
@@ -148,28 +148,28 @@ Operand CodeChunk::executeNextStatement() {
break;
}
- case (InstructionType::OPERAND): {
- Operand::Type operandType = Operand::Type(Datum(*_bytecode).u.i);
+ case (kInstructionTypeOperand): {
+ OperandType operandType = OperandType(Datum(*_bytecode).u.i);
debugC(8, kDebugScript, " *** Operand %d ***", (uint)operandType);
Operand operand(operandType);
switch (operandType) {
// TODO: Add clearer debugging printouts for these.
- case Operand::Type::AssetId: {
+ case kOperandTypeAssetId: {
uint32 assetId = Datum(*_bytecode).u.i;
operand.putAsset(assetId);
return operand;
}
- case Operand::Type::Literal1:
- case Operand::Type::Literal2:
- case Operand::Type::DollarSignVariable: {
+ case kOperandTypeLiteral1:
+ case kOperandTypeLiteral2:
+ case kOperandTypeDollarSignVariable: {
int literal = Datum(*_bytecode).u.i;
operand.putInteger(literal);
return operand;
}
- case Operand::Type::Float1:
- case Operand::Type::Float2: {
+ case kOperandTypeFloat1:
+ case kOperandTypeFloat2: {
double d = Datum(*_bytecode).u.f;
operand.putDouble(d);
return operand;
@@ -182,7 +182,7 @@ Operand CodeChunk::executeNextStatement() {
break;
}
- case (InstructionType::VARIABLE_REF): {
+ case (kInstructionTypeVariableRef): {
// TODO: Add debug printout for this.
uint32 id = Datum(*_bytecode).u.i;
VariableScope scope = VariableScope(Datum(*_bytecode).u.i);
@@ -198,20 +198,20 @@ Operand CodeChunk::executeNextStatement() {
Operand CodeChunk::getVariable(uint32 id, VariableScope scope) {
switch (scope) {
- case VariableScope::Global: {
- Operand returnValue(Operand::Type::VariableDeclaration);
+ case kVariableScopeGlobal: {
+ Operand returnValue(kOperandTypeVariableDeclaration);
Variable *variable = g_engine->_variables.getVal(id);
returnValue.putVariable(variable);
return returnValue;
}
- case VariableScope::Local: {
+ case kVariableScopeLocal: {
uint index = id - 1;
return _locals.operator[](index);
break;
}
- case VariableScope::Parameter: {
+ case kVariableScopeParameter: {
uint32 index = id - 1;
if (_args == nullptr) {
error("CodeChunk::getVariable(): Requested a parameter in a code chunk that has no parameters.");
@@ -228,36 +228,36 @@ Operand CodeChunk::getVariable(uint32 id, VariableScope scope) {
void CodeChunk::putVariable(uint32 id, VariableScope scope, Operand value) {
switch (scope) {
- case VariableScope::Global: {
+ case kVariableScopeGlobal: {
Variable *variable = g_engine->_variables.getVal(id);
if (variable == nullptr) {
error("CodeChunk::putVariable(): Attempted to assign to a non-existent global variable %d", id);
}
switch (value.getType()) {
- case Operand::Type::Literal1:
- case Operand::Type::Literal2: {
+ case kOperandTypeLiteral1:
+ case kOperandTypeLiteral2: {
variable->value.i = value.getInteger();
break;
}
- case Operand::Type::Float1:
- case Operand::Type::Float2: {
+ case kOperandTypeFloat1:
+ case kOperandTypeFloat2: {
variable->value.d = value.getDouble();
break;
}
- case Operand::Type::String: {
+ case kOperandTypeString: {
variable->value.string = value.getString();
break;
}
- case Operand::Type::AssetId: {
+ case kOperandTypeAssetId: {
variable->value.assetId = value.getAssetId();
break;
}
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
// TODO: Will this cause a memory leak?
// variable = value.u.variable;
error("Assigning variable to another variable not supported yet");
@@ -271,13 +271,13 @@ void CodeChunk::putVariable(uint32 id, VariableScope scope, Operand value) {
break;
}
- case VariableScope::Local: {
+ case kVariableScopeLocal: {
uint index = id - 1;
_locals[index] = value;
break;
}
- case VariableScope::Parameter: {
+ case kVariableScopeParameter: {
error("CodeChunk::putVariable(): Attempted to assign to a parameter");
break;
}
@@ -290,7 +290,7 @@ void CodeChunk::putVariable(uint32 id, VariableScope scope, Operand value) {
Operand CodeChunk::callBuiltInFunction(uint32 id, Common::Array<Operand> &args) {
switch ((BuiltInFunction)id) {
- case BuiltInFunction::effectTransition: {
+ case kEffectTransitionFunction: {
switch (args.size()) {
// TODO: Discover and handle the different ways
// effectTransition can be called.
diff --git a/engines/mediastation/mediascript/codechunk.h b/engines/mediastation/mediascript/codechunk.h
index 43085433572..e5d29efd995 100644
--- a/engines/mediastation/mediascript/codechunk.h
+++ b/engines/mediastation/mediascript/codechunk.h
@@ -31,50 +31,50 @@
namespace MediaStation {
-enum class InstructionType {
- EMPTY = 0x0000,
- FUNCTION_CALL = 0x0067,
- OPERAND = 0x0066,
- VARIABLE_REF = 0x0065
+enum InstructionType {
+ kInstructionTypeEmpty = 0x0000,
+ kInstructionTypeFunctionCall = 0x0067,
+ kInstructionTypeOperand = 0x0066,
+ kInstructionTypeVariableRef = 0x0065
};
-enum class Opcode {
- IfElse = 202,
- AssignVariable = 203,
- Or = 204,
- And = 206,
- Equals = 207,
- NotEquals = 208,
- LessThan = 209,
- GreaterThan = 210,
- LessThanOrEqualTo = 211,
- GreaterThanOrEqualTo = 212,
- Add = 213,
- Subtract = 214,
- Multiply = 215,
- Divide = 216,
- Modulo = 217,
- Unk2 = 218, // TODO: Likely something with ## constants like ##DOWN?
- CallRoutine = 219,
+enum Opcode {
+ kOpcodeIfElse = 202,
+ kOpcodeAssignVariable = 203,
+ kOpcodeOr = 204,
+ kOpcodeAnd = 206,
+ kOpcodeEquals = 207,
+ kOpcodeNotEquals = 208,
+ kOpcodeLessThan = 209,
+ kOpcodeGreaterThan = 210,
+ kOpcodeLessThanOrEqualTo = 211,
+ kOpcodeGreaterThanOrEqualTo = 212,
+ kOpcodeAdd = 213,
+ kOpcodeSubtract = 214,
+ kOpcodeMultiply = 215,
+ kOpcodeDivide = 216,
+ kOpcodeModulo = 217,
+ kOpcodeUnk2 = 218, // TODO: Likely something with ## constants like ##DOWN?
+ kOpcodeCallRoutine = 219,
// Method calls are like routine calls, but they have an implicit "self"
// parameter that is always the first. For example:
// @self . mouseActivate ( TRUE ) ;
- CallMethod = 220,
+ kOpcodeCallMethod = 220,
// This seems to appear at the start of a function to declare the number of
// local variables used in the function. It seems to be the `Declare`
// keyword. In the observed examples, the number of variables to create is
// given, then the next instructions are variable assignments for that number
// of variables.
- DeclareVariables = 221,
- While = 224,
- Return = 222,
- Unk1 = 223
+ kOpcodeDeclareVariables = 221,
+ kOpcodeWhile = 224,
+ kOpcodeReturn = 222,
+ kOpcodeUnk1 = 223
};
-enum class VariableScope {
- Local = 1,
- Parameter = 2,
- Global = 4
+enum VariableScope {
+ kVariableScopeLocal = 1,
+ kVariableScopeParameter = 2,
+ kVariableScopeGlobal = 4
};
class CodeChunk {
diff --git a/engines/mediastation/mediascript/eventhandler.cpp b/engines/mediastation/mediascript/eventhandler.cpp
index dbbcdbacb09..7d089caaaba 100644
--- a/engines/mediastation/mediascript/eventhandler.cpp
+++ b/engines/mediastation/mediascript/eventhandler.cpp
@@ -25,14 +25,14 @@
namespace MediaStation {
EventHandler::EventHandler(Chunk &chunk) {
- _type = (EventHandler::Type)(Datum(chunk).u.i);
+ _type = static_cast<EventType>(Datum(chunk).u.i);
debugC(5, kDebugLoading, "EventHandler::EventHandler(): Type 0x%x (@0x%llx)", _type, static_cast<long long int>(chunk.pos()));
- _argumentType = (EventHandler::ArgumentType)(Datum(chunk).u.i);
+ _argumentType = static_cast<EventHandlerArgumentType>(Datum(chunk).u.i);
debugC(5, kDebugLoading, "EventHandler::EventHandler(): Argument type 0x%x (@0x%llx)", _argumentType, static_cast<long long int>(chunk.pos()));
_argumentValue = Datum(chunk);
- if (_argumentType != EventHandler::ArgumentType::Null) {
- uint lengthInBytes = Datum(chunk, DatumType::UINT32_1).u.i;
+ if (_argumentType != kNullEventHandlerArgument) {
+ uint lengthInBytes = Datum(chunk, kDatumTypeUint32_1).u.i;
debugC(5, kDebugLoading, "EventHandler::EventHandler(): Null argument type, length = 0x%x (@0x%llx)", lengthInBytes, static_cast<long long int>(chunk.pos()));
}
@@ -43,23 +43,23 @@ Operand EventHandler::execute(uint assetId) {
// TODO: The assetId is only passed in for debug visibility, there should be
// a better way to handle that.
switch (_argumentType) {
- case EventHandler::ArgumentType::Null: {
+ case kNullEventHandlerArgument: {
debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (no argument) **********", assetId, (uint)_type);
break;
}
- case EventHandler::ArgumentType::AsciiCode: {
+ case kAsciiCodeEventHandlerArgument: {
debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (ASCII code = %d) **********", assetId, (uint)_type, _argumentValue.u.i);
break;
}
- case EventHandler::ArgumentType::Context: {
+ case kContextEventHandlerArgument: {
debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (context = %d) **********", assetId, (uint)_type, _argumentValue.u.i);
break;
}
- case EventHandler::ArgumentType::Time:
- case EventHandler::ArgumentType::Unk1: {
+ case kTimeEventHandlerArgument:
+ case kUnk1EventHandlerArgument: {
debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (time = %f) **********", assetId, (uint)_type, _argumentValue.u.f);
break;
}
diff --git a/engines/mediastation/mediascript/eventhandler.h b/engines/mediastation/mediascript/eventhandler.h
index 3e6736543ae..c949e1cc009 100644
--- a/engines/mediastation/mediascript/eventhandler.h
+++ b/engines/mediastation/mediascript/eventhandler.h
@@ -27,78 +27,77 @@
#include "mediastation/datafile.h"
#include "mediastation/datum.h"
-
#include "mediastation/mediascript/codechunk.h"
namespace MediaStation {
+enum EventType {
+ // TIMER EVENTS.
+ kTimerEvent = 5,
+
+ // HOTSPOT EVENTS.
+ kMouseDownEvent = 6,
+ kMouseUpEvent = 7,
+ kMouseMovedEvent = 8,
+ kMouseEnteredEvent = 9,
+ kMouseExitedEvent = 10,
+ kKeyDownEvent = 13, // PARAMS: 1 - ASCII code.
+
+ // SOUND EVENTS.
+ kSoundEndEvent = 14,
+ kSoundAbortEvent = 19,
+ kSoundFailureEvent = 20,
+ kSoundStoppedEvent = 29,
+ kSoundBeginEvent = 30,
+
+ // MOVIE EVENTS.
+ kMovieEndEvent = 15,
+ kMovieAbortEvent = 21,
+ kMovieFailureEvent = 22,
+ kMovieStoppedEvent = 31,
+ kMovieBeginEvent = 32,
+
+ //SPRITE EVENTS.
+ // Just "MovieEnd" in source.
+ kSpriteMovieEndEvent = 23,
+
+ // SCREEN EVENTS.
+ kEntryEvent = 17,
+ kExitEvent = 27,
+
+ // CONTEXT EVENTS.
+ kLoadCompleteEvent = 44, // PARAMS: 1 - Context ID
+
+ // TEXT EVENTS.
+ kInputEvent = 37,
+ kErrorEvent = 38,
+
+ // CAMERA EVENTS.
+ kPanAbortEvent = 43,
+ kPanEndEvent = 42,
+
+ // PATH EVENTS.
+ kStepEvent = 28,
+ kPathStoppedEvent = 33,
+ kPathEndEvent = 16
+};
+
+enum EventHandlerArgumentType {
+ kNullEventHandlerArgument = 0,
+ kAsciiCodeEventHandlerArgument = 1, // TODO: Why is this datum type a float?
+ kTimeEventHandlerArgument = 3,
+ kUnk1EventHandlerArgument = 4, // Appars to happen with MovieStart?
+ kContextEventHandlerArgument = 5
+};
+
class EventHandler {
public:
- enum class Type {
- // TIMER EVENTS.
- Time = 5,
-
- // HOTSPOT EVENTS.
- MouseDown = 6,
- MouseUp = 7,
- MouseMoved = 8,
- MouseEntered = 9,
- MouseExited = 10,
- KeyDown = 13, // PARAMS: 1 - ASCII code.
-
- // SOUND EVENTS.
- SoundEnd = 14,
- SoundAbort = 19,
- SoundFailure = 20,
- SoundStopped = 29,
- SoundBegin = 30,
-
- // MOVIE EVENTS.
- MovieEnd = 15,
- MovieAbort = 21,
- MovieFailure = 22,
- MovieStopped = 31,
- MovieBegin = 32,
-
- //SPRITE EVENTS.
- // Just "MovieEnd" in source.
- SpriteMovieEnd = 23,
-
- // SCREEN EVENTS.
- Entry = 17,
- Exit = 27,
-
- // CONTEXT EVENTS.
- LoadComplete = 44, // PARAMS: 1 - Context ID
-
- // TEXT EVENTS.
- Input = 37,
- Error = 38,
-
- // CAMERA EVENTS.
- PanAbort = 43,
- PanEnd = 42,
-
- // PATH EVENTS.
- Step = 28,
- PathStopped = 33,
- PathEnd = 16
- };
-
- enum class ArgumentType {
- Null = 0,
- AsciiCode = 1, // TODO: Why is this datum type a float?
- Time = 3,
- Unk1 = 4, // Appars to happen with MovieStart?
- Context = 5
- };
-
EventHandler(Chunk &chunk);
~EventHandler();
Operand execute(uint assetId);
- EventHandler::Type _type;
- EventHandler::ArgumentType _argumentType;
+ EventType _type;
+ EventHandlerArgumentType _argumentType;
Datum _argumentValue;
private:
diff --git a/engines/mediastation/mediascript/function.cpp b/engines/mediastation/mediascript/function.cpp
index d44afa0016a..6a51ecd4152 100644
--- a/engines/mediastation/mediascript/function.cpp
+++ b/engines/mediastation/mediascript/function.cpp
@@ -30,7 +30,7 @@ namespace MediaStation {
Function::Function(Chunk &chunk) {
_fileId = Datum(chunk).u.i;
_id = Datum(chunk).u.i; // + 19900;
- uint lengthInBytes = Datum(chunk, DatumType::UINT32_1).u.i;
+ uint lengthInBytes = Datum(chunk, kDatumTypeUint32_1).u.i;
debugC(5, kDebugLoading, "Function::Function(): id = 0x%x, size = 0x%x bytes", _id, lengthInBytes);
_code = new CodeChunk(chunk);
}
diff --git a/engines/mediastation/mediascript/operand.cpp b/engines/mediastation/mediascript/operand.cpp
index 62674df8012..4b85c8331b3 100644
--- a/engines/mediastation/mediascript/operand.cpp
+++ b/engines/mediastation/mediascript/operand.cpp
@@ -27,14 +27,14 @@ namespace MediaStation {
void Operand::putInteger(int i) {
switch (_type) {
- case Operand::Type::Literal1:
- case Operand::Type::Literal2:
- case Operand::Type::DollarSignVariable: {
+ case kOperandTypeLiteral1:
+ case kOperandTypeLiteral2:
+ case kOperandTypeDollarSignVariable: {
_u.i = i;
break;
}
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
_u.variable->value.i = i;
break;
}
@@ -47,13 +47,13 @@ void Operand::putInteger(int i) {
int Operand::getInteger() {
switch (_type) {
- case Operand::Type::Literal1:
- case Operand::Type::Literal2:
- case Operand::Type::DollarSignVariable: {
+ case kOperandTypeLiteral1:
+ case kOperandTypeLiteral2:
+ case kOperandTypeDollarSignVariable: {
return _u.i;
}
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
return _u.variable->value.i;
}
@@ -65,13 +65,13 @@ int Operand::getInteger() {
void Operand::putDouble(double d) {
switch (_type) {
- case Operand::Type::Float1:
- case Operand::Type::Float2: {
+ case kOperandTypeFloat1:
+ case kOperandTypeFloat2: {
_u.d = d;
break;
}
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
// TODO: Add assertion.
_u.variable->value.d = d;
break;
@@ -85,12 +85,12 @@ void Operand::putDouble(double d) {
double Operand::getDouble() {
switch (_type) {
- case Operand::Type::Float1:
- case Operand::Type::Float2: {
+ case kOperandTypeFloat1:
+ case kOperandTypeFloat2: {
return _u.d;
}
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
// TODO: Add assertion that this is the proper type.
return _u.variable->value.d;
}
@@ -103,13 +103,13 @@ double Operand::getDouble() {
void Operand::putString(Common::String *string) {
switch (_type) {
- case Operand::Type::String: {
+ case kOperandTypeString: {
_u.string = string;
break;
}
- case Operand::Type::VariableDeclaration: {
- assert(_u.variable->type == Variable::Type::STRING);
+ case kOperandTypeVariableDeclaration: {
+ assert(_u.variable->type == kVariableTypeString);
_u.variable->value.string = string;
break;
}
@@ -122,12 +122,12 @@ void Operand::putString(Common::String *string) {
Common::String *Operand::getString() {
switch (_type) {
- case Operand::Type::String: {
+ case kOperandTypeString: {
return _u.string;
}
- case Operand::Type::VariableDeclaration: {
- assert(_u.variable->type == Variable::Type::STRING);
+ case kOperandTypeVariableDeclaration: {
+ assert(_u.variable->type == kVariableTypeString);
return _u.variable->value.string;
}
@@ -139,7 +139,7 @@ Common::String *Operand::getString() {
void Operand::putVariable(Variable *variable) {
switch (_type) {
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
_u.variable = variable;
break;
}
@@ -152,7 +152,7 @@ void Operand::putVariable(Variable *variable) {
Variable *Operand::getVariable() {
switch (_type) {
- case Operand::Type::VariableDeclaration: {
+ case kOperandTypeVariableDeclaration: {
return _u.variable;
}
@@ -164,7 +164,7 @@ Variable *Operand::getVariable() {
void Operand::putFunction(Function *function) {
switch (_type) {
- case Operand::Type::Function: {
+ case kOperandTypeFunction: {
_u.function = function;
break;
}
@@ -177,7 +177,7 @@ void Operand::putFunction(Function *function) {
Function *Operand::getFunction() {
switch (_type) {
- case Operand::Type::Function: {
+ case kOperandTypeFunction: {
return _u.function;
}
@@ -189,13 +189,13 @@ Function *Operand::getFunction() {
void Operand::putAsset(uint32 assetId) {
switch (_type) {
- case Operand::Type::AssetId: {
+ case kOperandTypeAssetId: {
_u.assetId = assetId;
break;
}
- case Operand::Type::VariableDeclaration: {
- assert(_u.variable->type == Variable::Type::ASSET_ID);
+ case kOperandTypeVariableDeclaration: {
+ assert(_u.variable->type == kVariableTypeAssetId);
_u.variable->value.assetId = assetId;
break;
}
@@ -208,7 +208,7 @@ void Operand::putAsset(uint32 assetId) {
Asset *Operand::getAsset() {
switch (_type) {
- case Operand::Type::AssetId: {
+ case kOperandTypeAssetId: {
if (_u.assetId == 0) {
return nullptr;
} else {
@@ -216,8 +216,8 @@ Asset *Operand::getAsset() {
}
}
- case Operand::Type::VariableDeclaration: {
- assert(_u.variable->type == Variable::Type::ASSET_ID);
+ case kOperandTypeVariableDeclaration: {
+ assert(_u.variable->type == kVariableTypeAssetId);
return g_engine->_assets.getVal(_u.variable->value.assetId);
}
@@ -229,12 +229,12 @@ Asset *Operand::getAsset() {
uint32 Operand::getAssetId() {
switch (_type) {
- case Operand::Type::AssetId: {
+ case kOperandTypeAssetId: {
return _u.assetId;
}
- case Operand::Type::VariableDeclaration: {
- assert(_u.variable->type == Variable::Type::ASSET_ID);
+ case kOperandTypeVariableDeclaration: {
+ assert(_u.variable->type == kVariableTypeAssetId);
return _u.variable->value.assetId;
}
@@ -246,11 +246,11 @@ uint32 Operand::getAssetId() {
Operand Operand::operator-(const Operand &other) const {
Operand returnValue;
- if (this->_type == Operand::Type::Literal1 && other._type == Operand::Type::Literal1) {
- returnValue._type = Operand::Type::Literal1;
+ if (this->_type == kOperandTypeLiteral1 && other._type == kOperandTypeLiteral1) {
+ returnValue._type = kOperandTypeLiteral1;
returnValue._u.i = this->_u.i - other._u.i;
- } else if (this->_type == Operand::Type::Float1 && other._type == Operand::Type::Float1) {
- returnValue._type = Operand::Type::Float1;
+ } else if (this->_type == kOperandTypeFloat1 && other._type == kOperandTypeFloat1) {
+ returnValue._type = kOperandTypeFloat1;
returnValue._u.d = this->_u.d - other._u.d;
} else {
error("Operand::operator-(): Unsupported operand types %d and %d", this->_type, other._type);
diff --git a/engines/mediastation/mediascript/operand.h b/engines/mediastation/mediascript/operand.h
index ed3a64b87af..14988e60626 100644
--- a/engines/mediastation/mediascript/operand.h
+++ b/engines/mediastation/mediascript/operand.h
@@ -31,32 +31,32 @@ namespace MediaStation {
class Function;
class Asset;
+enum OperandType {
+ kOperandTypeEmpty = 0, // a flag for C++ code, not real operand type.
+ // TODO: Figure out the difference between these two.
+ kOperandTypeLiteral1 = 151,
+ kOperandTypeLiteral2 = 153,
+ // TODO: Figure out the difference between these two.
+ kOperandTypeFloat1 = 152,
+ kOperandTypeFloat2 = 157,
+ kOperandTypeString = 154,
+ // TODO: This only seems to be used in effectTransition:
+ // effectTransition ( $FadeToPalette )
+ // compiles to:
+ // [219, 102, 1]
+ // [155, 301]
+ kOperandTypeDollarSignVariable = 155,
+ kOperandTypeAssetId = 156,
+ kOperandTypeVariableDeclaration = 158,
+ kOperandTypeFunction = 160
+};
+
class Operand {
public:
- enum class Type {
- Empty = 0, // a flag for C++ code, not real operand type.
- // TODO: Figure out the difference between these two.
- Literal1 = 151,
- Literal2 = 153,
- // TODO: Figure out the difference between these two.
- Float1 = 152,
- Float2 = 157,
- String = 154,
- // TODO: This only seems to be used in effectTransition:
- // effectTransition ( $FadeToPalette )
- // compiles to:
- // [219, 102, 1]
- // [155, 301]
- DollarSignVariable = 155,
- AssetId = 156,
- VariableDeclaration = 158,
- Function = 160
- };
-
- Operand() : _type(Operand::Type::Empty) {}
- Operand(Operand::Type type) : _type(type) {}
-
- Operand::Type getType() const {
+ Operand() : _type(kOperandTypeEmpty) {}
+ Operand(OperandType type) : _type(type) {}
+
+ OperandType getType() const {
return _type;
}
@@ -82,7 +82,7 @@ public:
Operand operator-(const Operand &other) const;
private:
- Operand::Type _type = Operand::Type::Empty;
+ OperandType _type = kOperandTypeEmpty;
union {
uint assetId = 0;
Common::String *string;
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index b8f961420be..84fc84ec1e6 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -28,11 +28,11 @@
namespace MediaStation {
Variable::Variable(Chunk &chunk) {
- id = Datum(chunk, DatumType::UINT16_1).u.i;
- type = Variable::Type(Datum(chunk, DatumType::UINT8).u.i);
+ id = Datum(chunk, kDatumTypeUint16_1).u.i;
+ type = VariableType(Datum(chunk, kDatumTypeUint8).u.i);
debugC(5, kDebugLoading, "Variable::Variable(): id = 0x%x, type 0x%x (@0x%llx)", id, type, static_cast<long long int>(chunk.pos()));
- switch ((Type)type) {
- case Type::COLLECTION: {
+ switch ((VariableType)type) {
+ case kVariableTypeCollection: {
uint totalItems = Datum(chunk).u.i;
value.collection = new Common::Array<Variable *>;
for (uint i = 0; i < totalItems; i++) {
@@ -43,7 +43,7 @@ Variable::Variable(Chunk &chunk) {
break;
}
- case Type::STRING: {
+ case kVariableTypeString: {
// TODO: This copies the string. Can we read it directly from the chunk?
int size = Datum(chunk).u.i;
char *buffer = new char[size + 1];
@@ -55,20 +55,20 @@ Variable::Variable(Chunk &chunk) {
break;
}
- case Type::ASSET_ID: {
- value.assetId = Datum(chunk, DatumType::UINT16_1).u.i;
+ case kVariableTypeAssetId: {
+ value.assetId = Datum(chunk, kDatumTypeUint16_1).u.i;
debugC(7, kDebugLoading, "Variable::Variable(): ASSET ID: %d", value.assetId);
break;
}
- case Type::BOOLEAN: {
- uint rawValue = Datum(chunk, DatumType::UINT8).u.i;
+ case kVariableTypeBoolean: {
+ uint rawValue = Datum(chunk, kDatumTypeUint8).u.i;
debugC(7, kDebugLoading, " Variable::Variable(): BOOL: %d", rawValue);
value.b = (rawValue == 1);
break;
}
- case Type::LITERAL: {
+ case kVariableTypeLiteral: {
// Client code can worry about extracting the value.
value.datum = new Datum(chunk);
debugC(7, kDebugLoading, "Variable::Variable(): LITERAL");
@@ -83,23 +83,23 @@ Variable::Variable(Chunk &chunk) {
}
Variable::~Variable() {
- switch ((Type)type) {
- case Type::ASSET_ID:
- case Type::BOOLEAN: {
+ switch (type) {
+ case kVariableTypeAssetId:
+ case kVariableTypeBoolean: {
break;
}
- case Type::COLLECTION: {
+ case kVariableTypeCollection: {
delete value.collection;
break;
}
- case Type::STRING: {
+ case kVariableTypeString: {
delete value.string;
break;
}
- case Type::LITERAL: {
+ case kVariableTypeLiteral: {
delete value.datum;
break;
}
diff --git a/engines/mediastation/mediascript/variable.h b/engines/mediastation/mediascript/variable.h
index 7f087450fb3..cab36505c20 100644
--- a/engines/mediastation/mediascript/variable.h
+++ b/engines/mediastation/mediascript/variable.h
@@ -28,34 +28,34 @@
namespace MediaStation {
-class Variable {
-public:
- enum class Type {
- // This is an invalid type used for initialization only.
- EMPTY = 0x0000,
+enum VariableType {
+ // This is an invalid type used for initialization only.
+ kVariableTypeEmpty = 0x0000,
- // This is an "array", but the IMT sources
- // use the term "collection".
- COLLECTION = 0x0007,
- STRING = 0x0006,
- ASSET_ID = 0x0005,
- // These seem to be used in Dalmatians, but I don't know what they are
- // used for.
- UNK1 = 0x0004,
- // These seem to be constants of some sort? This is what some of these
- // IDs look like in PROFILE._ST:
- // - $downEar 10026
- // - $sitDown 10027
- // Seems like these can also reference variables:
- // - var_6c14_bool_FirstThingLev3 315
- // - var_6c14_NextEncouragementSound 316
- UNK2 = 0x0003,
- BOOLEAN = 0x0002,
- LITERAL = 0x0001
- };
+ // This is an "array", but the IMT sources
+ // use the term "collection".
+ kVariableTypeCollection = 0x0007,
+ kVariableTypeString = 0x0006,
+ kVariableTypeAssetId = 0x0005,
+ // These seem to be used in Dalmatians, but I don't know what they are
+ // used for.
+ kVariableTypeUnk1 = 0x0004,
+ // These seem to be constants of some sort? This is what some of these
+ // IDs look like in PROFILE._ST:
+ // - $downEar 10026
+ // - $sitDown 10027
+ // Seems like these can also reference variables:
+ // - var_6c14_bool_FirstThingLev3 315
+ // - var_6c14_NextEncouragementSound 316
+ kVariableTypeUnk2 = 0x0003,
+ kVariableTypeBoolean = 0x0002,
+ kVariableTypeLiteral = 0x0001
+};
+class Variable {
+public:
uint32 id = 0;
- Variable::Type type = Type::EMPTY;
+ VariableType type = kVariableTypeEmpty;
union {
Datum *datum = nullptr;
Common::String *string;
diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index e7ad7685b18..207520f3ba5 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -124,7 +124,7 @@ Common::Error MediaStationEngine::run() {
setPaletteFromHeader(activeScreen->_screenAsset);
// PROCESS THE OPENING EVENT HANDLER.
- EventHandler *entryEvent = activeScreen->_screenAsset->_eventHandlers.getValOrDefault(EventHandler::Type::Entry);
+ EventHandler *entryEvent = activeScreen->_screenAsset->_eventHandlers.getValOrDefault(MediaStation::kEntryEvent);
if (entryEvent != nullptr) {
debugC(5, kDebugScript, "Executing context entry event handler");
entryEvent->execute(activeScreen->_screenAsset->_id);
Commit: 7c56d35e77aff7bef7204738f360a36a8b872129
https://github.com/scummvm/scummvm/commit/7c56d35e77aff7bef7204738f360a36a8b872129
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Fix more format GCC compiler warnings
Changed paths:
engines/mediastation/assets/movie.cpp
engines/mediastation/assets/sprite.cpp
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index 7916b0ad680..c7bff1ed8c7 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -31,7 +31,7 @@ namespace MediaStation {
MovieFrameHeader::MovieFrameHeader(Chunk &chunk) : BitmapHeader(chunk) {
_index = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "MovieFrameHeader::MovieFrameHeader(): _index = 0x%x (@0x%llx)", _index, chunk.pos());
+ debugC(5, kDebugLoading, "MovieFrameHeader::MovieFrameHeader(): _index = 0x%x (@0x%llx)", _index, static_cast<long long int>(chunk.pos()));
_keyframeEndInMilliseconds = Datum(chunk).u.i;
}
@@ -58,7 +58,7 @@ MovieFrameFooter::MovieFrameFooter(Chunk &chunk) {
_index = Datum(chunk).u.i;
_unk8 = Datum(chunk).u.i;
_unk9 = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "MovieFrameFooter::MovieFrameFooter(): _startInMilliseconds = 0x%x, _endInMilliseconds = 0x%x, _left = 0x%x, _top = 0x%x, _index = 0x%x (@0x%llx)", _startInMilliseconds, _endInMilliseconds, _left, _top, _index, chunk.pos());
+ debugC(5, kDebugLoading, "MovieFrameFooter::MovieFrameFooter(): _startInMilliseconds = 0x%x, _endInMilliseconds = 0x%x, _left = 0x%x, _top = 0x%x, _index = 0x%x (@0x%llx)", _startInMilliseconds, _endInMilliseconds, _left, _top, _index, static_cast<long long int>(chunk.pos()));
debugC(5, kDebugLoading, "MovieFrameFooter::MovieFrameFooter(): _unk4 = 0x%x, _unk5 = 0x%x, _unk6 = 0x%x, _unk7 = 0x%x, _unk8 = 0x%x, _unk9 = 0x%x", _unk4, _zIndex, _unk6, _unk7, _unk8, _unk9);
}
}
@@ -345,39 +345,39 @@ void Movie::readChunk(Chunk &chunk) {
void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
// READ THE METADATA FOR THE WHOLE MOVIE.
uint expectedRootSectionType = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", expectedRootSectionType, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", expectedRootSectionType, static_cast<long long int>(chunk.pos()));
if (kMovieRootSection != (MovieSectionType)expectedRootSectionType) {
error("Expected ROOT section type, got 0x%x", expectedRootSectionType);
}
uint chunkCount = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): chunkCount = 0x%x (@0x%llx)", chunkCount, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): chunkCount = 0x%x (@0x%llx)", chunkCount, static_cast<long long int>(chunk.pos()));
uint dataStartOffset = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): dataStartOffset = 0x%x (@0x%llx)", dataStartOffset, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): dataStartOffset = 0x%x (@0x%llx)", dataStartOffset, static_cast<long long int>(chunk.pos()));
Common::Array<uint> chunkLengths;
for (uint i = 0; i < chunkCount; i++) {
uint chunkLength = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): chunkLength = 0x%x (@0x%llx)", chunkLength, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): chunkLength = 0x%x (@0x%llx)", chunkLength, static_cast<long long int>(chunk.pos()));
chunkLengths.push_back(chunkLength);
}
// RAD THE INTERLEAVED AUDIO AND ANIMATION DATA.
for (uint i = 0; i < chunkCount; i++) {
- debugC(5, kDebugLoading, "\nMovie::readSubfile(): Reading frameset %d of %d in subfile (@0x%llx)", i, chunkCount, chunk.pos());
+ debugC(5, kDebugLoading, "\nMovie::readSubfile(): Reading frameset %d of %d in subfile (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
chunk = subfile.nextChunk();
// READ ALL THE FRAMES IN THIS CHUNK.
- debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading animation chunks... (@0x%llx)", i, chunkCount, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading animation chunks... (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
bool isAnimationChunk = (chunk.id == _header->_animationChunkReference);
if (!isAnimationChunk) {
- warning("Movie::readSubfile(): (Frameset %d of %d) No animation chunks found (@0x%llx)", i, chunkCount, chunk.pos());
+ warning("Movie::readSubfile(): (Frameset %d of %d) No animation chunks found (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
}
MovieFrameHeader *header = nullptr;
MovieFrame *frame = nullptr;
while (isAnimationChunk) {
uint sectionType = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", sectionType, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
switch (MovieSectionType(sectionType)) {
case kMovieFrameSection: {
header = new MovieFrameHeader(chunk);
@@ -404,7 +404,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
}
default: {
- error("Movie::readSubfile(): Unknown movie animation section type 0x%x (@0x%llx)", sectionType, chunk.pos());
+ error("Movie::readSubfile(): Unknown movie animation section type 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
}
}
@@ -414,7 +414,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
}
// READ THE AUDIO.
- debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading audio chunk... (@0x%llx)", i, chunkCount, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading audio chunk... (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
bool isAudioChunk = (chunk.id = _header->_audioChunkReference);
if (isAudioChunk) {
byte *buffer = (byte *)malloc(chunk.length);
@@ -440,19 +440,19 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
_audioStreams.push_back(stream);
chunk = subfile.nextChunk();
} else {
- debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) No audio chunk to read. (@0x%llx)", i, chunkCount, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) No audio chunk to read. (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
}
// READ THE FOOTER FOR THIS SUBFILE.
- debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading header chunk... (@0x%llx)", i, chunkCount, chunk.pos());
+ debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading header chunk... (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
bool isHeaderChunk = (chunk.id == _header->_chunkReference);
if (isHeaderChunk) {
if (chunk.length != 0x04) {
- error("Movie::readSubfile(): Expected movie header chunk of size 0x04, got 0x%x (@0x%llx)", chunk.length, chunk.pos());
+ error("Movie::readSubfile(): Expected movie header chunk of size 0x04, got 0x%x (@0x%llx)", chunk.length, static_cast<long long int>(chunk.pos()));
}
chunk.skip(chunk.length);
} else {
- error("Movie::readSubfile(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk.id), chunk.pos());
+ error("Movie::readSubfile(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk.id), static_cast<long long int>(chunk.pos()));
}
}
diff --git a/engines/mediastation/assets/sprite.cpp b/engines/mediastation/assets/sprite.cpp
index 34209c3b3e8..895fff2984f 100644
--- a/engines/mediastation/assets/sprite.cpp
+++ b/engines/mediastation/assets/sprite.cpp
@@ -28,9 +28,9 @@ namespace MediaStation {
SpriteFrameHeader::SpriteFrameHeader(Chunk &chunk) : BitmapHeader(chunk) {
_index = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "SpriteFrameHeader::SpriteFrameHeader(): _index = 0x%x (@0x%llx)", _index, chunk.pos());
+ debugC(5, kDebugLoading, "SpriteFrameHeader::SpriteFrameHeader(): _index = 0x%x (@0x%llx)", _index, static_cast<long long int>(chunk.pos()));
_boundingBox = Datum(chunk, kDatumTypePoint2).u.point;
- debugC(5, kDebugLoading, "SpriteFrameHeader::SpriteFrameHeader(): _boundingBox (@0x%llx)", chunk.pos());
+ debugC(5, kDebugLoading, "SpriteFrameHeader::SpriteFrameHeader(): _boundingBox (@0x%llx)", static_cast<long long int>(chunk.pos()));
}
SpriteFrameHeader::~SpriteFrameHeader() {
@@ -154,7 +154,7 @@ void Sprite::process() {
void Sprite::readChunk(Chunk &chunk) {
// Reads one frame from the sprite.
- debugC(5, kDebugLoading, "Sprite::readFrame(): Reading sprite frame (@0x%llx)", chunk.pos());
+ debugC(5, kDebugLoading, "Sprite::readFrame(): Reading sprite frame (@0x%llx)", static_cast<long long int>(chunk.pos()));
SpriteFrameHeader *header = new SpriteFrameHeader(chunk);
SpriteFrame *frame = new SpriteFrame(chunk, header);
_frames.push_back(frame);
Commit: 5b157f53579bc3b054d540892bb286ef236df6ef
https://github.com/scummvm/scummvm/commit/5b157f53579bc3b054d540892bb286ef236df6ef
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Fix unused varable compiler warnings
Changed paths:
engines/mediastation/bitmap.cpp
engines/mediastation/context.cpp
engines/mediastation/contextparameters.cpp
diff --git a/engines/mediastation/bitmap.cpp b/engines/mediastation/bitmap.cpp
index f7d980406a4..eafb1476732 100644
--- a/engines/mediastation/bitmap.cpp
+++ b/engines/mediastation/bitmap.cpp
@@ -26,7 +26,8 @@
namespace MediaStation {
BitmapHeader::BitmapHeader(Chunk &chunk) {
- /*uint header_size_in_bytes =*/ Datum(chunk, kDatumTypeUint16_1).u.i;
+ uint header_size_in_bytes = Datum(chunk, kDatumTypeUint16_1).u.i;
+ debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): headerSize = 0x%x", header_size_in_bytes);
dimensions = Datum(chunk).u.point;
compression_type = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", compression_type);
@@ -103,9 +104,11 @@ void Bitmap::decompress(Chunk &chunk) {
char *decompressed_image = (char *)surface.getPixels();
// DECOMPRESS THE RLE-COMPRESSED BITMAP STREAM.
- bool transparency_run_ever_read = false;
- size_t transparency_run_top_y_coordinate = 0;
- size_t transparency_run_left_x_coordinate = 0;
+ // TODO: Comemnted out becuase transparency runs not supported yet,
+ // and there were compiler warnings about these variables not being used.
+ // bool transparency_run_ever_read = false;
+ // size_t transparency_run_top_y_coordinate = 0;
+ // size_t transparency_run_left_x_coordinate = 0;
bool image_fully_read = false;
size_t current_y_coordinate = 0;
while (current_y_coordinate < height()) {
@@ -138,10 +141,14 @@ void Bitmap::decompress(Chunk &chunk) {
// observed to have transparency regions, and these intraframes have them so the keyframe
// can extend outside the boundary of the intraframe and
// still be removed.
- reading_transparency_run = true;
- transparency_run_top_y_coordinate = current_y_coordinate;
- transparency_run_left_x_coordinate = current_x_coordinate;
- transparency_run_ever_read = true;
+ //
+ // TODO: Comemnted out becuase transparency runs not
+ // supported yet, and there were compiler warnings about
+ // these variables being set but not used.
+ // reading_transparency_run = true;
+ // transparency_run_top_y_coordinate = current_y_coordinate;
+ // transparency_run_left_x_coordinate = current_x_coordinate;
+ // transparency_run_ever_read = true;
} else if (operation == 0x03) {
// ADJUST THE PIXEL POSITION.
// This permits jumping to a different part of the same row without
@@ -180,11 +187,15 @@ void Bitmap::decompress(Chunk &chunk) {
current_x_coordinate += repetition_count;
if (reading_transparency_run) {
+ // TODO: This code is comemnted out becuase the engine
+ // doesn't support the keyframes/transparency regions on
+ // movies yet. However, only some movies have this to start with.
+
// GET THE TRANSPARENCY RUN STARTING OFFSET.
- size_t transparency_run_y_offset = transparency_run_top_y_coordinate * width();
- size_t transparency_run_start_offset = transparency_run_y_offset + transparency_run_left_x_coordinate;
- size_t transparency_run_ending_offset = y_offset + current_x_coordinate;
- size_t transparency_run_length = transparency_run_ending_offset - transparency_run_start_offset;
+ // size_t transparency_run_y_offset = transparency_run_top_y_coordinate * width();
+ // size_t transparency_run_start_offset = transparency_run_y_offset + transparency_run_left_x_coordinate;
+ // size_t transparency_run_ending_offset = y_offset + current_x_coordinate;
+ // size_t transparency_run_length = transparency_run_ending_offset - transparency_run_start_offset;
// char *transparency_run_src_pointer = keyframe_image + run_starting_offset;
// char *transparency_run_dest_pointer = decompressed_image + run_starting_offset;
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index c20ef795541..61caa03700c 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -183,7 +183,10 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
delete[] buffer;
debugC(5, kDebugLoading, "Context::readHeaderSection(): Read palette");
// This is likely just an ending flag that we expect to be zero.
- Datum(chunk, kDatumTypeUint16_1).u.i;
+ uint endingFlag = Datum(chunk, kDatumTypeUint16_1).u.i;
+ if (endingFlag != 0) {
+ warning("Context::readHeaderSection(): Got non-zero ending flag 0x%x", endingFlag);
+ }
break;
}
@@ -254,7 +257,8 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
g_engine->_assetsByChunkReference.setVal(header->_animationChunkReference, asset);
}
// TODO: This datum only appears sometimes.
- Datum(chunk).u.i;
+ uint unk2 = Datum(chunk).u.i;
+ debugC(5, kDebugLoading, "Context::readHeaderSection(): Got unknown value at end of asset header section 0x%x", unk2);
break;
}
@@ -262,7 +266,10 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
Function *function = new Function(chunk);
g_engine->_functions.setVal(function->_id, function);
if (!g_engine->isFirstGenerationEngine()) {
- Datum(chunk).u.i; // Should be zero.
+ uint endingFlag = Datum(chunk).u.i;
+ if (endingFlag != 0) {
+ warning("Context::readHeaderSection(): Got non-zero ending flag 0x%x in function section", endingFlag);
+ }
}
break;
}
diff --git a/engines/mediastation/contextparameters.cpp b/engines/mediastation/contextparameters.cpp
index 904641d38df..7cc340324fd 100644
--- a/engines/mediastation/contextparameters.cpp
+++ b/engines/mediastation/contextparameters.cpp
@@ -40,7 +40,10 @@ ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
}
contextName = Datum(chunk, kDatumTypeString).u.string;
// TODO: This is likely just an end flag.
- /*uint unk1 =*/ Datum(chunk, kDatumTypeUint16_1).u.i;
+ uint endingFlag = Datum(chunk, kDatumTypeUint16_1).u.i;
+ if (endingFlag != 0) {
+ warning("ContextParameters::ContextParameters(): Got non-zero ending flag 0x%x", endingFlag);
+ }
break;
}
Commit: e6186152a509d1910344eeffef10ed964fb6c882
https://github.com/scummvm/scummvm/commit/e6186152a509d1910344eeffef10ed964fb6c882
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Relocate header include guards
They are moved before the include directives, as is proper :)
Changed paths:
engines/mediastation/assets/image.h
engines/mediastation/assets/movie.h
engines/mediastation/bitmap.h
engines/mediastation/boot.h
engines/mediastation/chunk.h
engines/mediastation/datafile.h
engines/mediastation/datum.h
engines/mediastation/subfile.h
diff --git a/engines/mediastation/assets/image.h b/engines/mediastation/assets/image.h
index efaa4b7e56d..b6ff979efc3 100644
--- a/engines/mediastation/assets/image.h
+++ b/engines/mediastation/assets/image.h
@@ -19,6 +19,9 @@
*
*/
+#ifndef MEDIASTATION_IMAGE_H
+#define MEDIASTATION_IMAGE_H
+
#include "graphics/managed_surface.h"
#include "mediastation/asset.h"
@@ -28,9 +31,6 @@
#include "mediastation/assetheader.h"
#include "mediastation/mediascript/operand.h"
-#ifndef MEDIASTATION_IMAGE_H
-#define MEDIASTATION_IMAGE_H
-
namespace MediaStation {
class Image : public Asset {
diff --git a/engines/mediastation/assets/movie.h b/engines/mediastation/assets/movie.h
index e1a565770c7..b1ab03dc17d 100644
--- a/engines/mediastation/assets/movie.h
+++ b/engines/mediastation/assets/movie.h
@@ -19,15 +19,15 @@
*
*/
+#ifndef MEDIASTATION_MOVIE_H
+#define MEDIASTATION_MOVIE_H
+
#include "audio/audiostream.h"
#include "mediastation/assetheader.h"
#include "mediastation/bitmap.h"
#include "mediastation/mediascript/builtins.h"
-#ifndef MEDIASTATION_MOVIE_H
-#define MEDIASTATION_MOVIE_H
-
namespace MediaStation {
class MovieFrameHeader : public BitmapHeader {
diff --git a/engines/mediastation/bitmap.h b/engines/mediastation/bitmap.h
index da274067ca2..1638c6e8341 100644
--- a/engines/mediastation/bitmap.h
+++ b/engines/mediastation/bitmap.h
@@ -19,14 +19,14 @@
*
*/
+#ifndef MEDIASTATION_BITMAP_H
+#define MEDIASTATION_BITMAP_H
+
#include "graphics/managed_surface.h"
#include "mediastation/chunk.h"
#include "mediastation/assetheader.h"
-#ifndef MEDIASTATION_BITMAP_H
-#define MEDIASTATION_BITMAP_H
-
namespace MediaStation {
enum BitmapCompressionType {
diff --git a/engines/mediastation/boot.h b/engines/mediastation/boot.h
index 6aee0cfa435..0b7b12e1fb6 100644
--- a/engines/mediastation/boot.h
+++ b/engines/mediastation/boot.h
@@ -19,12 +19,12 @@
*
*/
-#include "mediastation/datafile.h"
-#include "mediastation/subfile.h"
-
#ifndef MEDIASTATION_BOOT_H
#define MEDIASTATION_BOOT_H
+#include "mediastation/datafile.h"
+#include "mediastation/subfile.h"
+
namespace MediaStation {
// Contains information about the engine (also called
diff --git a/engines/mediastation/chunk.h b/engines/mediastation/chunk.h
index 2048b3b523f..63cb8e90793 100644
--- a/engines/mediastation/chunk.h
+++ b/engines/mediastation/chunk.h
@@ -19,11 +19,11 @@
*
*/
-#include "common/file.h"
-
#ifndef MEDIASTATION_CHUNK_H
#define MEDIASTATION_CHUNK_H
+#include "common/file.h"
+
namespace MediaStation {
class Chunk : public Common::SeekableReadStream {
diff --git a/engines/mediastation/datafile.h b/engines/mediastation/datafile.h
index 0332596fe7e..a84849f5120 100644
--- a/engines/mediastation/datafile.h
+++ b/engines/mediastation/datafile.h
@@ -19,11 +19,11 @@
*
*/
-#include "common/file.h"
-
#ifndef MEDIASTATION_DATAFILE_H
#define MEDIASTATION_DATAFILE_H
+#include "common/file.h"
+
namespace MediaStation {
class Datafile {
diff --git a/engines/mediastation/datum.h b/engines/mediastation/datum.h
index f0d6326c56f..8c6a601d85d 100644
--- a/engines/mediastation/datum.h
+++ b/engines/mediastation/datum.h
@@ -19,14 +19,14 @@
*
*/
+#ifndef MEDIASTATION_DATUM_H
+#define MEDIASTATION_DATUM_H
+
#include "common/str.h"
#include "common/rect.h"
#include "mediastation/chunk.h"
-#ifndef MEDIASTATION_DATUM_H
-#define MEDIASTATION_DATUM_H
-
namespace MediaStation {
class Point;
diff --git a/engines/mediastation/subfile.h b/engines/mediastation/subfile.h
index 812970a0b28..77e8291b862 100644
--- a/engines/mediastation/subfile.h
+++ b/engines/mediastation/subfile.h
@@ -19,13 +19,13 @@
*
*/
+#ifndef MEDIASTATION_SUBFILE_H
+#define MEDIASTATION_SUBFILE_H
+
#include "common/file.h"
#include "mediastation/chunk.h"
-#ifndef MEDIASTATION_SUBFILE_H
-#define MEDIASTATION_SUBFILE_H
-
namespace MediaStation {
class Subfile {
Commit: 3f80111cc4e80b9642cb8a488ca8c8352cdd543e
https://github.com/scummvm/scummvm/commit/3f80111cc4e80b9642cb8a488ca8c8352cdd543e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Fix variable names not using camelCase.
Changed paths:
engines/mediastation/bitmap.cpp
engines/mediastation/bitmap.h
diff --git a/engines/mediastation/bitmap.cpp b/engines/mediastation/bitmap.cpp
index eafb1476732..5849c627e24 100644
--- a/engines/mediastation/bitmap.cpp
+++ b/engines/mediastation/bitmap.cpp
@@ -26,11 +26,11 @@
namespace MediaStation {
BitmapHeader::BitmapHeader(Chunk &chunk) {
- uint header_size_in_bytes = Datum(chunk, kDatumTypeUint16_1).u.i;
- debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): headerSize = 0x%x", header_size_in_bytes);
+ uint headerSizeInBytes = Datum(chunk, kDatumTypeUint16_1).u.i;
+ debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): headerSize = 0x%x", headerSizeInBytes);
dimensions = Datum(chunk).u.point;
- compression_type = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
- debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", compression_type);
+ compressionType = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
+ debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", compressionType);
// TODO: Figure out what this is.
// This has something to do with the width of the bitmap but is always
// a few pixels off from the width. And in rare cases it seems to be
@@ -44,7 +44,7 @@ BitmapHeader::~BitmapHeader() {
}
bool BitmapHeader::isCompressed() {
- return (compression_type != kUncompressedBitmap1) && (compression_type != kUncompressedBitmap2);
+ return (compressionType != kUncompressedBitmap1) && (compressionType != kUncompressedBitmap2);
}
Bitmap::Bitmap(Chunk &chunk, BitmapHeader *bitmapHeader) :
@@ -82,54 +82,54 @@ uint16 Bitmap::height() {
void Bitmap::decompress(Chunk &chunk) {
// GET THE COMPRESSED DATA.
- uint compressed_image_data_size_in_bytes = chunk.bytesRemaining();
- char *compressed_image_start = new char[compressed_image_data_size_in_bytes];
- char *compressed_image = compressed_image_start;
- chunk.read(compressed_image, compressed_image_data_size_in_bytes);
+ uint compressedImageDataSizeInBytes = chunk.bytesRemaining();
+ char *compressedImageStart = new char[compressedImageDataSizeInBytes];
+ char *compressedImage = compressedImageStart;
+ chunk.read(compressedImage, compressedImageDataSizeInBytes);
// MAKE SURE WE READ PAST THE FIRST 2 BYTES.
- char *compressed_image_data_start = compressed_image;
- if ((*compressed_image++ == 0) && (*compressed_image++ == 0)) {
+ char *compressedImageDataStart = compressedImage;
+ if ((*compressedImage++ == 0) && (*compressedImage++ == 0)) {
// This condition is empty, we just put it first since this is the expected case
// and the negated logic would be not as readable.
} else {
- compressed_image = compressed_image_data_start;
+ compressedImage = compressedImageDataStart;
}
- char *compressed_image_data_end = compressed_image + compressed_image_data_size_in_bytes;
+ char *compressedImageDataEnd = compressedImage + compressedImageDataSizeInBytes;
// GET THE DECOMPRESSED PIXELS BUFFER.
// Media Station has 8 bits per pixel, so the decompression buffer is
// simple.
// TODO: Do we have to set the pixels ourselves?
- char *decompressed_image = (char *)surface.getPixels();
+ char *decompressedImage = (char *)surface.getPixels();
// DECOMPRESS THE RLE-COMPRESSED BITMAP STREAM.
// TODO: Comemnted out becuase transparency runs not supported yet,
// and there were compiler warnings about these variables not being used.
- // bool transparency_run_ever_read = false;
- // size_t transparency_run_top_y_coordinate = 0;
- // size_t transparency_run_left_x_coordinate = 0;
- bool image_fully_read = false;
- size_t current_y_coordinate = 0;
- while (current_y_coordinate < height()) {
- size_t current_x_coordinate = 0;
- bool reading_transparency_run = false;
+ // bool transparencyRunEverRead = false;
+ // size_t transparencyRunTopYCoordinate = 0;
+ // size_t transparencyRunLeftXCoordinate = 0;
+ bool imageFullyRead = false;
+ size_t currentYCoordinate = 0;
+ while (currentYCoordinate < height()) {
+ size_t currentXCoordinate = 0;
+ bool readingTransparencyRun = false;
while (true) {
- uint8_t operation = *compressed_image++;
+ uint8_t operation = *compressedImage++;
if (operation == 0x00) {
// ENTER CONTROL MODE.
- operation = *compressed_image++;
+ operation = *compressedImage++;
if (operation == 0x00) {
// MARK THE END OF THE LINE.
// Also check if the image is finished being read.
- if (compressed_image >= compressed_image_data_end) {
- image_fully_read = true;
+ if (compressedImage >= compressedImageDataEnd) {
+ imageFullyRead = true;
}
break;
} else if (operation == 0x01) {
// MARK THE END OF THE IMAGE.
// TODO: When is this actually used?
- image_fully_read = true;
+ imageFullyRead = true;
break;
} else if (operation == 0x02) {
// MARK THE START OF A KEYFRAME TRANSPARENCY REGION.
@@ -145,10 +145,10 @@ void Bitmap::decompress(Chunk &chunk) {
// TODO: Comemnted out becuase transparency runs not
// supported yet, and there were compiler warnings about
// these variables being set but not used.
- // reading_transparency_run = true;
- // transparency_run_top_y_coordinate = current_y_coordinate;
- // transparency_run_left_x_coordinate = current_x_coordinate;
- // transparency_run_ever_read = true;
+ // readingTransparencyRun = true;
+ // transparencyRunTopYCoordinate = currentYCoordinate;
+ // transparencyRunLeftXCoordinate = currentXCoordinate;
+ // transparencyRunEverRead = true;
} else if (operation == 0x03) {
// ADJUST THE PIXEL POSITION.
// This permits jumping to a different part of the same row without
@@ -158,62 +158,62 @@ void Bitmap::decompress(Chunk &chunk) {
// So to skip 10 pixels using this approach, you would encode 00 03 0a 00.
// But to "skip" 10 pixels by encoding them as blank (0xff), you would encode 0a ff.
// What gives? I'm not sure.
- uint8_t x_change = *compressed_image++;
- current_x_coordinate += x_change;
- uint8_t y_change = *compressed_image++;
- current_y_coordinate += y_change;
+ uint8_t x_change = *compressedImage++;
+ currentXCoordinate += x_change;
+ uint8_t y_change = *compressedImage++;
+ currentYCoordinate += y_change;
} else if (operation >= 0x04) {
// READ A RUN OF UNCOMPRESSED PIXELS.
- size_t y_offset = current_y_coordinate * width();
- size_t run_starting_offset = y_offset + current_x_coordinate;
- char *run_starting_pointer = decompressed_image + run_starting_offset;
- uint8_t run_length = operation;
- memcpy(run_starting_pointer, compressed_image, run_length);
- compressed_image += operation;
- current_x_coordinate += operation;
-
- if (((uintptr_t)compressed_image) % 2 == 1) {
- compressed_image++;
+ size_t yOffset = currentYCoordinate * width();
+ size_t runStartingOffset = yOffset + currentXCoordinate;
+ char *runStartingPointer = decompressedImage + runStartingOffset;
+ uint8_t runLength = operation;
+ memcpy(runStartingPointer, compressedImage, runLength);
+ compressedImage += operation;
+ currentXCoordinate += operation;
+
+ if (((uintptr_t)compressedImage) % 2 == 1) {
+ compressedImage++;
}
}
} else {
// READ A RUN OF LENGTH ENCODED PIXELS.
- size_t y_offset = current_y_coordinate * width();
- size_t run_starting_offset = y_offset + current_x_coordinate;
- char *run_starting_pointer = decompressed_image + run_starting_offset;
- uint8_t color_index_to_repeat = *compressed_image++;
- uint8_t repetition_count = operation;
- memset(run_starting_pointer, color_index_to_repeat, repetition_count);
- current_x_coordinate += repetition_count;
-
- if (reading_transparency_run) {
+ size_t yOffset = currentYCoordinate * width();
+ size_t runStartingOffset = yOffset + currentXCoordinate;
+ char *runStartingPointer = decompressedImage + runStartingOffset;
+ uint8_t colorIndexToRepeat = *compressedImage++;
+ uint8_t repetitionCount = operation;
+ memset(runStartingPointer, colorIndexToRepeat, repetitionCount);
+ currentXCoordinate += repetitionCount;
+
+ if (readingTransparencyRun) {
// TODO: This code is comemnted out becuase the engine
// doesn't support the keyframes/transparency regions on
// movies yet. However, only some movies have this to start with.
// GET THE TRANSPARENCY RUN STARTING OFFSET.
- // size_t transparency_run_y_offset = transparency_run_top_y_coordinate * width();
- // size_t transparency_run_start_offset = transparency_run_y_offset + transparency_run_left_x_coordinate;
- // size_t transparency_run_ending_offset = y_offset + current_x_coordinate;
- // size_t transparency_run_length = transparency_run_ending_offset - transparency_run_start_offset;
- // char *transparency_run_src_pointer = keyframe_image + run_starting_offset;
- // char *transparency_run_dest_pointer = decompressed_image + run_starting_offset;
+ // size_t transparencyRunYOffset = transparencyRunTopYCoordinate * width();
+ // size_t transparencyRunStartOffset = transparencyRunYOffset + transparencyRunLeftXCoordinate;
+ // size_t transparencyRunEndingOffset = yOffset + currentXCoordinate;
+ // size_t transparency_run_length = transparencyRunEndingOffset - transparencyRunStartOffset;
+ // char *transparencyRunSrcPointer = keyframe_image + runStartingOffset;
+ // char *transparencyRunDestPointer = decompressedImage + runStartingOffset;
// COPY THE TRANSPARENT AREA FROM THE KEYFRAME.
// The "interior" of transparency regions is always encoded by a single run of
// pixels, usually 0x00 (white).
- // memcpy(transparency_run_dest_pointer, transparency_run_src_pointer, transparency_run_length);
- reading_transparency_run = false;
+ // memcpy(transparencyRunDestPointer, transparencyRunSrcPointer, transparency_run_length);
+ readingTransparencyRun = false;
}
}
}
- current_y_coordinate++;
- if (image_fully_read) {
+ currentYCoordinate++;
+ if (imageFullyRead) {
break;
}
}
- delete[] compressed_image_start;
+ delete[] compressedImageStart;
}
}
diff --git a/engines/mediastation/bitmap.h b/engines/mediastation/bitmap.h
index 1638c6e8341..28b9fcf7dac 100644
--- a/engines/mediastation/bitmap.h
+++ b/engines/mediastation/bitmap.h
@@ -44,7 +44,7 @@ public:
bool isCompressed();
Common::Point *dimensions = nullptr;
- BitmapCompressionType compression_type;
+ BitmapCompressionType compressionType;
uint unk2;
};
Commit: 609bb913c3ab88f41b8ad1a5944d37ca7e9133cf
https://github.com/scummvm/scummvm/commit/609bb913c3ab88f41b8ad1a5944d37ca7e9133cf
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Make sure class member names start with "_"
Changed paths:
engines/mediastation/assets/movie.cpp
engines/mediastation/assets/sound.cpp
engines/mediastation/assets/sprite.cpp
engines/mediastation/bitmap.cpp
engines/mediastation/bitmap.h
engines/mediastation/boot.cpp
engines/mediastation/boot.h
engines/mediastation/chunk.cpp
engines/mediastation/chunk.h
engines/mediastation/context.cpp
engines/mediastation/context.h
engines/mediastation/contextparameters.cpp
engines/mediastation/contextparameters.h
engines/mediastation/mediascript/codechunk.cpp
engines/mediastation/mediascript/operand.cpp
engines/mediastation/mediascript/variable.cpp
engines/mediastation/mediascript/variable.h
engines/mediastation/subfile.cpp
engines/mediastation/subfile.h
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index c7bff1ed8c7..4b64400444a 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -308,7 +308,7 @@ bool Movie::drawNextFrame() {
return a->zCoordinate() > b->zCoordinate();
});
for (MovieFrame *frame : framesToDraw) {
- g_engine->_screen->transBlitFrom(frame->surface, Common::Point(frame->left(), frame->top()), 0, false);
+ g_engine->_screen->transBlitFrom(frame->_surface, Common::Point(frame->left(), frame->top()), 0, false);
}
uint blitEnd = g_system->getMillis() - _startTime;
@@ -369,7 +369,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
// READ ALL THE FRAMES IN THIS CHUNK.
debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading animation chunks... (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
- bool isAnimationChunk = (chunk.id == _header->_animationChunkReference);
+ bool isAnimationChunk = (chunk._id == _header->_animationChunkReference);
if (!isAnimationChunk) {
warning("Movie::readSubfile(): (Frameset %d of %d) No animation chunks found (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
}
@@ -410,19 +410,19 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
// READ THE NEXT CHUNK.
chunk = subfile.nextChunk();
- isAnimationChunk = (chunk.id == _header->_animationChunkReference);
+ isAnimationChunk = (chunk._id == _header->_animationChunkReference);
}
// READ THE AUDIO.
debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading audio chunk... (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
- bool isAudioChunk = (chunk.id = _header->_audioChunkReference);
+ bool isAudioChunk = (chunk._id = _header->_audioChunkReference);
if (isAudioChunk) {
- byte *buffer = (byte *)malloc(chunk.length);
- chunk.read((void *)buffer, chunk.length);
+ byte *buffer = (byte *)malloc(chunk._length);
+ chunk.read((void *)buffer, chunk._length);
Audio::SeekableAudioStream *stream = nullptr;
switch (_header->_soundEncoding) {
case SoundEncoding::PCM_S16LE_MONO_22050:
- stream = Audio::makeRawStream(buffer, chunk.length, 22050, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN, DisposeAfterUse::YES);
+ stream = Audio::makeRawStream(buffer, chunk._length, 22050, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN, DisposeAfterUse::YES);
break;
case SoundEncoding::IMA_ADPCM_S16LE_MONO_22050:
@@ -445,14 +445,14 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
// READ THE FOOTER FOR THIS SUBFILE.
debugC(5, kDebugLoading, "Movie::readSubfile(): (Frameset %d of %d) Reading header chunk... (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
- bool isHeaderChunk = (chunk.id == _header->_chunkReference);
+ bool isHeaderChunk = (chunk._id == _header->_chunkReference);
if (isHeaderChunk) {
- if (chunk.length != 0x04) {
- error("Movie::readSubfile(): Expected movie header chunk of size 0x04, got 0x%x (@0x%llx)", chunk.length, static_cast<long long int>(chunk.pos()));
+ if (chunk._length != 0x04) {
+ error("Movie::readSubfile(): Expected movie header chunk of size 0x04, got 0x%x (@0x%llx)", chunk._length, static_cast<long long int>(chunk.pos()));
}
- chunk.skip(chunk.length);
+ chunk.skip(chunk._length);
} else {
- error("Movie::readSubfile(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk.id), static_cast<long long int>(chunk.pos()));
+ error("Movie::readSubfile(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk._id), static_cast<long long int>(chunk.pos()));
}
}
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index 783b182fe93..3e09348e17a 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -55,8 +55,8 @@ void Sound::process() {
void Sound::readChunk(Chunk &chunk) {
// TODO: Can we read the chunk directly into the audio stream?
debugC(5, kDebugLoading, "Sound::readChunk(): (encoding = 0x%x) Reading audio chunk (@0x%llx)", (uint)_encoding, static_cast<long long int>(chunk.pos()));
- byte *buffer = (byte *)malloc(chunk.length);
- chunk.read((void *)buffer, chunk.length);
+ byte *buffer = (byte *)malloc(chunk._length);
+ chunk.read((void *)buffer, chunk._length);
switch (_encoding) {
case SoundEncoding::PCM_S16LE_MONO_22050: {
@@ -85,14 +85,14 @@ void Sound::readSubfile(Subfile &subfile, Chunk &chunk) {
// warning("Sound::readSubfile(): Some audio has already been read.");
//}
uint32 totalChunks = _header->_chunkCount;
- uint32 expectedChunkId = chunk.id;
+ uint32 expectedChunkId = chunk._id;
readChunk(chunk);
for (uint i = 0; i < totalChunks; i++) {
chunk = subfile.nextChunk();
- if (chunk.id != expectedChunkId) {
+ 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));
+ error("Sound::readSubfile(): Expected chunk %s, got %s", tag2str(expectedChunkId), tag2str(chunk._id));
}
readChunk(chunk);
}
diff --git a/engines/mediastation/assets/sprite.cpp b/engines/mediastation/assets/sprite.cpp
index 895fff2984f..8bc2d517675 100644
--- a/engines/mediastation/assets/sprite.cpp
+++ b/engines/mediastation/assets/sprite.cpp
@@ -222,7 +222,7 @@ void Sprite::drawFrame(SpriteFrame *frame) {
uint frameLeft = frame->left() + _header->_boundingBox->left;
uint frameTop = frame->top() + _header->_boundingBox->top;
debugC(5, kDebugGraphics, " Sprite frame %d (%d x %d) @ (%d, %d)", frame->index(), frame->width(), frame->height(), frameLeft, frameTop);
- g_engine->_screen->transBlitFrom(frame->surface, Common::Point(frameLeft, frameTop), 0, false);
+ g_engine->_screen->transBlitFrom(frame->_surface, Common::Point(frameLeft, frameTop), 0, false);
}
} // End of namespace MediaStation
\ No newline at end of file
diff --git a/engines/mediastation/bitmap.cpp b/engines/mediastation/bitmap.cpp
index 5849c627e24..c3f93e92240 100644
--- a/engines/mediastation/bitmap.cpp
+++ b/engines/mediastation/bitmap.cpp
@@ -28,9 +28,9 @@ namespace MediaStation {
BitmapHeader::BitmapHeader(Chunk &chunk) {
uint headerSizeInBytes = Datum(chunk, kDatumTypeUint16_1).u.i;
debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): headerSize = 0x%x", headerSizeInBytes);
- dimensions = Datum(chunk).u.point;
- compressionType = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
- debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", compressionType);
+ _dimensions = Datum(chunk).u.point;
+ _compressionType = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
+ debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", _compressionType);
// TODO: Figure out what this is.
// This has something to do with the width of the bitmap but is always
// a few pixels off from the width. And in rare cases it seems to be
@@ -39,21 +39,21 @@ BitmapHeader::BitmapHeader(Chunk &chunk) {
}
BitmapHeader::~BitmapHeader() {
- delete dimensions;
- dimensions = nullptr;
+ delete _dimensions;
+ _dimensions = nullptr;
}
bool BitmapHeader::isCompressed() {
- return (compressionType != kUncompressedBitmap1) && (compressionType != kUncompressedBitmap2);
+ return (_compressionType != kUncompressedBitmap1) && (_compressionType != kUncompressedBitmap2);
}
Bitmap::Bitmap(Chunk &chunk, BitmapHeader *bitmapHeader) :
_bitmapHeader(bitmapHeader) {
// The header must be constructed beforehand.
- uint16 width = _bitmapHeader->dimensions->x;
- uint16 height = _bitmapHeader->dimensions->y;
- surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- uint8 *pixels = (uint8 *)surface.getPixels();
+ uint16 width = _bitmapHeader->_dimensions->x;
+ uint16 height = _bitmapHeader->_dimensions->y;
+ _surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ uint8 *pixels = (uint8 *)_surface.getPixels();
if (_bitmapHeader->isCompressed()) {
// DECOMPRESS THE IMAGE.
// chunk.skip(chunk.bytesRemaining());
@@ -73,11 +73,11 @@ Bitmap::~Bitmap() {
}
uint16 Bitmap::width() {
- return _bitmapHeader->dimensions->x;
+ return _bitmapHeader->_dimensions->x;
}
uint16 Bitmap::height() {
- return _bitmapHeader->dimensions->y;
+ return _bitmapHeader->_dimensions->y;
}
void Bitmap::decompress(Chunk &chunk) {
@@ -101,7 +101,7 @@ void Bitmap::decompress(Chunk &chunk) {
// Media Station has 8 bits per pixel, so the decompression buffer is
// simple.
// TODO: Do we have to set the pixels ourselves?
- char *decompressedImage = (char *)surface.getPixels();
+ char *decompressedImage = (char *)_surface.getPixels();
// DECOMPRESS THE RLE-COMPRESSED BITMAP STREAM.
// TODO: Comemnted out becuase transparency runs not supported yet,
diff --git a/engines/mediastation/bitmap.h b/engines/mediastation/bitmap.h
index 28b9fcf7dac..7604f7a6e77 100644
--- a/engines/mediastation/bitmap.h
+++ b/engines/mediastation/bitmap.h
@@ -43,8 +43,8 @@ public:
bool isCompressed();
- Common::Point *dimensions = nullptr;
- BitmapCompressionType compressionType;
+ Common::Point *_dimensions = nullptr;
+ BitmapCompressionType _compressionType;
uint unk2;
};
@@ -57,7 +57,7 @@ public:
uint16 width();
uint16 height();
- Graphics::ManagedSurface surface;
+ Graphics::ManagedSurface _surface;
private:
void decompress(Chunk &chunk);
diff --git a/engines/mediastation/boot.cpp b/engines/mediastation/boot.cpp
index 938374cb160..b8b135b50d3 100644
--- a/engines/mediastation/boot.cpp
+++ b/engines/mediastation/boot.cpp
@@ -29,9 +29,9 @@ namespace MediaStation {
#pragma region VersionInfo
VersionInfo::VersionInfo(Chunk &chunk) {
- majorVersion = Datum(chunk, kDatumTypeUint16_1).u.i;
- minorVersion = Datum(chunk, kDatumTypeUint16_1).u.i;
- revision = Datum(chunk, kDatumTypeUint16_1).u.i;
+ _majorVersion = Datum(chunk, kDatumTypeUint16_1).u.i;
+ _minorVersion = Datum(chunk, kDatumTypeUint16_1).u.i;
+ _revision = Datum(chunk, kDatumTypeUint16_1).u.i;
string = Datum(chunk, kDatumTypeString).u.string;
}
@@ -47,17 +47,17 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
// ENSURE WE HAVEN'T REACHED THE END OF THE DECLARATIONS.
ContextDeclarationSectionType sectionType = getSectionType(chunk);
if (kContextDeclarationEmptySection == sectionType) {
- isLast = true;
+ _isLast = true;
return;
} else {
// There may be more declarations in the stream.
- isLast = false;
+ _isLast = false;
}
// READ THE FILE REFERENCES.
while (kContextDeclarationFileReference == sectionType) {
int fileReference = Datum(chunk).u.i;
- fileReferences.push_back(fileReference);
+ _fileReferences.push_back(fileReference);
sectionType = getSectionType(chunk);
}
@@ -66,7 +66,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
// READ THE FILE NUMBER.
sectionType = getSectionType(chunk);
if (kContextDeclarationFileNumber1 == sectionType) {
- fileNumber = Datum(chunk).u.i;
+ _fileNumber = Datum(chunk).u.i;
} else {
error("ContextDeclaration(): Expected section type FILE_NUMBER_1, got 0x%x", sectionType);
}
@@ -75,8 +75,8 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
sectionType = getSectionType(chunk);
if (kContextDeclarationFileNumber2 == sectionType) {
uint32 repeatedFileNumber = Datum(chunk).u.i;
- if (repeatedFileNumber != fileNumber) {
- warning("ContextDeclaration(): Expected file numbers to match, but 0x%d != 0x%d", fileNumber, repeatedFileNumber);
+ if (repeatedFileNumber != _fileNumber) {
+ warning("ContextDeclaration(): Expected file numbers to match, but 0x%d != 0x%d", _fileNumber, repeatedFileNumber);
}
} else {
error("ContextDeclaration(): Expected section type FILE_NUMBER_2, got 0x%x", sectionType);
@@ -91,14 +91,14 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
int rewindOffset = chunk.pos();
sectionType = getSectionType(chunk);
if (kContextDeclarationName == sectionType) {
- contextName = Datum(chunk, kDatumTypeString).u.string;
+ _contextName = Datum(chunk, kDatumTypeString).u.string;
} else {
// THERE IS NO CONTEXT NAME.
// We have instead read into the next declaration, so let's undo that.
chunk.seek(rewindOffset);
}
} else if (kContextDeclarationEmptySection == sectionType) {
- isLast = true;
+ _isLast = true;
} else {
error("ContextDeclaration::ContextDeclaration(): Unknown section type 0x%x", sectionType);
}
@@ -111,8 +111,8 @@ ContextDeclarationSectionType ContextDeclaration::getSectionType(Chunk &chunk) {
}
ContextDeclaration::~ContextDeclaration() {
- delete contextName;
- contextName = nullptr;
+ delete _contextName;
+ _contextName = nullptr;
}
#pragma endregion
@@ -292,7 +292,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
uint32 unk = chunk.readUint16LE();
debugC(5, kDebugLoading, " - unk = 0x%x", unk);
_versionInfo = new VersionInfo(chunk);
- debugC(5, kDebugLoading, " - versionInfo = %d.%d.%d (%s)", _versionInfo->majorVersion, _versionInfo->minorVersion, _versionInfo->revision, _versionInfo->string->c_str());
+ debugC(5, kDebugLoading, " - versionInfo = %d.%d.%d (%s)", _versionInfo->_majorVersion, _versionInfo->_minorVersion, _versionInfo->_revision, _versionInfo->string->c_str());
_sourceString = Datum(chunk, kDatumTypeString).u.string;
debugC(5, kDebugLoading, " - sourceString = %s", _sourceString->c_str());
break;
@@ -327,8 +327,8 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
case kBootContextDeclaration: {
ContextDeclaration *contextDeclaration = new ContextDeclaration(chunk);
- while (!contextDeclaration->isLast) {
- _contextDeclarations.setVal(contextDeclaration->fileNumber, contextDeclaration);
+ while (!contextDeclaration->_isLast) {
+ _contextDeclarations.setVal(contextDeclaration->_fileNumber, contextDeclaration);
contextDeclaration = new ContextDeclaration(chunk);
}
break;
@@ -420,8 +420,8 @@ uint32 Boot::getRootContextId() {
// TODO: Is the ID of the root context actually stored somewhere so
// we don't need to find it ourselves? Maybe it is always the
for (auto &declaration : _contextDeclarations) {
- if (declaration._value->fileReferences.empty()) {
- return declaration._value->fileNumber;
+ if (declaration._value->_fileReferences.empty()) {
+ return declaration._value->_fileNumber;
}
}
return 0;
diff --git a/engines/mediastation/boot.h b/engines/mediastation/boot.h
index 0b7b12e1fb6..c5d3a5da4c3 100644
--- a/engines/mediastation/boot.h
+++ b/engines/mediastation/boot.h
@@ -37,9 +37,9 @@ public:
// The version number of this engine,
// in the form 4.0r8 (major . minor r revision).
- uint32 majorVersion;
- uint32 minorVersion;
- uint32 revision;
+ uint32 _majorVersion;
+ uint32 _minorVersion;
+ uint32 _revision;
// A textual description of this engine.
// Example: "Title Compiler T4.0r8 built Feb 13 1998 10:16:52"
@@ -62,11 +62,11 @@ public:
ContextDeclaration(Chunk &chunk);
~ContextDeclaration();
- Common::Array<uint32> fileReferences;
- uint32 fileNumber;
- Common::String *contextName;
+ Common::Array<uint32> _fileReferences;
+ uint32 _fileNumber;
+ Common::String *_contextName;
// Signal that there are no more declarations to read.
- bool isLast;
+ bool _isLast;
private:
ContextDeclarationSectionType getSectionType(Chunk &chunk);
diff --git a/engines/mediastation/chunk.cpp b/engines/mediastation/chunk.cpp
index 58d14785c82..d16cbc1eb48 100644
--- a/engines/mediastation/chunk.cpp
+++ b/engines/mediastation/chunk.cpp
@@ -26,12 +26,12 @@ namespace MediaStation {
Chunk::Chunk(Common::SeekableReadStream *stream) : _input(stream), _dataStartOffset(0), _dataEndOffset(0) {
// READ THE HEADER.
- id = _input->readUint32BE();
- length = _input->readUint32LE();
+ _id = _input->readUint32BE();
+ _length = _input->readUint32LE();
_dataStartOffset = pos();
- _dataEndOffset = _dataStartOffset + length;
- debugC(5, kDebugLoading, "Chunk::Chunk(): Got chunk with ID \"%s\" and size 0x%x", tag2str(id), length);
- if (length == 0) {
+ _dataEndOffset = _dataStartOffset + _length;
+ debugC(5, kDebugLoading, "Chunk::Chunk(): Got chunk with ID \"%s\" and size 0x%x", tag2str(_id), _length);
+ if (_length == 0) {
error("Encountered a zero-length chunk. This usually indicates corrupted data - maybe a CD-ROM read error.");
}
}
diff --git a/engines/mediastation/chunk.h b/engines/mediastation/chunk.h
index 63cb8e90793..46478bf981f 100644
--- a/engines/mediastation/chunk.h
+++ b/engines/mediastation/chunk.h
@@ -33,8 +33,8 @@ private:
uint32 _dataEndOffset = 0;
public:
- uint32 id = 0;
- uint32 length = 0;
+ uint32 _id = 0;
+ uint32 _length = 0;
Chunk() = default;
Chunk(Common::SeekableReadStream *stream);
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index 61caa03700c..260e1d17fc3 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -52,7 +52,7 @@ Context::Context(const Common::Path &path) :
readNewStyleHeaderSections(subfile, chunk);
}
// Then, read any asset data.
- chunk = subfile.currentChunk;
+ chunk = subfile._currentChunk;
while (!subfile.atEnd()) {
readAssetInFirstSubfile(chunk);
if (!subfile.atEnd()) {
@@ -61,7 +61,7 @@ Context::Context(const Common::Path &path) :
}
// Then, assets in the rest of the subfiles.
- for (uint i = 1; i < subfile_count; i++) {
+ for (uint i = 1; i < _subfileCount; i++) {
subfile = Subfile(_stream);
readAssetFromLaterSubfile(subfile);
}
@@ -83,13 +83,13 @@ bool Context::readPreamble() {
}
_stream->skip(2); // 0x00 0x00
- unk1 = _stream->readUint32LE();
- debugC(5, kDebugLoading, "Context::openFile(): unk1 = 0x%x", unk1);
+ _unk1 = _stream->readUint32LE();
+ debugC(5, kDebugLoading, "Context::openFile(): _unk1 = 0x%x", _unk1);
- subfile_count = _stream->readUint32LE();
+ _subfileCount = _stream->readUint32LE();
// The total size of this file, including this header.
// (Basically the true file size shown on the filesystem.)
- file_size = _stream->readUint32LE();
+ _fileSize = _stream->readUint32LE();
return true;
}
@@ -99,7 +99,7 @@ void Context::readOldStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
// READ THE PALETTE.
- bool moreSectionsToRead = (chunk.id == MKTAG('i', 'g', 'o', 'd'));
+ bool moreSectionsToRead = (chunk._id == MKTAG('i', 'g', 'o', 'd'));
if (!moreSectionsToRead) {
warning("Context::readNewStyleHeaderSections(): Got no header sections (@0x%llx)", static_cast<long long int>(chunk.pos()));
}
@@ -111,7 +111,7 @@ void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
debugC(5, kDebugLoading, "Context::readNewStyleHeaderSections(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
bool chunkIsHeader = (sectionType == 0x000d);
if (!chunkIsHeader) {
- error("Context::readNewStyleHeaderSections(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk.id), static_cast<long long int>(chunk.pos()));
+ error("Context::readNewStyleHeaderSections(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk._id), static_cast<long long int>(chunk.pos()));
}
// READ THIS HEADER SECTION.
@@ -121,35 +121,35 @@ void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
} else {
debugC(5, kDebugLoading, "\nContext::readNewStyleHeaderSections(): Getting next chunk (@0x%llx)", static_cast<long long int>(chunk.pos()));
chunk = subfile.nextChunk();
- moreSectionsToRead = (chunk.id == MKTAG('i', 'g', 'o', 'd'));
+ moreSectionsToRead = (chunk._id == MKTAG('i', 'g', 'o', 'd'));
}
}
debugC(5, kDebugLoading, "Context::readNewStyleHeaderSections(): Finished reading sections (@0x%llx)", static_cast<long long int>(chunk.pos()));
}
void Context::readAssetInFirstSubfile(Chunk &chunk) {
- if (chunk.id == MKTAG('i', 'g', 'o', 'd')) {
+ if (chunk._id == MKTAG('i', 'g', 'o', 'd')) {
warning("Context::readAssetInFirstSubfile(): Skippping \"igod\" asset link chunk");
chunk.skip(chunk.bytesRemaining());
return;
}
// TODO: Make sure this is not an asset link.
- Asset *asset = g_engine->_assetsByChunkReference.getValOrDefault(chunk.id);
+ Asset *asset = g_engine->_assetsByChunkReference.getValOrDefault(chunk._id);
if (asset == nullptr) {
- error("Context::readAssetInFirstSubfile(): Asset for chunk \"%s\" (0x%x) does not exist or has not been read yet in this title. (@0x%llx)", tag2str(chunk.id), chunk.id, static_cast<long long int>(chunk.pos()));
+ error("Context::readAssetInFirstSubfile(): Asset for chunk \"%s\" (0x%x) does not exist or has not been read yet in this title. (@0x%llx)", tag2str(chunk._id), chunk._id, static_cast<long long int>(chunk.pos()));
}
- debugC(5, kDebugLoading, "\nContext::readAssetInFirstSubfile(): Got asset with chunk ID %s in first subfile (type: 0x%x) (@0x%llx)", tag2str(chunk.id), asset->type(), static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "\nContext::readAssetInFirstSubfile(): Got asset with chunk ID %s in first subfile (type: 0x%x) (@0x%llx)", tag2str(chunk._id), asset->type(), static_cast<long long int>(chunk.pos()));
asset->readChunk(chunk);
}
void Context::readAssetFromLaterSubfile(Subfile &subfile) {
Chunk chunk = subfile.nextChunk();
- Asset *asset = g_engine->_assetsByChunkReference.getValOrDefault(chunk.id);
+ Asset *asset = g_engine->_assetsByChunkReference.getValOrDefault(chunk._id);
if (asset == nullptr) {
- error("Context::readAssetFromLaterSubfile(): Asset for chunk \"%s\" (0x%x) does not exist or has not been read yet in this title. (@0x%llx)", tag2str(chunk.id), chunk.id, static_cast<long long int>(chunk.pos()));
+ error("Context::readAssetFromLaterSubfile(): Asset for chunk \"%s\" (0x%x) does not exist or has not been read yet in this title. (@0x%llx)", tag2str(chunk._id), chunk._id, static_cast<long long int>(chunk.pos()));
}
- debugC(5, kDebugLoading, "\nContext::readAssetFromLaterSubfile(): Got asset with chunk ID %s in later subfile (type: 0x%x) (@0x%llx)", tag2str(chunk.id), asset->type(), static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "\nContext::readAssetFromLaterSubfile(): Got asset with chunk ID %s in later subfile (type: 0x%x) (@0x%llx)", tag2str(chunk._id), asset->type(), static_cast<long long int>(chunk.pos()));
asset->readSubfile(subfile, chunk);
}
diff --git a/engines/mediastation/context.h b/engines/mediastation/context.h
index bf8500acc38..b8c328d8286 100644
--- a/engines/mediastation/context.h
+++ b/engines/mediastation/context.h
@@ -48,9 +48,9 @@ public:
bool readPreamble();
- uint32 unk1;
- uint32 subfile_count;
- uint32 file_size;
+ uint32 _unk1;
+ uint32 _subfileCount;
+ uint32 _fileSize;
Graphics::Palette *_palette = nullptr;
ContextParameters *_parameters = nullptr;
AssetHeader *_screenAsset = nullptr;
diff --git a/engines/mediastation/contextparameters.cpp b/engines/mediastation/contextparameters.cpp
index 7cc340324fd..ac413e58227 100644
--- a/engines/mediastation/contextparameters.cpp
+++ b/engines/mediastation/contextparameters.cpp
@@ -27,18 +27,18 @@
namespace MediaStation {
-ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
- fileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
+ContextParameters::ContextParameters(Chunk &chunk) : _contextName(nullptr) {
+ _fileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
uint sectionType = static_cast<ContextParametersSectionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
while (sectionType != kContextParametersEmptySection) {
debugC(5, kDebugLoading, "ContextParameters::ContextParameters: sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
switch (sectionType) {
case kContextParametersName: {
uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
- if (repeatedFileNumber != fileNumber) {
- warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, fileNumber);
+ if (repeatedFileNumber != _fileNumber) {
+ warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
}
- contextName = Datum(chunk, kDatumTypeString).u.string;
+ _contextName = Datum(chunk, kDatumTypeString).u.string;
// TODO: This is likely just an end flag.
uint endingFlag = Datum(chunk, kDatumTypeUint16_1).u.i;
if (endingFlag != 0) {
@@ -54,18 +54,18 @@ ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
case kContextParametersVariable: {
uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
- if (repeatedFileNumber != fileNumber) {
- warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, fileNumber);
+ if (repeatedFileNumber != _fileNumber) {
+ warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
}
// The trouble here is converting the variable to an operand.
// They are two totally separate types!
Variable *variable = new Variable(chunk);
Operand operand;
- if (g_engine->_variables.contains(variable->id)) {
- error("ContextParameters::ContextParameters(): Variable with ID 0x%x already exists", variable->id);
+ if (g_engine->_variables.contains(variable->_id)) {
+ error("ContextParameters::ContextParameters(): Variable with ID 0x%x already exists", variable->_id);
} else {
- g_engine->_variables.setVal(variable->id, variable);
- debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Created global variable %d", variable->id);
+ g_engine->_variables.setVal(variable->_id, variable);
+ debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Created global variable %d", variable->_id);
}
break;
}
@@ -85,8 +85,8 @@ ContextParameters::ContextParameters(Chunk &chunk) : contextName(nullptr) {
}
ContextParameters::~ContextParameters() {
- delete contextName;
- contextName = nullptr;
+ delete _contextName;
+ _contextName = nullptr;
for (auto it = _functions.begin(); it != _functions.end(); ++it) {
delete it->_value;
diff --git a/engines/mediastation/contextparameters.h b/engines/mediastation/contextparameters.h
index 127a4d663ab..2bd95946f04 100644
--- a/engines/mediastation/contextparameters.h
+++ b/engines/mediastation/contextparameters.h
@@ -44,8 +44,8 @@ public:
// This is not an internal file ID, but the number of the file
// as it appears in the filename. For instance, the context in
// "100.cxt" would have file number 100.
- uint fileNumber;
- Common::String *contextName;
+ uint _fileNumber;
+ Common::String *_contextName;
Common::HashMap<uint32, Function *> _functions;
};
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 1cf5c2b6e1b..61ec738ba4a 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -237,23 +237,23 @@ void CodeChunk::putVariable(uint32 id, VariableScope scope, Operand value) {
switch (value.getType()) {
case kOperandTypeLiteral1:
case kOperandTypeLiteral2: {
- variable->value.i = value.getInteger();
+ variable->_value.i = value.getInteger();
break;
}
case kOperandTypeFloat1:
case kOperandTypeFloat2: {
- variable->value.d = value.getDouble();
+ variable->_value.d = value.getDouble();
break;
}
case kOperandTypeString: {
- variable->value.string = value.getString();
+ variable->_value.string = value.getString();
break;
}
case kOperandTypeAssetId: {
- variable->value.assetId = value.getAssetId();
+ variable->_value.assetId = value.getAssetId();
break;
}
diff --git a/engines/mediastation/mediascript/operand.cpp b/engines/mediastation/mediascript/operand.cpp
index 4b85c8331b3..56614097d83 100644
--- a/engines/mediastation/mediascript/operand.cpp
+++ b/engines/mediastation/mediascript/operand.cpp
@@ -35,7 +35,7 @@ void Operand::putInteger(int i) {
}
case kOperandTypeVariableDeclaration: {
- _u.variable->value.i = i;
+ _u.variable->_value.i = i;
break;
}
@@ -54,7 +54,7 @@ int Operand::getInteger() {
}
case kOperandTypeVariableDeclaration: {
- return _u.variable->value.i;
+ return _u.variable->_value.i;
}
default: {
@@ -73,7 +73,7 @@ void Operand::putDouble(double d) {
case kOperandTypeVariableDeclaration: {
// TODO: Add assertion.
- _u.variable->value.d = d;
+ _u.variable->_value.d = d;
break;
}
@@ -92,7 +92,7 @@ double Operand::getDouble() {
case kOperandTypeVariableDeclaration: {
// TODO: Add assertion that this is the proper type.
- return _u.variable->value.d;
+ return _u.variable->_value.d;
}
default: {
@@ -109,8 +109,8 @@ void Operand::putString(Common::String *string) {
}
case kOperandTypeVariableDeclaration: {
- assert(_u.variable->type == kVariableTypeString);
- _u.variable->value.string = string;
+ assert(_u.variable->_type == kVariableTypeString);
+ _u.variable->_value.string = string;
break;
}
@@ -127,8 +127,8 @@ Common::String *Operand::getString() {
}
case kOperandTypeVariableDeclaration: {
- assert(_u.variable->type == kVariableTypeString);
- return _u.variable->value.string;
+ assert(_u.variable->_type == kVariableTypeString);
+ return _u.variable->_value.string;
}
default: {
@@ -195,8 +195,8 @@ void Operand::putAsset(uint32 assetId) {
}
case kOperandTypeVariableDeclaration: {
- assert(_u.variable->type == kVariableTypeAssetId);
- _u.variable->value.assetId = assetId;
+ assert(_u.variable->_type == kVariableTypeAssetId);
+ _u.variable->_value.assetId = assetId;
break;
}
@@ -217,8 +217,8 @@ Asset *Operand::getAsset() {
}
case kOperandTypeVariableDeclaration: {
- assert(_u.variable->type == kVariableTypeAssetId);
- return g_engine->_assets.getVal(_u.variable->value.assetId);
+ assert(_u.variable->_type == kVariableTypeAssetId);
+ return g_engine->_assets.getVal(_u.variable->_value.assetId);
}
default: {
@@ -234,8 +234,8 @@ uint32 Operand::getAssetId() {
}
case kOperandTypeVariableDeclaration: {
- assert(_u.variable->type == kVariableTypeAssetId);
- return _u.variable->value.assetId;
+ assert(_u.variable->_type == kVariableTypeAssetId);
+ return _u.variable->_value.assetId;
}
default: {
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index 84fc84ec1e6..d65687c3eff 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -28,17 +28,17 @@
namespace MediaStation {
Variable::Variable(Chunk &chunk) {
- id = Datum(chunk, kDatumTypeUint16_1).u.i;
- type = VariableType(Datum(chunk, kDatumTypeUint8).u.i);
- debugC(5, kDebugLoading, "Variable::Variable(): id = 0x%x, type 0x%x (@0x%llx)", id, type, static_cast<long long int>(chunk.pos()));
- switch ((VariableType)type) {
+ _id = Datum(chunk, kDatumTypeUint16_1).u.i;
+ _type = VariableType(Datum(chunk, kDatumTypeUint8).u.i);
+ debugC(5, kDebugLoading, "Variable::Variable(): id = 0x%x, type 0x%x (@0x%llx)", _id, _type, static_cast<long long int>(chunk.pos()));
+ switch ((VariableType)_type) {
case kVariableTypeCollection: {
uint totalItems = Datum(chunk).u.i;
- value.collection = new Common::Array<Variable *>;
+ _value.collection = new Common::Array<Variable *>;
for (uint i = 0; i < totalItems; i++) {
debugC(7, kDebugLoading, "Variable::Variable(): COLLECTION: Value %d of %d", i, totalItems);
Variable *variableDeclaration = new Variable(chunk);
- value.collection->push_back(variableDeclaration);
+ _value.collection->push_back(variableDeclaration);
}
break;
}
@@ -49,63 +49,63 @@ Variable::Variable(Chunk &chunk) {
char *buffer = new char[size + 1];
chunk.read(buffer, size);
buffer[size] = '\0';
- value.string = new Common::String(buffer);
+ _value.string = new Common::String(buffer);
delete[] buffer;
- debugC(7, kDebugLoading, "Variable::Variable(): STRING: %s", value.string->c_str());
+ debugC(7, kDebugLoading, "Variable::Variable(): STRING: %s", _value.string->c_str());
break;
}
case kVariableTypeAssetId: {
- value.assetId = Datum(chunk, kDatumTypeUint16_1).u.i;
- debugC(7, kDebugLoading, "Variable::Variable(): ASSET ID: %d", value.assetId);
+ _value.assetId = Datum(chunk, kDatumTypeUint16_1).u.i;
+ debugC(7, kDebugLoading, "Variable::Variable(): ASSET ID: %d", _value.assetId);
break;
}
case kVariableTypeBoolean: {
uint rawValue = Datum(chunk, kDatumTypeUint8).u.i;
debugC(7, kDebugLoading, " Variable::Variable(): BOOL: %d", rawValue);
- value.b = (rawValue == 1);
+ _value.b = (rawValue == 1);
break;
}
case kVariableTypeLiteral: {
// Client code can worry about extracting the value.
- value.datum = new Datum(chunk);
+ _value.datum = new Datum(chunk);
debugC(7, kDebugLoading, "Variable::Variable(): LITERAL");
break;
}
default: {
- warning("Variable::Variable(): Got unknown variable value type 0x%x", type);
- value.datum = new Datum(chunk);
+ warning("Variable::Variable(): Got unknown variable value type 0x%x", _type);
+ _value.datum = new Datum(chunk);
}
}
}
Variable::~Variable() {
- switch (type) {
+ switch (_type) {
case kVariableTypeAssetId:
case kVariableTypeBoolean: {
break;
}
case kVariableTypeCollection: {
- delete value.collection;
+ delete _value.collection;
break;
}
case kVariableTypeString: {
- delete value.string;
+ delete _value.string;
break;
}
case kVariableTypeLiteral: {
- delete value.datum;
+ delete _value.datum;
break;
}
default: {
- delete value.datum;
+ delete _value.datum;
break;
}
}
diff --git a/engines/mediastation/mediascript/variable.h b/engines/mediastation/mediascript/variable.h
index cab36505c20..a85935d78fa 100644
--- a/engines/mediastation/mediascript/variable.h
+++ b/engines/mediastation/mediascript/variable.h
@@ -54,8 +54,8 @@ enum VariableType {
class Variable {
public:
- uint32 id = 0;
- VariableType type = kVariableTypeEmpty;
+ uint32 _id = 0;
+ VariableType _type = kVariableTypeEmpty;
union {
Datum *datum = nullptr;
Common::String *string;
@@ -64,7 +64,7 @@ public:
int i;
double d;
uint assetId;
- } value;
+ } _value;
Variable();
Variable(Chunk &chunk);
diff --git a/engines/mediastation/subfile.cpp b/engines/mediastation/subfile.cpp
index 5f40dd4cb89..afcf82d931d 100644
--- a/engines/mediastation/subfile.cpp
+++ b/engines/mediastation/subfile.cpp
@@ -31,10 +31,10 @@ Subfile::Subfile() : _stream(nullptr) {}
Subfile::Subfile(Common::SeekableReadStream *stream) : _stream(stream) {
// VERIFY FILE SIGNATURE.
debugC(5, kDebugLoading, "\n*** Subfile::Subfile(): Got new subfile (@0x%llx) ***", static_cast<long long int>(_stream->pos()));
- rootChunk = nextChunk();
- if (rootChunk.id != MKTAG('R', 'I', 'F', 'F'))
+ _rootChunk = nextChunk();
+ if (_rootChunk._id != MKTAG('R', 'I', 'F', 'F'))
// TODO: These need to be interpreted as ASCII.
- error("Subfile::Subfile(): Expected \"RIFF\" chunk, got %s", tag2str(rootChunk.id));
+ error("Subfile::Subfile(): Expected \"RIFF\" chunk, got %s", tag2str(_rootChunk._id));
_stream->skip(4); // IMTS
// READ RATE CHUNK.
@@ -42,29 +42,29 @@ Subfile::Subfile(Common::SeekableReadStream *stream) : _stream(stream) {
// (whatever that is). Usually it is zero.
// TODO: Figure out what this actually is.
Chunk rateChunk = nextChunk();
- if (rateChunk.id != MKTAG('r', 'a', 't', 'e'))
- error("Subfile::Subfile(): Expected \"rate\" chunk, got %s", tag2str(rootChunk.id));
- rate = _stream->readUint32LE();
+ if (rateChunk._id != MKTAG('r', 'a', 't', 'e'))
+ error("Subfile::Subfile(): Expected \"rate\" chunk, got %s", tag2str(_rootChunk._id));
+ _rate = _stream->readUint32LE();
// READ PAST LIST CHUNK.
nextChunk();
// QUEUE UP THE FIRST DATA CHUNK.
if (_stream->readUint32BE() != MKTAG('d', 'a', 't', 'a'))
- error("Subfile::Subfile(): Expected \"data\" as first bytes of subfile, got %s", tag2str(rateChunk.id));
+ error("Subfile::Subfile(): Expected \"data\" as first bytes of subfile, got %s", tag2str(rateChunk._id));
}
Chunk Subfile::nextChunk() {
// Chunks always start on even-indexed bytes.
if (_stream->pos() & 1)
_stream->skip(1);
- currentChunk = Chunk(_stream);
- return currentChunk;
+ _currentChunk = Chunk(_stream);
+ return _currentChunk;
}
bool Subfile::atEnd() {
// TODO: Is this the best place to put this and approach to use?
- return rootChunk.bytesRemaining() == 0;
+ return _rootChunk.bytesRemaining() == 0;
}
} // End of namespace MediaStation
diff --git a/engines/mediastation/subfile.h b/engines/mediastation/subfile.h
index 77e8291b862..43f41c81201 100644
--- a/engines/mediastation/subfile.h
+++ b/engines/mediastation/subfile.h
@@ -30,8 +30,8 @@ namespace MediaStation {
class Subfile {
public:
- Chunk rootChunk;
- Chunk currentChunk;
+ Chunk _rootChunk;
+ Chunk _currentChunk;
Subfile();
Subfile(Common::SeekableReadStream *stream);
@@ -39,7 +39,7 @@ public:
Chunk nextChunk();
bool atEnd();
- uint32 rate;
+ uint32 _rate;
private:
Common::SeekableReadStream *_stream;
Commit: 8492662279c62824a11c33bbb70fc1850cd91779
https://github.com/scummvm/scummvm/commit/8492662279c62824a11c33bbb70fc1850cd91779
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-04T18:15:58-05:00
Commit Message:
MEDIASTATION: Static cast enum values printed as integers
Changed paths:
engines/mediastation/asset.cpp
engines/mediastation/assetheader.cpp
engines/mediastation/assets/movie.cpp
engines/mediastation/assets/sound.cpp
engines/mediastation/bitmap.cpp
engines/mediastation/boot.cpp
engines/mediastation/context.cpp
engines/mediastation/contextparameters.cpp
engines/mediastation/datum.cpp
engines/mediastation/mediascript/codechunk.cpp
engines/mediastation/mediascript/eventhandler.cpp
engines/mediastation/mediascript/operand.cpp
engines/mediastation/mediascript/variable.cpp
diff --git a/engines/mediastation/asset.cpp b/engines/mediastation/asset.cpp
index f8f05492619..6f7104e0320 100644
--- a/engines/mediastation/asset.cpp
+++ b/engines/mediastation/asset.cpp
@@ -29,11 +29,11 @@ Asset::~Asset() {
}
void Asset::readChunk(Chunk &chunk) {
- error("Asset::readChunk(): Chunk reading for asset type 0x%x is not implemented", _header->_type);
+ error("Asset::readChunk(): Chunk reading for asset type 0x%x is not implemented", static_cast<uint>(_header->_type));
}
void Asset::readSubfile(Subfile &subfile, Chunk &chunk) {
- error("Asset::readSubfile(): Subfile reading for asset type 0x%x is not implemented", _header->_type);
+ error("Asset::readSubfile(): Subfile reading for asset type 0x%x is not implemented", static_cast<uint>(_header->_type));
}
AssetType Asset::type() const {
diff --git a/engines/mediastation/assetheader.cpp b/engines/mediastation/assetheader.cpp
index ee96c491640..e1f7036f862 100644
--- a/engines/mediastation/assetheader.cpp
+++ b/engines/mediastation/assetheader.cpp
@@ -32,7 +32,7 @@ AssetHeader::AssetHeader(Chunk &chunk) {
// TODO: Cast to an asset type.
_type = AssetType(Datum(chunk).u.i);
_id = Datum(chunk).u.i;
- debugC(4, kDebugLoading, "AssetHeader::AssetHeader(): _type = 0x%x, _id = 0x%x (@0x%llx)", _type, _id, static_cast<long long int>(chunk.pos()));
+ debugC(4, kDebugLoading, "AssetHeader::AssetHeader(): _type = 0x%x, _id = 0x%x (@0x%llx)", static_cast<uint>(_type), _id, static_cast<long long int>(chunk.pos()));
AssetHeaderSectionType sectionType = getSectionType(chunk);
bool moreSectionsToRead = (kAssetHeaderEmptySection != sectionType);
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index 4b64400444a..ae5b007cb96 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -345,7 +345,7 @@ void Movie::readChunk(Chunk &chunk) {
void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
// READ THE METADATA FOR THE WHOLE MOVIE.
uint expectedRootSectionType = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", expectedRootSectionType, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(expectedRootSectionType), static_cast<long long int>(chunk.pos()));
if (kMovieRootSection != (MovieSectionType)expectedRootSectionType) {
error("Expected ROOT section type, got 0x%x", expectedRootSectionType);
}
@@ -377,7 +377,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
MovieFrame *frame = nullptr;
while (isAnimationChunk) {
uint sectionType = Datum(chunk).u.i;
- debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
switch (MovieSectionType(sectionType)) {
case kMovieFrameSection: {
header = new MovieFrameHeader(chunk);
@@ -404,7 +404,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
}
default: {
- error("Movie::readSubfile(): Unknown movie animation section type 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ error("Movie::readSubfile(): Unknown movie animation section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
}
}
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index 3e09348e17a..9a6dce6e98a 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -54,7 +54,7 @@ void Sound::process() {
void Sound::readChunk(Chunk &chunk) {
// TODO: Can we read the chunk directly into the audio stream?
- debugC(5, kDebugLoading, "Sound::readChunk(): (encoding = 0x%x) Reading audio chunk (@0x%llx)", (uint)_encoding, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "Sound::readChunk(): (encoding = 0x%x) Reading audio chunk (@0x%llx)", static_cast<uint>(_encoding), static_cast<long long int>(chunk.pos()));
byte *buffer = (byte *)malloc(chunk._length);
chunk.read((void *)buffer, chunk._length);
diff --git a/engines/mediastation/bitmap.cpp b/engines/mediastation/bitmap.cpp
index c3f93e92240..bdd4b24ae49 100644
--- a/engines/mediastation/bitmap.cpp
+++ b/engines/mediastation/bitmap.cpp
@@ -30,7 +30,7 @@ BitmapHeader::BitmapHeader(Chunk &chunk) {
debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): headerSize = 0x%x", headerSizeInBytes);
_dimensions = Datum(chunk).u.point;
_compressionType = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
- debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", _compressionType);
+ debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", static_cast<uint>(_compressionType));
// TODO: Figure out what this is.
// This has something to do with the width of the bitmap but is always
// a few pixels off from the width. And in rare cases it seems to be
diff --git a/engines/mediastation/boot.cpp b/engines/mediastation/boot.cpp
index b8b135b50d3..f2d2eeae5b9 100644
--- a/engines/mediastation/boot.cpp
+++ b/engines/mediastation/boot.cpp
@@ -68,7 +68,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
if (kContextDeclarationFileNumber1 == sectionType) {
_fileNumber = Datum(chunk).u.i;
} else {
- error("ContextDeclaration(): Expected section type FILE_NUMBER_1, got 0x%x", sectionType);
+ error("ContextDeclaration(): Expected section type FILE_NUMBER_1, got 0x%x", static_cast<uint>(sectionType));
}
// I don't know why the file number is always repeated.
// Is it just for data integrity, or is there some other reason?
@@ -79,7 +79,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
warning("ContextDeclaration(): Expected file numbers to match, but 0x%d != 0x%d", _fileNumber, repeatedFileNumber);
}
} else {
- error("ContextDeclaration(): Expected section type FILE_NUMBER_2, got 0x%x", sectionType);
+ error("ContextDeclaration(): Expected section type FILE_NUMBER_2, got 0x%x", static_cast<uint>(sectionType));
}
// READ THE CONTEXT NAME.
@@ -100,7 +100,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
} else if (kContextDeclarationEmptySection == sectionType) {
_isLast = true;
} else {
- error("ContextDeclaration::ContextDeclaration(): Unknown section type 0x%x", sectionType);
+ error("ContextDeclaration::ContextDeclaration(): Unknown section type 0x%x", static_cast<uint>(sectionType));
}
}
@@ -133,7 +133,7 @@ UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
if (kUnknownDeclarationUnk1 == sectionType) {
_unk = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
- error("UnknownDeclaration(): Expected section type UNK_1, got 0x%x", sectionType);
+ error("UnknownDeclaration(): Expected section type UNK_1, got 0x%x", static_cast<uint>(sectionType));
}
sectionType = getSectionType(chunk);
if (kUnknownDeclarationUnk2 == sectionType) {
@@ -142,7 +142,7 @@ UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
warning("UnknownDeclaration(): Expected unknown values to match, but 0x%x != 0x%x", _unk, repeatedUnk);
}
} else {
- error("UnknownDeclaration(): Expected section type UNK_2, got 0x%x", sectionType);
+ error("UnknownDeclaration(): Expected section type UNK_2, got 0x%x", static_cast<uint>(sectionType));
}
}
@@ -170,7 +170,7 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
if (kFileDeclarationFileId == sectionType) {
_id = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
- error("FileDeclaration(): Expected section type FILE_ID, got 0x%x", sectionType);
+ error("FileDeclaration(): Expected section type FILE_ID, got 0x%x", static_cast<uint>(sectionType));
}
// READ THE INTENDED LOCATION OF THE FILE.
@@ -180,7 +180,7 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
// TODO: Verify we actually read a valid enum member.
_intendedLocation = static_cast<IntendedFileLocation>(datum.u.i);
} else {
- error("FileDeclaration(): Expected section type FILE_NAME_AND_TYPE, got 0x%x", sectionType);
+ error("FileDeclaration(): Expected section type FILE_NAME_AND_TYPE, got 0x%x", static_cast<uint>(sectionType));
}
// READ THE CASE-INSENSITIVE FILENAME.
@@ -219,7 +219,7 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
if (kSubfileDeclarationAssetId == sectionType) {
_assetId = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
- error("SubfileDeclaration(): Expected section type ASSET_ID, got 0x%x", sectionType);
+ error("SubfileDeclaration(): Expected section type ASSET_ID, got 0x%x", static_cast<uint>(sectionType));
}
// READ THE FILE ID.
@@ -227,7 +227,7 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
if (kSubfileDeclarationFileId == sectionType) {
_fileId = Datum(chunk, kDatumTypeUint16_1).u.i;
} else {
- error("SubfileDeclaration(): Expected section type FILE_ID, got 0x%x", sectionType);
+ error("SubfileDeclaration(): Expected section type FILE_ID, got 0x%x", static_cast<uint>(sectionType));
}
// READ THE START OFFSET IN THE GIVEN FILE.
@@ -236,7 +236,7 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
if (kSubfileDeclarationStartOffset == sectionType) {
_startOffsetInFile = Datum(chunk, kDatumTypeUint32_1).u.i;
} else {
- error("SubfileDeclaration(): Expected section type START_OFFSET, got 0x%x", sectionType);
+ error("SubfileDeclaration(): Expected section type START_OFFSET, got 0x%x", static_cast<uint>(sectionType));
}
}
@@ -284,7 +284,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
BootSectionType sectionType = getSectionType(chunk);
bool notLastSection = (kBootLastSection != sectionType);
while (notLastSection) {
- debugC(5, kDebugLoading, "Boot::Boot(): sectionType = 0x%x", sectionType);
+ debugC(5, kDebugLoading, "Boot::Boot(): sectionType = 0x%x", static_cast<uint>(sectionType));
switch (sectionType) {
case kBootVersionInformation: {
_gameTitle = Datum(chunk, kDatumTypeString).u.string;
@@ -320,7 +320,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
EngineResourceDeclaration *resourceDeclaration = new EngineResourceDeclaration(resourceName, resourceId);
_engineResourceDeclarations.setVal(resourceId, resourceDeclaration);
} else {
- error("Boot::Boot(): Got section type 0x%x when expecting ENGINE_RESOURCE_ID", sectionType);
+ error("Boot::Boot(): Got section type 0x%x when expecting ENGINE_RESOURCE_ID", static_cast<uint>(sectionType));
}
break;
}
@@ -400,7 +400,7 @@ Boot::Boot(const Common::Path &path) : Datafile(path) {
}
default: {
- warning("Boot::Boot(): Unknown section type 0x%x", sectionType);
+ warning("Boot::Boot(): Unknown section type 0x%x", static_cast<uint>(sectionType));
break;
}
}
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index 260e1d17fc3..2da76450c4e 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -108,7 +108,7 @@ void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
// VERIFY THIS CHUNK IS A HEADER.
// TODO: What are the situations when it's not?
uint16 sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
- debugC(5, kDebugLoading, "Context::readNewStyleHeaderSections(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "Context::readNewStyleHeaderSections(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
bool chunkIsHeader = (sectionType == 0x000d);
if (!chunkIsHeader) {
error("Context::readNewStyleHeaderSections(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk._id), static_cast<long long int>(chunk.pos()));
@@ -139,7 +139,7 @@ void Context::readAssetInFirstSubfile(Chunk &chunk) {
if (asset == nullptr) {
error("Context::readAssetInFirstSubfile(): Asset for chunk \"%s\" (0x%x) does not exist or has not been read yet in this title. (@0x%llx)", tag2str(chunk._id), chunk._id, static_cast<long long int>(chunk.pos()));
}
- debugC(5, kDebugLoading, "\nContext::readAssetInFirstSubfile(): Got asset with chunk ID %s in first subfile (type: 0x%x) (@0x%llx)", tag2str(chunk._id), asset->type(), static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "\nContext::readAssetInFirstSubfile(): Got asset with chunk ID %s in first subfile (type: 0x%x) (@0x%llx)", tag2str(chunk._id), static_cast<uint>(asset->type()), static_cast<long long int>(chunk.pos()));
asset->readChunk(chunk);
}
@@ -155,7 +155,7 @@ void Context::readAssetFromLaterSubfile(Subfile &subfile) {
bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
uint16 sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
- debugC(5, kDebugLoading, "Context::readHeaderSection(): sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "Context::readHeaderSection(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
switch (sectionType) {
case kContextParametersSection: {
if (_parameters != nullptr) {
@@ -290,7 +290,7 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
}
default: {
- error("Context::readHeaderSection(): Unknown section type 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ error("Context::readHeaderSection(): Unknown section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
}
}
diff --git a/engines/mediastation/contextparameters.cpp b/engines/mediastation/contextparameters.cpp
index ac413e58227..a691a4df5ea 100644
--- a/engines/mediastation/contextparameters.cpp
+++ b/engines/mediastation/contextparameters.cpp
@@ -31,7 +31,7 @@ ContextParameters::ContextParameters(Chunk &chunk) : _contextName(nullptr) {
_fileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
uint sectionType = static_cast<ContextParametersSectionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
while (sectionType != kContextParametersEmptySection) {
- debugC(5, kDebugLoading, "ContextParameters::ContextParameters: sectionType = 0x%x (@0x%llx)", sectionType, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "ContextParameters::ContextParameters: sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
switch (sectionType) {
case kContextParametersName: {
uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
@@ -77,7 +77,7 @@ ContextParameters::ContextParameters(Chunk &chunk) : _contextName(nullptr) {
}
default: {
- error("ContextParameters::ContextParameters(): Unknown section type 0x%x", sectionType);
+ error("ContextParameters::ContextParameters(): Unknown section type 0x%x", static_cast<uint>(sectionType));
}
}
sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
diff --git a/engines/mediastation/datum.cpp b/engines/mediastation/datum.cpp
index bdcca95cfa5..a591513984c 100644
--- a/engines/mediastation/datum.cpp
+++ b/engines/mediastation/datum.cpp
@@ -45,7 +45,7 @@ Datum::Datum(Common::SeekableReadStream &chunk, DatumType expectedType) {
}
void Datum::readWithType(Common::SeekableReadStream &chunk) {
- debugC(9, kDebugLoading, "Datum::Datum(): Type 0x%x (@0x%llx)", t, static_cast<long long int>(chunk.pos()));
+ debugC(9, kDebugLoading, "Datum::Datum(): Type 0x%x (@0x%llx)", static_cast<uint>(t), static_cast<long long int>(chunk.pos()));
if (kDatumTypeUint8 == t) {
u.i = chunk.readByte();
@@ -97,7 +97,7 @@ void Datum::readWithType(Common::SeekableReadStream &chunk) {
u.chunkRef = chunk.readUint32BE();
} else {
- error("Unknown datum type: 0x%x (@0x%llx)", t, static_cast<long long int>(chunk.pos()));
+ error("Unknown datum type: 0x%x (@0x%llx)", static_cast<uint>(t), static_cast<long long int>(chunk.pos()));
}
}
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 61ec738ba4a..a4b118d3dba 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -59,7 +59,7 @@ Operand CodeChunk::executeNextStatement() {
}
InstructionType instructionType = InstructionType(Datum(*_bytecode).u.i);
- debugC(8, kDebugScript, " instructionType = %d", (uint)instructionType);
+ debugC(8, kDebugScript, " instructionType = %d", static_cast<uint>(instructionType));
switch (instructionType) {
case kInstructionTypeEmpty: {
return Operand();
@@ -67,14 +67,14 @@ Operand CodeChunk::executeNextStatement() {
case kInstructionTypeFunctionCall: {
Opcode opcode = Opcode(Datum(*_bytecode).u.i);
- debugC(8, kDebugScript, " *** Opcode %d ***", (uint)opcode);
+ debugC(8, kDebugScript, " *** Opcode %d ***", static_cast<uint>(opcode));
switch (opcode) {
case kOpcodeAssignVariable: {
uint32 id = Datum(*_bytecode).u.i;
VariableScope scope = VariableScope(Datum(*_bytecode).u.i);
Operand newValue = executeNextStatement();
// TODO: Print the new variable value for easier debugging.
- debugC(5, kDebugScript, "SCRIPT: [ %d (scope: %d) ] = [ ? (showing value assigned to var not implemented yet) ]", (uint)scope, id);
+ debugC(5, kDebugScript, "SCRIPT: [ %d (scope: %d) ] = [ ? (showing value assigned to var not implemented yet) ]", static_cast<uint>(scope), id);
putVariable(id, scope, newValue);
return Operand();
}
@@ -106,7 +106,7 @@ Operand CodeChunk::executeNextStatement() {
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)", selfObject.getType());
+ 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++) {
@@ -150,7 +150,7 @@ Operand CodeChunk::executeNextStatement() {
case (kInstructionTypeOperand): {
OperandType operandType = OperandType(Datum(*_bytecode).u.i);
- debugC(8, kDebugScript, " *** Operand %d ***", (uint)operandType);
+ debugC(8, kDebugScript, " *** Operand %d ***", static_cast<uint>(operandType));
Operand operand(operandType);
switch (operandType) {
// TODO: Add clearer debugging printouts for these.
@@ -191,7 +191,7 @@ Operand CodeChunk::executeNextStatement() {
}
default: {
- error("CodeChunk::getNextStatement(): Got unknown instruction type 0x%x", instructionType);
+ error("CodeChunk::getNextStatement(): Got unknown instruction type 0x%x", static_cast<uint>(instructionType));
}
}
}
diff --git a/engines/mediastation/mediascript/eventhandler.cpp b/engines/mediastation/mediascript/eventhandler.cpp
index 7d089caaaba..3086de74c98 100644
--- a/engines/mediastation/mediascript/eventhandler.cpp
+++ b/engines/mediastation/mediascript/eventhandler.cpp
@@ -26,9 +26,9 @@ namespace MediaStation {
EventHandler::EventHandler(Chunk &chunk) {
_type = static_cast<EventType>(Datum(chunk).u.i);
- debugC(5, kDebugLoading, "EventHandler::EventHandler(): Type 0x%x (@0x%llx)", _type, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "EventHandler::EventHandler(): Type 0x%x (@0x%llx)", static_cast<uint>(_type), static_cast<long long int>(chunk.pos()));
_argumentType = static_cast<EventHandlerArgumentType>(Datum(chunk).u.i);
- debugC(5, kDebugLoading, "EventHandler::EventHandler(): Argument type 0x%x (@0x%llx)", _argumentType, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "EventHandler::EventHandler(): Argument type 0x%x (@0x%llx)", static_cast<uint>(_argumentType), static_cast<long long int>(chunk.pos()));
_argumentValue = Datum(chunk);
if (_argumentType != kNullEventHandlerArgument) {
@@ -44,23 +44,23 @@ Operand EventHandler::execute(uint assetId) {
// a better way to handle that.
switch (_argumentType) {
case kNullEventHandlerArgument: {
- debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (no argument) **********", assetId, (uint)_type);
+ debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (no argument) **********", assetId, static_cast<uint>(_type));
break;
}
case kAsciiCodeEventHandlerArgument: {
- debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (ASCII code = %d) **********", assetId, (uint)_type, _argumentValue.u.i);
+ debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (ASCII code = %d) **********", assetId, static_cast<uint>(_type), _argumentValue.u.i);
break;
}
case kContextEventHandlerArgument: {
- debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (context = %d) **********", assetId, (uint)_type, _argumentValue.u.i);
+ debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (context = %d) **********", assetId, static_cast<uint>(_type), _argumentValue.u.i);
break;
}
case kTimeEventHandlerArgument:
case kUnk1EventHandlerArgument: {
- debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (time = %f) **********", assetId, (uint)_type, _argumentValue.u.f);
+ debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %d) (time = %f) **********", assetId, static_cast<uint>(_type), _argumentValue.u.f);
break;
}
}
diff --git a/engines/mediastation/mediascript/operand.cpp b/engines/mediastation/mediascript/operand.cpp
index 56614097d83..0ca729b8217 100644
--- a/engines/mediastation/mediascript/operand.cpp
+++ b/engines/mediastation/mediascript/operand.cpp
@@ -40,7 +40,7 @@ void Operand::putInteger(int i) {
}
default: {
- error("Operand::putInteger(): Attempt to put unsupported value into operand (type 0x%x)", _type);
+ error("Operand::putInteger(): Attempt to put unsupported value into operand (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -58,7 +58,7 @@ int Operand::getInteger() {
}
default: {
- error("Operand::getInteger(): Attempt to get unsupported value from operand (type 0x%x)", _type);
+ error("Operand::getInteger(): Attempt to get unsupported value from operand (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -78,7 +78,7 @@ void Operand::putDouble(double d) {
}
default: {
- error("Operand::putDouble(): Attempt to put unsupported value in operand (type 0x%x)", _type);
+ error("Operand::putDouble(): Attempt to put unsupported value in operand (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -96,7 +96,7 @@ double Operand::getDouble() {
}
default: {
- error("Operand::getDouble(): Attempt to get unsupported value from operand (type 0x%x)", _type);
+ error("Operand::getDouble(): Attempt to get unsupported value from operand (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -115,7 +115,7 @@ void Operand::putString(Common::String *string) {
}
default: {
- error("Operand::putString(): Attempt to put unsupported value into operand (type 0x%x)", _type);
+ error("Operand::putString(): Attempt to put unsupported value into operand (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -132,7 +132,7 @@ Common::String *Operand::getString() {
}
default: {
- error("Operand::getString(): Attempt to get unsupported value from operand (type 0x%x)", _type);
+ error("Operand::getString(): Attempt to get unsupported value from operand (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -145,7 +145,7 @@ void Operand::putVariable(Variable *variable) {
}
default: {
- error("Operand::putVariable(): Attempt to put unsupported value into operand that is not a variable (type 0x%x)", _type);
+ error("Operand::putVariable(): Attempt to put unsupported value into operand that is not a variable (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -157,7 +157,7 @@ Variable *Operand::getVariable() {
}
default: {
- error("Operand::getVariable(): Attempt to get unsupported value from operand that is not a variable (type 0x%x)", _type);
+ error("Operand::getVariable(): Attempt to get unsupported value from operand that is not a variable (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -170,7 +170,7 @@ void Operand::putFunction(Function *function) {
}
default: {
- error("Operand::putFunction(): Attempt to put unsupported value into operand that is not a function (type 0x%x)", _type);
+ error("Operand::putFunction(): Attempt to put unsupported value into operand that is not a function (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -182,7 +182,7 @@ Function *Operand::getFunction() {
}
default: {
- error("Operand::getFunction(): Attempt to get unsupported value from operand that is not a function (type 0x%x)", _type);
+ error("Operand::getFunction(): Attempt to get unsupported value from operand that is not a function (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -201,7 +201,7 @@ void Operand::putAsset(uint32 assetId) {
}
default: {
- error("Operand::putAsset(): Attempt to put asset into operand that is not an asset (type 0x%x)", _type);
+ error("Operand::putAsset(): Attempt to put asset into operand that is not an asset (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -222,7 +222,7 @@ Asset *Operand::getAsset() {
}
default: {
- error("Operand::getAsset(): Attempt to get asset from operand that is not an asset (type 0x%x)", _type);
+ error("Operand::getAsset(): Attempt to get asset from operand that is not an asset (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -239,7 +239,7 @@ uint32 Operand::getAssetId() {
}
default: {
- error("Operand::getAssetId(): Attempt to get asset ID from operand that is not an asset (type 0x%x)", _type);
+ error("Operand::getAssetId(): Attempt to get asset ID from operand that is not an asset (type 0x%x)", static_cast<uint>(_type));
}
}
}
@@ -253,7 +253,7 @@ Operand Operand::operator-(const Operand &other) const {
returnValue._type = kOperandTypeFloat1;
returnValue._u.d = this->_u.d - other._u.d;
} else {
- error("Operand::operator-(): Unsupported operand types %d and %d", this->_type, other._type);
+ error("Operand::operator-(): Unsupported operand types %d and %d", static_cast<uint>(this->_type), static_cast<uint>(other._type));
}
return returnValue;
}
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index d65687c3eff..4ebe62580c4 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -30,7 +30,7 @@ namespace MediaStation {
Variable::Variable(Chunk &chunk) {
_id = Datum(chunk, kDatumTypeUint16_1).u.i;
_type = VariableType(Datum(chunk, kDatumTypeUint8).u.i);
- debugC(5, kDebugLoading, "Variable::Variable(): id = 0x%x, type 0x%x (@0x%llx)", _id, _type, static_cast<long long int>(chunk.pos()));
+ debugC(5, kDebugLoading, "Variable::Variable(): id = 0x%x, type 0x%x (@0x%llx)", _id, static_cast<uint>(_type), static_cast<long long int>(chunk.pos()));
switch ((VariableType)_type) {
case kVariableTypeCollection: {
uint totalItems = Datum(chunk).u.i;
@@ -76,7 +76,7 @@ Variable::Variable(Chunk &chunk) {
}
default: {
- warning("Variable::Variable(): Got unknown variable value type 0x%x", _type);
+ warning("Variable::Variable(): Got unknown variable value type 0x%x", static_cast<uint>(_type));
_value.datum = new Datum(chunk);
}
}
More information about the Scummvm-git-logs
mailing list