aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/controls.cpp2
-rw-r--r--engines/macventure/controls.h2
-rw-r--r--engines/macventure/detection.cpp8
-rw-r--r--engines/macventure/dialog.cpp6
-rw-r--r--engines/macventure/dialog.h6
-rw-r--r--engines/macventure/gui.cpp32
-rw-r--r--engines/macventure/gui.h3
-rw-r--r--engines/macventure/image.cpp47
-rw-r--r--engines/macventure/image.h8
-rw-r--r--engines/macventure/macventure.cpp21
-rw-r--r--engines/macventure/macventure.h8
-rw-r--r--engines/macventure/saveload.cpp3
-rw-r--r--engines/macventure/script.cpp235
-rw-r--r--engines/macventure/script.h6
-rw-r--r--engines/macventure/sound.cpp6
-rw-r--r--engines/macventure/stringtable.h2
-rw-r--r--engines/macventure/text.cpp2
-rw-r--r--engines/macventure/world.cpp17
18 files changed, 216 insertions, 198 deletions
diff --git a/engines/macventure/controls.cpp b/engines/macventure/controls.cpp
index 898ddac8e8..078ea88dce 100644
--- a/engines/macventure/controls.cpp
+++ b/engines/macventure/controls.cpp
@@ -59,7 +59,7 @@ bool CommandButton::isInsideBounds(const Common::Point point) const {
return _data.bounds.contains(point);
}
-const ControlData& CommandButton::getData() const {
+const ControlData &CommandButton::getData() const {
return _data;
}
diff --git a/engines/macventure/controls.h b/engines/macventure/controls.h
index 0adbf06a9f..81b5278396 100644
--- a/engines/macventure/controls.h
+++ b/engines/macventure/controls.h
@@ -90,7 +90,7 @@ public:
void draw(Graphics::ManagedSurface &surface) const;
bool isInsideBounds(const Common::Point point) const;
- const ControlData& getData() const;
+ const ControlData &getData() const;
void select();
void unselect();
bool isSelected();
diff --git a/engines/macventure/detection.cpp b/engines/macventure/detection.cpp
index d0a2940269..9329a9a185 100644
--- a/engines/macventure/detection.cpp
+++ b/engines/macventure/detection.cpp
@@ -54,14 +54,14 @@ public:
_md5Bytes = 5000000; // TODO: Upper limit, adjust it once all games are added
}
- virtual const char * getName() const override {
+ virtual const char *getName() const override {
return "MacVenture";
}
- virtual const char * getOriginalCopyright() const override {
+ virtual const char *getOriginalCopyright() const override {
return "(C) ICOM Simulations";
}
- virtual bool createInstance(OSystem * syst, Engine ** engine, const ADGameDescription * desc) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
virtual bool hasFeature(MetaEngineFeature f) const;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const;
@@ -121,7 +121,7 @@ SaveStateList MacVentureMetaEngine::listSaves(const char *target) const {
int MacVentureMetaEngine::getMaximumSaveSlot() const { return 999; }
-bool MacVentureMetaEngine::createInstance(OSystem * syst, Engine ** engine, const ADGameDescription *game) const {
+bool MacVentureMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *game) const {
if (game) {
*engine = new MacVenture::MacVentureEngine(syst, game);
}
diff --git a/engines/macventure/dialog.cpp b/engines/macventure/dialog.cpp
index 383befc1b8..7827bddffd 100644
--- a/engines/macventure/dialog.cpp
+++ b/engines/macventure/dialog.cpp
@@ -74,7 +74,7 @@ void Dialog::handleDialogAction(DialogElement *trigger, DialogAction action) {
}
}
-const Graphics::Font& Dialog::getFont() {
+const Graphics::Font &Dialog::getFont() {
return _gui->getCurrentFont();
}
@@ -161,11 +161,11 @@ void DialogElement::draw(MacVenture::Dialog *dialog, Graphics::ManagedSurface &t
doDraw(dialog, target);
}
-const Common::String& DialogElement::getText() {
+const Common::String &DialogElement::getText() {
return doGetText();
}
-const Common::String& DialogElement::doGetText() {
+const Common::String &DialogElement::doGetText() {
return _text;
}
diff --git a/engines/macventure/dialog.h b/engines/macventure/dialog.h
index 7e85ccc2ba..67331d7eb3 100644
--- a/engines/macventure/dialog.h
+++ b/engines/macventure/dialog.h
@@ -46,7 +46,7 @@ public:
void localize(Common::Point &point);
void handleDialogAction(DialogElement *trigger, DialogAction action);
- const Graphics::Font& getFont();
+ const Graphics::Font &getFont();
void addButton(Common::String title, DialogAction action, Common::Point position, uint width = 0, uint height = 0);
void addText(Common::String content, Common::Point position);
@@ -74,12 +74,12 @@ public:
bool processEvent(Dialog *dialog, Common::Event event);
void draw(MacVenture::Dialog *dialog, Graphics::ManagedSurface &target);
- const Common::String& getText();
+ const Common::String &getText();
private:
virtual bool doProcessEvent(Dialog *dialog, Common::Event event) = 0;
virtual void doDraw(MacVenture::Dialog *dialog, Graphics::ManagedSurface &target) = 0;
- virtual const Common::String& doGetText();
+ virtual const Common::String &doGetText();
protected:
Common::String _text;
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index f4cb8eeb6f..d0af4ed51f 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -249,11 +249,11 @@ void Gui::initWindows() {
loadBorders(_exitsWindow, findWindowData(kExitsWindow).type);
}
-const WindowData& Gui::getWindowData(WindowReference reference) {
+const WindowData &Gui::getWindowData(WindowReference reference) {
return findWindowData(reference);
}
-const Graphics::Font& Gui::getCurrentFont() {
+const Graphics::Font &Gui::getCurrentFont() {
return *_wm.getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
}
@@ -351,12 +351,12 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) {
return newData.refcon;
}
-void Gui::loadBorders(Graphics::MacWindow * target, MVWindowType type) {
+void Gui::loadBorders(Graphics::MacWindow *target, MVWindowType type) {
loadBorder(target, type, false);
loadBorder(target, type, true);
}
-void Gui::loadBorder(Graphics::MacWindow * target, MVWindowType type, bool active) {
+void Gui::loadBorder(Graphics::MacWindow *target, MVWindowType type, bool active) {
Common::SeekableReadStream *stream = _engine->getBorderFile(type, active);
@@ -405,7 +405,7 @@ bool Gui::loadMenus() {
uint16 key;
uint16 style;
uint8 titleLength;
- char* title;
+ char *title;
/* Skip menuID, width, height, resourceID, placeholder */
for (int skip = 0; skip < 5; skip++) { res->readUint16BE(); }
@@ -474,7 +474,7 @@ bool Gui::loadWindows() {
res->readUint32BE(); // Skip the true id. For some reason it's reading 0
data.titleLength = res->readByte();
if (data.titleLength) {
- char* newTitle = new char[data.titleLength + 1];
+ char *newTitle = new char[data.titleLength + 1];
res->read(newTitle, data.titleLength);
newTitle[data.titleLength] = '\0';
data.title = Common::String(newTitle);
@@ -721,7 +721,7 @@ void Gui::drawObjectsInWindow(const WindowData &targetData, Graphics::ManagedSur
surface->transBlitFrom(composeSurface, composePosition, kColorGreen);
}
-void Gui::drawWindowTitle(WindowReference target, Graphics::ManagedSurface * surface) {
+void Gui::drawWindowTitle(WindowReference target, Graphics::ManagedSurface *surface) {
WindowData &data = findWindowData(target);
BorderBounds border = borderBounds(data.type);
@@ -881,7 +881,7 @@ void Gui::updateExit(ObjID obj) {
}
}
-void Gui::printText(const Common::String & text) {
+void Gui::printText(const Common::String &text) {
debugC(1, kMVDebugGUI, "Print Text: %s", text.c_str());
_consoleText->printLine(text, _outConsoleWindow->getDimensions().width());
}
@@ -978,7 +978,7 @@ Common::Point Gui::getGlobalScrolledSurfacePosition(WindowReference reference) {
win->getDimensions().top + border.topOffset - data.scrollPos.y);
}
-WindowData & Gui::findWindowData(WindowReference reference) {
+WindowData &Gui::findWindowData(WindowReference reference) {
assert(_windowData);
Common::List<WindowData>::iterator iter = _windowData->begin();
@@ -992,7 +992,7 @@ WindowData & Gui::findWindowData(WindowReference reference) {
error("GUI: Could not locate the desired window data");
}
-Graphics::MacWindow * Gui::findWindow(WindowReference reference) {
+Graphics::MacWindow *Gui::findWindow(WindowReference reference) {
if (reference < 0x80 && reference >= kInventoryStart) { // It's an inventory window
return _inventoryWindows[reference - kInventoryStart];
}
@@ -1334,14 +1334,14 @@ bool Gui::processCommandEvents(WindowClick click, Common::Event &event) {
return false;
}
-bool MacVenture::Gui::processMainGameEvents(WindowClick click, Common::Event & event) {
+bool MacVenture::Gui::processMainGameEvents(WindowClick click, Common::Event &event) {
if (_engine->needsClickToContinue())
return true;
return false;
}
-bool MacVenture::Gui::processOutConsoleEvents(WindowClick click, Common::Event & event) {
+bool MacVenture::Gui::processOutConsoleEvents(WindowClick click, Common::Event &event) {
if (_engine->needsClickToContinue())
return true;
@@ -1357,7 +1357,7 @@ bool MacVenture::Gui::processOutConsoleEvents(WindowClick click, Common::Event &
return getWindowData(kOutConsoleWindow).visible;
}
-bool MacVenture::Gui::processSelfEvents(WindowClick click, Common::Event & event) {
+bool MacVenture::Gui::processSelfEvents(WindowClick click, Common::Event &event) {
if (_engine->needsClickToContinue())
return true;
@@ -1367,7 +1367,7 @@ bool MacVenture::Gui::processSelfEvents(WindowClick click, Common::Event & event
return true;
}
-bool MacVenture::Gui::processExitsEvents(WindowClick click, Common::Event & event) {
+bool MacVenture::Gui::processExitsEvents(WindowClick click, Common::Event &event) {
if (event.type == Common::EVENT_LBUTTONUP) {
if (_engine->needsClickToContinue()) {
return true;
@@ -1397,14 +1397,14 @@ bool MacVenture::Gui::processExitsEvents(WindowClick click, Common::Event & even
return getWindowData(kExitsWindow).visible;
}
-bool MacVenture::Gui::processDiplomaEvents(WindowClick click, Common::Event & event) {
+bool MacVenture::Gui::processDiplomaEvents(WindowClick click, Common::Event &event) {
if (_engine->needsClickToContinue())
return true;
return getWindowData(kDiplomaWindow).visible;
}
-bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
+bool Gui::processInventoryEvents(WindowClick click, Common::Event &event) {
if (event.type == Common::EVENT_LBUTTONDOWN && click == kBorderCloseButton) {
WindowReference ref = findWindowAtPoint(event.mouse);
if (ref == kNoWindow) {
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index f521286dc7..960c2b8ba3 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -313,8 +313,9 @@ public:
if (wrappedLines.empty()) // Sometimes we have empty lines
_lines.push_back("");
- for (Common::StringArray::const_iterator j = wrappedLines.begin(); j != wrappedLines.end(); ++j)
+ for (Common::StringArray::const_iterator j = wrappedLines.begin(); j != wrappedLines.end(); ++j) {
_lines.push_back(*j);
+ }
updateScroll();
}
diff --git a/engines/macventure/image.cpp b/engines/macventure/image.cpp
index c1bfd75158..f0146e344a 100644
--- a/engines/macventure/image.cpp
+++ b/engines/macventure/image.cpp
@@ -61,7 +61,7 @@ static const byte loadBits[] = {
0xff
};
-ImageAsset::ImageAsset(ObjID original, Container * container) {
+ImageAsset::ImageAsset(ObjID original, Container *container) {
_id = (original * 2);
_mask = (original * 2) + 1;
@@ -147,7 +147,7 @@ void ImageAsset::decodePPIC(ObjID id, Common::Array<byte> &data, uint &bitHeight
delete baseStream;
}
-void ImageAsset::decodePPIC0(Common::BitStream & stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::decodePPIC0(Common::BitStream &stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
uint words = bitWidth >> 4;
uint bytes = bitWidth & 0xF;
uint v = 0;
@@ -170,15 +170,15 @@ void ImageAsset::decodePPIC0(Common::BitStream & stream, Common::Array<byte> &da
}
-void ImageAsset::decodePPIC1(Common::BitStream & stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::decodePPIC1(Common::BitStream &stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
decodeHuffGraphic(PPIC1Huff, stream, data, bitHeight, bitWidth, rowBytes);
}
-void ImageAsset::decodePPIC2(Common::BitStream & stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::decodePPIC2(Common::BitStream &stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
decodeHuffGraphic(PPIC2Huff, stream, data, bitHeight, bitWidth, rowBytes);
}
-void ImageAsset::decodePPIC3(Common::BitStream & stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::decodePPIC3(Common::BitStream &stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
// We need to load the huffman from the PPIC itself
PPICHuff huff;
uint16 v, bits;
@@ -192,10 +192,13 @@ void ImageAsset::decodePPIC3(Common::BitStream & stream, Common::Array<byte> &da
huff.symbols[loadBits[load++]] = v;
}
huff.symbols[0x10] = 0;
- for (uint i = 0x10; i > 0; i--)
- for (uint j = i; j <= 0x10; j++)
- if (huff.symbols[j] >= huff.symbols[i - 1])
+ for (uint i = 0x10; i > 0; i--) {
+ for (uint j = i; j <= 0x10; j++) {
+ if (huff.symbols[j] >= huff.symbols[i - 1]) {
huff.symbols[j]++;
+ }
+ }
+ }
for (int i = 0x10; i >= 0; i--) {
if (huff.symbols[i] == 0x10) {
@@ -207,14 +210,19 @@ void ImageAsset::decodePPIC3(Common::BitStream & stream, Common::Array<byte> &da
bits = stream.getBits(2) + 1;
uint16 mask = 0;
for (uint i = 0; i < 0xf; i++) {
- if (i)
- while (!stream.getBit()) bits++;
+ if (i) {
+ while (!stream.getBit()) {
+ bits++;
+ }
+ }
huff.lens[i] = bits;
huff.masks[i] = mask;
mask += 1 << (16 - bits);
}
huff.masks[0xf] = mask;
- while (mask&(1 << (16 - bits))) bits++;
+ while (mask&(1 << (16 - bits))) {
+ bits++;
+ }
huff.masks[0x10] = mask | (1 << (16 - bits));
huff.lens[0xf] = bits;
huff.lens[0x10] = bits;
@@ -222,14 +230,15 @@ void ImageAsset::decodePPIC3(Common::BitStream & stream, Common::Array<byte> &da
decodeHuffGraphic(huff, stream, data, bitHeight, bitWidth, rowBytes);
}
-void ImageAsset::decodeHuffGraphic(const PPICHuff & huff, Common::BitStream & stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::decodeHuffGraphic(const PPICHuff &huff, Common::BitStream &stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
byte flags = 0;
_walkRepeat = 0;
_walkLast = 0;
- if (bitWidth & 3)
+ if (bitWidth & 3) {
flags = stream.getBits(5);
- else
+ } else {
flags = stream.getBits(4) << 1;
+ }
byte odd = 0;
byte blank = bitWidth & 0xf;
@@ -316,7 +325,7 @@ void ImageAsset::decodeHuffGraphic(const PPICHuff & huff, Common::BitStream & st
}
}
-byte ImageAsset::walkHuff(const PPICHuff & huff, Common::BitStream & stream) {
+byte ImageAsset::walkHuff(const PPICHuff &huff, Common::BitStream &stream) {
if (_walkRepeat) {
_walkRepeat--;
_walkLast = ((_walkLast << 8) & 0xFF00) | (_walkLast >> 8);
@@ -434,7 +443,7 @@ int ImageAsset::getHeight() {
return MAX(0, (int)_imgBitHeight);
}
-void ImageAsset::blitDirect(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte>& data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::blitDirect(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
uint sx, sy, w, h;
calculateSectionToDraw(target, ox, oy, bitWidth, bitHeight, sx, sy, w, h);
@@ -451,7 +460,7 @@ void ImageAsset::blitDirect(Graphics::ManagedSurface * target, int ox, int oy, c
}
}
-void ImageAsset::blitBIC(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::blitBIC(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
uint sx, sy, w, h;
calculateSectionToDraw(target, ox, oy, bitWidth, bitHeight, sx, sy, w, h);
@@ -469,7 +478,7 @@ void ImageAsset::blitBIC(Graphics::ManagedSurface * target, int ox, int oy, cons
}
}
-void ImageAsset::blitOR(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::blitOR(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
uint sx, sy, w, h;
calculateSectionToDraw(target, ox, oy, bitWidth, bitHeight, sx, sy, w, h);
@@ -487,7 +496,7 @@ void ImageAsset::blitOR(Graphics::ManagedSurface * target, int ox, int oy, const
}
}
-void ImageAsset::blitXOR(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
+void ImageAsset::blitXOR(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes) {
uint sx, sy, w, h;
calculateSectionToDraw(target, ox, oy, bitWidth, bitHeight, sx, sy, w, h);
diff --git a/engines/macventure/image.h b/engines/macventure/image.h
index 1f7d3e91b4..a026c3b8fa 100644
--- a/engines/macventure/image.h
+++ b/engines/macventure/image.h
@@ -77,10 +77,10 @@ private:
void decodeHuffGraphic(const PPICHuff &huff, Common::BitStream &stream, Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
byte walkHuff(const PPICHuff &huff, Common::BitStream &stream);
- void blitDirect(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
- void blitBIC(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
- void blitOR(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
- void blitXOR(Graphics::ManagedSurface * target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
+ void blitDirect(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
+ void blitBIC(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
+ void blitOR(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
+ void blitXOR(Graphics::ManagedSurface *target, int ox, int oy, const Common::Array<byte> &data, uint bitHeight, uint bitWidth, uint rowBytes);
void calculateSectionToDraw(Graphics::ManagedSurface *target, int &ox, int &oy, uint bitWidth, uint bitHeight, uint &sx, uint &sy, uint &w, uint &h);
void calculateSectionInDirection(uint targetWhole, uint originWhole, int &originPosition, uint &startPosition, uint &blittedWhole);
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 7f754c470d..999d41147b 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -387,10 +387,11 @@ void MacVentureEngine::handleObjectSelect(ObjID objID, WindowReference win, bool
// Do shift ;)
} else {
if (_selectedControl && _currentSelection.size() > 0 && getInvolvedObjects() > 1) {
- if (objID == 0)
+ if (objID == 0) {
selectPrimaryObject(windata.objRef);
- else
+ } else {
selectPrimaryObject(objID);
+ }
preparedToRun();
} else {
if (objID == 0) {
@@ -633,7 +634,7 @@ void MacVentureEngine::printTexts() {
}
void MacVentureEngine::playSounds(bool pause) {
- int delay=0;
+ int delay = 0;
while (!_soundQueue.empty()) {
QueuedSound item = _soundQueue.front();
_soundQueue.remove_at(0);
@@ -984,7 +985,7 @@ bool MacVentureEngine::isOldText() const {
return _oldTextEncoding;
}
-const HuffmanLists * MacVentureEngine::getDecodingHuffman() const {
+const HuffmanLists *MacVentureEngine::getDecodingHuffman() const {
return _textHuffman;
}
@@ -1122,17 +1123,20 @@ bool MacVentureEngine::loadTextHuffman() {
res->readUint16BE(); // Skip
uint32 *masks = new uint32[numEntries];
- for (uint i = 0; i < numEntries - 1; i++)
+ for (uint i = 0; i < numEntries - 1; i++) {
// For some reason there are one lass mask than entries
masks[i] = res->readUint16BE();
+ }
uint32 *lengths = new uint32[numEntries];
- for (uint i = 0; i < numEntries; i++)
+ for (uint i = 0; i < numEntries; i++) {
lengths[i] = res->readByte();
+ }
uint32 *values = new uint32[numEntries];
- for (uint i = 0; i < numEntries; i++)
+ for (uint i = 0; i < numEntries; i++) {
values[i] = res->readByte();
+ }
_textHuffman = new HuffmanLists(numEntries, lengths, masks, values);
debugC(4, kMVDebugMain, "Text is huffman-encoded");
@@ -1175,8 +1179,9 @@ void GlobalSettings::loadSettings(Common::SeekableReadStream *dataStream) {
_attrIndices = Common::Array<uint8>(attrIndices, _numAttributes);
delete[] attrIndices;
- for (int i = 0; i < _numAttributes; i++)
+ for (int i = 0; i < _numAttributes; i++) {
_attrMasks.push_back(dataStream->readUint16BE());
+ }
uint8 *attrShifts = new uint8[_numAttributes];
dataStream->read(attrShifts, _numAttributes);
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index 7e53eb229d..6908bc6050 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef MACVENTURE_H
-#define MACVENTURE_H
+#ifndef MACVENTURE_MACVENTURE_H
+#define MACVENTURE_MACVENTURE_H
#include "engines/engine.h"
#include "common/scummsys.h"
@@ -243,7 +243,7 @@ public:
bool isPaused();
bool needsClickToContinue();
Common::String getCommandsPausedString() const;
- const GlobalSettings& getGlobalSettings() const;
+ const GlobalSettings &getGlobalSettings() const;
Common::String getFilePath(FilePathID id) const;
bool isOldText() const;
const HuffmanLists *getDecodingHuffman() const;
@@ -310,7 +310,7 @@ private:
bool loadGlobalSettings();
bool loadTextHuffman();
- const char* getGameFileName() const;
+ const char *getGameFileName() const;
private: // Attributes
diff --git a/engines/macventure/saveload.cpp b/engines/macventure/saveload.cpp
index a341487cf1..e5cc9b6fa5 100644
--- a/engines/macventure/saveload.cpp
+++ b/engines/macventure/saveload.cpp
@@ -54,8 +54,9 @@ SaveStateDescriptor loadMetaData(Common::SeekableReadStream *s, int slot) {
// Depends on MACVENTURE_DESC_LENGTH
byte descSize = s->readByte();
s->seek(-(5 + MACVENTURE_DESC_LENGTH + descSize), SEEK_END);
- for (int i = 0; i < descSize; ++i)
+ for (int i = 0; i < descSize; ++i) {
name += s->readByte();
+ }
desc.setDescription(name);
return desc;
diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp
index f7e49c68e3..5f5273c6d7 100644
--- a/engines/macventure/script.cpp
+++ b/engines/macventure/script.cpp
@@ -29,7 +29,7 @@
namespace MacVenture {
-ScriptEngine::ScriptEngine(MacVentureEngine * engine, World * world) {
+ScriptEngine::ScriptEngine(MacVentureEngine *engine, World *world) {
_engine = engine;
_world = world;
_scripts = new Container(_engine->getFilePath(kFilterPathID));
@@ -100,12 +100,12 @@ bool ScriptEngine::execFrame(bool execAll) {
if (frame->haltedInFamily || doFamily) { // We have to do the family or we were stuck here
frame->haltedInFamily = false;
Common::Array<ObjID> family = _world->getFamily(_world->getObjAttr(1, kAttrParentObject), false);
- uint32 i = frame->familyIdx;
- for (; i < family.size(); i++) {
+ for (uint32 i = frame->familyIdx; i < family.size(); i++) {
if (doFamily) {
fail = loadScript(frame, family[i]);
+ } else {
+ fail = resumeFunc(frame);
}
- else { fail = resumeFunc(frame); }
if (fail) { // We are stuck, so we don't shift the frame
frame->haltedInFamily = true;
frame->familyIdx = i;
@@ -130,7 +130,7 @@ bool ScriptEngine::execFrame(bool execAll) {
uint localHigh = 0;
do { // Saved function calls
highest = 0;
- for (uint i = 0; i <frame->saves.size(); i++) {
+ for (uint i = 0; i < frame->saves.size(); i++) {
if (highest < frame->saves[i].rank) {
highest = frame->saves[i].rank;
localHigh = i;
@@ -150,7 +150,7 @@ bool ScriptEngine::execFrame(bool execAll) {
return false;
}
-bool ScriptEngine::loadScript(EngineFrame * frame, uint32 scriptID) {
+bool ScriptEngine::loadScript(EngineFrame *frame, uint32 scriptID) {
if (_scripts->getItemByteSize(scriptID) > 0) {
debugC(2, kMVDebugScript, "Loading function %d", scriptID);
// Insert the new script at the front
@@ -160,7 +160,7 @@ bool ScriptEngine::loadScript(EngineFrame * frame, uint32 scriptID) {
return false;
}
-bool ScriptEngine::resumeFunc(EngineFrame * frame) {
+bool ScriptEngine::resumeFunc(EngineFrame *frame) {
bool fail = runFunc(frame);
if (fail) {
return fail;
@@ -525,81 +525,81 @@ word ScriptEngine::sumChildrenAttr(word obj, word attr, bool recursive) {
return sum;
}
-void MacVenture::ScriptEngine::op80GATT(EngineState * state, EngineFrame * frame) {
+void MacVenture::ScriptEngine::op80GATT(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
word attr = state->pop();
state->push(_world->getObjAttr(obj, attr));
}
-void ScriptEngine::op81SATT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op81SATT(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
word attr = state->pop();
word val = neg16(state->pop());
_world->setObjAttr(obj, attr, val);
}
-void ScriptEngine::op82SUCH(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op82SUCH(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
word attr = state->pop();
word recursive = neg16(state->pop());
state->push(sumChildrenAttr(obj, attr, recursive));
}
-void ScriptEngine::op83PUCT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op83PUCT(EngineState *state, EngineFrame *frame) {
state->push(frame->action);
}
-void ScriptEngine::op84PUOB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op84PUOB(EngineState *state, EngineFrame *frame) {
state->push(frame->src);
}
-void ScriptEngine::op85PUTA(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op85PUTA(EngineState *state, EngineFrame *frame) {
state->push(frame->dest);
}
-void ScriptEngine::op86PUDX(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op86PUDX(EngineState *state, EngineFrame *frame) {
state->push(frame->x);
}
-void ScriptEngine::op87PUDY(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op87PUDY(EngineState *state, EngineFrame *frame) {
state->push(frame->y);
}
-void ScriptEngine::op88PUIB(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::op88PUIB(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
state->push(script->fetch());
}
-void ScriptEngine::op89PUI(EngineState * state, EngineFrame * frame, ScriptAsset * script) {
+void ScriptEngine::op89PUI(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val <<= 8;
val = val | script->fetch();
state->push(val);
}
-void ScriptEngine::op8aGGLO(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op8aGGLO(EngineState *state, EngineFrame *frame) {
word idx = state->pop();
state->push(_world->getGlobal(idx));
}
-void ScriptEngine::op8bSGLO(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op8bSGLO(EngineState *state, EngineFrame *frame) {
word idx = state->pop();
word val = neg16(state->pop());
_world->setGlobal(idx, val);
_engine->gameChanged();
}
-void ScriptEngine::op8cRAND(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op8cRAND(EngineState *state, EngineFrame *frame) {
word max = state->pop();
state->push(_engine->randBetween(0, max));
}
-void ScriptEngine::op8dCOPY(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op8dCOPY(EngineState *state, EngineFrame *frame) {
word val = state->pop();
state->push(val);
state->push(val);
}
-void ScriptEngine::op8eCOPYN(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op8eCOPYN(EngineState *state, EngineFrame *frame) {
word n = state->pop();
word offs = n - 1;
word val;
@@ -610,14 +610,14 @@ void ScriptEngine::op8eCOPYN(EngineState * state, EngineFrame * frame) {
}
}
-void ScriptEngine::op8fSWAP(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op8fSWAP(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(b);
state->push(a);
}
-void ScriptEngine::op90SWAPN(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op90SWAPN(EngineState *state, EngineFrame *frame) {
word idx = state->pop();
word a = state->peek(idx);
word b = state->peek(0);
@@ -625,22 +625,22 @@ void ScriptEngine::op90SWAPN(EngineState * state, EngineFrame * frame) {
state->poke(0, a);
}
-void ScriptEngine::op91POP(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op91POP(EngineState *state, EngineFrame *frame) {
state->pop();
}
-void ScriptEngine::op92COPYP(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op92COPYP(EngineState *state, EngineFrame *frame) {
word val = state->peek(1);
state->push(val);
}
-void ScriptEngine::op93COPYPN(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op93COPYPN(EngineState *state, EngineFrame *frame) {
word idx = state->pop();
word val = state->peek(idx);
state->push(val);
}
-void ScriptEngine::op94SHUFF(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op94SHUFF(EngineState *state, EngineFrame *frame) {
word a = state->pop();
word b = state->pop();
word c = state->pop();
@@ -649,7 +649,7 @@ void ScriptEngine::op94SHUFF(EngineState * state, EngineFrame * frame) {
state->push(b);
}
-void ScriptEngine::op95SORT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op95SORT(EngineState *state, EngineFrame *frame) {
word step = neg16(state->pop());
word num = neg16(state->pop());
step %= num;
@@ -658,7 +658,7 @@ void ScriptEngine::op95SORT(EngineState * state, EngineFrame * frame) {
}
word end = 0;
word start = 0;
- for (word i = 1;i<num;i++) {
+ for (word i = 1; i < num; i++) {
start += step;
if (start >= num) {
start -= num;
@@ -675,52 +675,52 @@ void ScriptEngine::op95SORT(EngineState * state, EngineFrame * frame) {
}
}
-void ScriptEngine::op96CLEAR(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op96CLEAR(EngineState *state, EngineFrame *frame) {
state->clear();
}
-void ScriptEngine::op97SIZE(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op97SIZE(EngineState *state, EngineFrame *frame) {
state->push(state->size());
}
-void ScriptEngine::op98ADD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op98ADD(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(a + b);
}
-void ScriptEngine::op99SUB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op99SUB(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(a - b);
}
-void ScriptEngine::op9aMUL(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op9aMUL(EngineState *state, EngineFrame *frame) {
int16 b = state->pop();
int16 a = state->pop();
state->push(a * b);
}
-void ScriptEngine::op9bDIV(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op9bDIV(EngineState *state, EngineFrame *frame) {
int16 b = state->pop();
int16 a = state->pop();
state->push((a / b) | 0);
}
-void ScriptEngine::op9cMOD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op9cMOD(EngineState *state, EngineFrame *frame) {
int16 b = state->pop();
int16 a = state->pop();
state->push(a % b);
}
-void ScriptEngine::op9dDMOD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op9dDMOD(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(a % b);
state->push((a / b) | 0);
}
-void ScriptEngine::op9eABS(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op9eABS(EngineState *state, EngineFrame *frame) {
word val = neg16(state->pop());
if (val < 0) {
val = -val;
@@ -728,110 +728,110 @@ void ScriptEngine::op9eABS(EngineState * state, EngineFrame * frame) {
state->push(val);
}
-void ScriptEngine::op9fNEG(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::op9fNEG(EngineState *state, EngineFrame *frame) {
word val = -neg16(state->pop());
state->push(val);
}
-void ScriptEngine::opa0AND(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa0AND(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(a & b);
}
-void ScriptEngine::opa1OR(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa1OR(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(a | b);
}
-void ScriptEngine::opa2XOR(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa2XOR(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(a ^ b);
}
-void ScriptEngine::opa3NOT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa3NOT(EngineState *state, EngineFrame *frame) {
word a = state->pop();
state->push(a ^ 0xFFFF);
}
-void ScriptEngine::opa4LAND(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa4LAND(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push((a && b) ? 0xFFFF : 0);
}
-void ScriptEngine::opa5LOR(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa5LOR(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push((a || b) ? 0xFFFF : 0);
}
-void ScriptEngine::opa6LXOR(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa6LXOR(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push((!a != !b) ? 0xFFFF : 0);
}
-void ScriptEngine::opa7LNOT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa7LNOT(EngineState *state, EngineFrame *frame) {
word a = state->pop();
state->push((a == 0) ? 0xFFFF : 0);
}
-void ScriptEngine::opa8GTU(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa8GTU(EngineState *state, EngineFrame *frame) {
uint16 b = state->pop();
uint16 a = state->pop();
state->push((a > b) ? 0xFFFF : 0);
}
-void ScriptEngine::opa9LTU(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opa9LTU(EngineState *state, EngineFrame *frame) {
uint16 b = state->pop();
uint16 a = state->pop();
state->push((a < b) ? 0xFFFF : 0);
}
-void ScriptEngine::opaaGTS(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opaaGTS(EngineState *state, EngineFrame *frame) {
// HACK !!! May not need the neg16, since word is already a signed int!!
word b = neg16(state->pop());
word a = neg16(state->pop());
state->push((a > b) ? 0xFFFF : 0);
}
-void ScriptEngine::opabLTS(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opabLTS(EngineState *state, EngineFrame *frame) {
// HACK !!! May not need the neg16, since word is already a signed int!!
word b = neg16(state->pop());
word a = neg16(state->pop());
state->push((a < b) ? 0xFFFF : 0);
}
-void ScriptEngine::opacEQ(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opacEQ(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push((a == b) ? 0xFFFF : 0);
}
-void ScriptEngine::opadEQS(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opadEQS(EngineState *state, EngineFrame *frame) {
Common::String b = _world->getText(state->pop(), 0, 0); // HACK, these destinations might be wrong
Common::String a = _world->getText(state->pop(), 0, 0);
state->push((a == b) ? 1 : 0);
}
-void ScriptEngine::opaeCONT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opaeCONT(EngineState *state, EngineFrame *frame) {
Common::String needle = _world->getText(state->pop(), 0, 0);
Common::String haystack = _world->getText(state->pop(), 0, 0);
haystack.toLowercase();
state->push(haystack.contains(needle) ? 1 : 0);
}
-void ScriptEngine::opafCONTW(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opafCONTW(EngineState *state, EngineFrame *frame) {
Common::String needle = _world->getText(state->pop(), 0, 0);
Common::String haystack = _world->getText(state->pop(), 0, 0);
haystack.toLowercase();
state->push(haystack.contains(needle) ? 1 : 0);
}
-void ScriptEngine::opb0BRA(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::opb0BRA(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val <<= 8;
val = val | script->fetch();
@@ -839,13 +839,13 @@ void ScriptEngine::opb0BRA(EngineState * state, EngineFrame * frame, ScriptAsset
script->branch(val);
}
-void ScriptEngine::opb1BRAB(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::opb1BRAB(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val = neg8(val);
script->branch(val);
}
-void ScriptEngine::opb2BEQ(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::opb2BEQ(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val <<= 8;
val = val | script->fetch();
@@ -856,7 +856,7 @@ void ScriptEngine::opb2BEQ(EngineState * state, EngineFrame * frame, ScriptAsset
}
}
-void ScriptEngine::opb3BEQB(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::opb3BEQB(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val = neg8(val);
word b = state->pop();
@@ -865,7 +865,7 @@ void ScriptEngine::opb3BEQB(EngineState * state, EngineFrame * frame, ScriptAsse
}
}
-void ScriptEngine::opb4BNE(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::opb4BNE(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val <<= 8;
val = val | script->fetch();
@@ -876,7 +876,7 @@ void ScriptEngine::opb4BNE(EngineState * state, EngineFrame * frame, ScriptAsset
}
}
-void ScriptEngine::opb5BNEB(EngineState * state, EngineFrame * frame, ScriptAsset *script) {
+void ScriptEngine::opb5BNEB(EngineState *state, EngineFrame *frame, ScriptAsset *script) {
word val = script->fetch();
val = neg8(val);
word b = state->pop();
@@ -885,13 +885,13 @@ void ScriptEngine::opb5BNEB(EngineState * state, EngineFrame * frame, ScriptAsse
}
}
-void ScriptEngine::opb6CLAT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opb6CLAT(EngineState *state, EngineFrame *frame) {
word rank = state->pop();
word func = state->pop();
frame->saves.push_back(FunCall(func, rank));
}
-void ScriptEngine::opb7CCA(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opb7CCA(EngineState *state, EngineFrame *frame) {
word func = state->pop();
for (uint i = 0; i < frame->saves.size(); i++) {
if (frame->saves[i].func == func)
@@ -899,26 +899,26 @@ void ScriptEngine::opb7CCA(EngineState * state, EngineFrame * frame) {
}
}
-void ScriptEngine::opb8CLOW(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opb8CLOW(EngineState *state, EngineFrame *frame) {
word hi = state->pop();
- for (uint i = 0;i<frame->saves.size();i++)
+ for (uint i = 0; i < frame->saves.size(); i++)
if (frame->saves[i].rank <= hi)
frame->saves[i].rank = 0;
}
-void ScriptEngine::opb9CHI(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opb9CHI(EngineState *state, EngineFrame *frame) {
word lo = state->pop();
- for (uint i = 0;i<frame->saves.size();i++) {
+ for (uint i = 0; i < frame->saves.size(); i++) {
if (frame->saves[i].rank >= lo) {
frame->saves[i].rank = 0;
}
}
}
-void ScriptEngine::opbaCRAN(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opbaCRAN(EngineState *state, EngineFrame *frame) {
word hi = state->pop();
word lo = state->pop();
- for (uint i = 0;i<frame->saves.size();i++) {
+ for (uint i = 0; i < frame->saves.size(); i++) {
if (frame->saves[i].rank >= lo &&
frame->saves[i].rank <= hi) {
frame->saves[i].rank = 0;
@@ -926,7 +926,7 @@ void ScriptEngine::opbaCRAN(EngineState * state, EngineFrame * frame) {
}
}
-bool ScriptEngine::opbbFORK(EngineState * state, EngineFrame * frame) {
+bool ScriptEngine::opbbFORK(EngineState *state, EngineFrame *frame) {
EngineFrame newframe;
newframe.action = (ControlAction)state->pop();
newframe.src = state->pop();
@@ -943,7 +943,7 @@ bool ScriptEngine::opbbFORK(EngineState * state, EngineFrame * frame) {
return false;
}
-bool ScriptEngine::opbcCALL(EngineState * state, EngineFrame * frame, ScriptAsset &script) {
+bool ScriptEngine::opbcCALL(EngineState *state, EngineFrame *frame, ScriptAsset &script) {
word id = state->pop();
ScriptAsset newfun = ScriptAsset(id, _scripts);
ScriptAsset current = script;
@@ -956,12 +956,12 @@ bool ScriptEngine::opbcCALL(EngineState * state, EngineFrame * frame, ScriptAsse
return false;
}
-void ScriptEngine::opbdFOOB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opbdFOOB(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
_engine->enqueueObject(kFocusWindow, obj);
}
-void ScriptEngine::opbeSWOB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opbeSWOB(EngineState *state, EngineFrame *frame) {
ObjID from = state->pop();
ObjID to = state->pop();
_engine->enqueueObject(kUpdateWindow, from, to);
@@ -973,62 +973,63 @@ void ScriptEngine::opbeSWOB(EngineState * state, EngineFrame * frame) {
}
}
-void ScriptEngine::opbfSNOB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opbfSNOB(EngineState *state, EngineFrame *frame) {
_engine->enqueueObject(kAnimateBack, frame->src);
}
-void ScriptEngine::opc0TEXI(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc0TEXI(EngineState *state, EngineFrame *frame) {
_engine->enqueueObject(kHightlightExits, 0);
}
-void ScriptEngine::opc1PTXT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc1PTXT(EngineState *state, EngineFrame *frame) {
word tid = state->pop();
_engine->enqueueText(kTextPlain, frame->dest, frame->src, tid);
}
-void ScriptEngine::opc2PNEW(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc2PNEW(EngineState *state, EngineFrame *frame) {
_engine->enqueueText(kTextNewLine, frame->dest, frame->src, 0);
}
-void ScriptEngine::opc3PTNE(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc3PTNE(EngineState *state, EngineFrame *frame) {
word tid = state->pop();
_engine->enqueueText(kTextPlain, frame->dest, frame->src, tid);
_engine->enqueueText(kTextNewLine, frame->dest, frame->src, 0);
}
-void ScriptEngine::opc4PNTN(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc4PNTN(EngineState *state, EngineFrame *frame) {
word tid = state->pop();
_engine->enqueueText(kTextNewLine, frame->dest, frame->src, 0);
_engine->enqueueText(kTextPlain, frame->dest, frame->src, tid);
_engine->enqueueText(kTextNewLine, frame->dest, frame->src, 0);
}
-void ScriptEngine::opc5PNUM(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc5PNUM(EngineState *state, EngineFrame *frame) {
word tid = state->pop();
_engine->enqueueText(kTextNumber, frame->dest, frame->src, tid);
}
-void ScriptEngine::opc6P2(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc6P2(EngineState *state, EngineFrame *frame) {
state->push(2);
}
-void ScriptEngine::opc7PLBG(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc7PLBG(EngineState *state, EngineFrame *frame) {
word target = state->pop();
_engine->enqueueSound(kSoundPlay, target);
}
-void ScriptEngine::opc8PLAW(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc8PLAW(EngineState *state, EngineFrame *frame) {
word target = state->pop();
_engine->enqueueSound(kSoundPlayAndWait, target);
}
-void ScriptEngine::opc9WAIT(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opc9WAIT(EngineState *state, EngineFrame *frame) {
_engine->enqueueSound(kSoundWait, 0);
}
-void ScriptEngine::opcaTIME(EngineState * state, EngineFrame * frame) {
- for (uint i = 0; i < 3; i++) // We skip year, month and date
+void ScriptEngine::opcaTIME(EngineState *state, EngineFrame *frame) {
+ for (uint i = 0; i < 3; i++) {// We skip year, month and date
state->push(0x00);
+ }
uint32 totalPlayTime = _engine->getTotalPlayTime() / 1000; // In seconds
word hours = totalPlayTime / 3600;
@@ -1041,12 +1042,12 @@ void ScriptEngine::opcaTIME(EngineState * state, EngineFrame * frame) {
debugC(2, kMVDebugScript, "Saved time: h[%d] m[%d] s[%d]", hours, minutes, totalPlayTime);
}
-void ScriptEngine::opcbDAY(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opcbDAY(EngineState *state, EngineFrame *frame) {
// Probaby irrelevant, so we push Day [9]
state->push(9);
}
-void ScriptEngine::opccCHLD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opccCHLD(EngineState *state, EngineFrame *frame) {
bool recursive = state->pop() != 0;
word obj = state->pop();
Common::Array<ObjID> children = _world->getChildren(obj, recursive);
@@ -1056,49 +1057,49 @@ void ScriptEngine::opccCHLD(EngineState * state, EngineFrame * frame) {
state->push(children.size());
}
-void ScriptEngine::opcdNCHLD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opcdNCHLD(EngineState *state, EngineFrame *frame) {
bool recursive = state->pop() != 0;
word obj = state->pop();
Common::Array<ObjID> children = _world->getChildren(obj, recursive);
state->push(children.size());
}
-void ScriptEngine::opceVERS(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opceVERS(EngineState *state, EngineFrame *frame) {
state->push(86);
}
-void ScriptEngine::opcfPSCE(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opcfPSCE(EngineState *state, EngineFrame *frame) {
state->push(0); //Not release
}
-void ScriptEngine::opd0P1(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd0P1(EngineState *state, EngineFrame *frame) {
state->push(1);
}
-void ScriptEngine::opd1GOBD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd1GOBD(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
Common::Rect bounds = _engine->getObjBounds(obj);
state->push(bounds.width());
state->push(bounds.height());
}
-void ScriptEngine::opd2GOVP(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd2GOVP(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
state->push(_engine->getOverlapPercent(b, a));
}
-void ScriptEngine::opd3CAPC(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd3CAPC(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
_world->captureChildren(obj);
}
-void ScriptEngine::opd4RELC(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd4RELC(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
_world->releaseChildren(obj);
}
-void ScriptEngine::opd5DLOG(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd5DLOG(EngineState *state, EngineFrame *frame) {
word txt = state->pop();
if (_engine->showTextEntry(txt, frame->src, frame->dest)) {
state->push(0xFF);
@@ -1107,60 +1108,60 @@ void ScriptEngine::opd5DLOG(EngineState * state, EngineFrame * frame) {
}
}
-void ScriptEngine::opd6ACMD(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd6ACMD(EngineState *state, EngineFrame *frame) {
_engine->selectControl((ControlAction)state->pop());
}
-void ScriptEngine::opd7LOSE(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd7LOSE(EngineState *state, EngineFrame *frame) {
_engine->loseGame();
}
-void ScriptEngine::opd8WIN(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd8WIN(EngineState *state, EngineFrame *frame) {
_engine->winGame();
}
-void ScriptEngine::opd9SLEEP(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opd9SLEEP(EngineState *state, EngineFrame *frame) {
word ticks = state->pop();
g_system->delayMillis((ticks / 60) * 1000);
_engine->preparedToRun();
}
-void ScriptEngine::opdaCLICK(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opdaCLICK(EngineState *state, EngineFrame *frame) {
_engine->updateState(false);
_engine->clickToContinue();
}
-void ScriptEngine::opdbROBQ(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opdbROBQ(EngineState *state, EngineFrame *frame) {
_engine->runObjQueue();
}
-void ScriptEngine::opdcRSQ(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opdcRSQ(EngineState *state, EngineFrame *frame) {
_engine->playSounds(true);
}
-void ScriptEngine::opddRTQ(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opddRTQ(EngineState *state, EngineFrame *frame) {
_engine->printTexts();
}
-void ScriptEngine::opdeUPSC(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opdeUPSC(EngineState *state, EngineFrame *frame) {
_engine->updateState(true);
}
-void ScriptEngine::opdfFMAI(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::opdfFMAI(EngineState *state, EngineFrame *frame) {
word ticks = state->pop();
g_system->delayMillis((ticks / 60) * 1000);
_engine->revert();
}
-void ScriptEngine::ope0CHGR(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope0CHGR(EngineState *state, EngineFrame *frame) {
state->pop();
}
-void ScriptEngine::ope1CHSO(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope1CHSO(EngineState *state, EngineFrame *frame) {
state->pop();
}
-void ScriptEngine::ope2MDIV(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope2MDIV(EngineState *state, EngineFrame *frame) {
word b = state->pop();
word a = state->pop();
a *= b;
@@ -1169,25 +1170,25 @@ void ScriptEngine::ope2MDIV(EngineState * state, EngineFrame * frame) {
state->push(a | 0);
}
-void ScriptEngine::ope3UPOB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope3UPOB(EngineState *state, EngineFrame *frame) {
word obj = state->pop();
_world->updateObj(obj);
}
-void ScriptEngine::ope4PLEV(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope4PLEV(EngineState *state, EngineFrame *frame) {
state->push(0);
}
-void ScriptEngine::ope5WEV(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope5WEV(EngineState *state, EngineFrame *frame) {
op00NOOP(0xe5);
}
-void ScriptEngine::ope6GFIB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope6GFIB(EngineState *state, EngineFrame *frame) {
state->push(0);
op00NOOP(0xe6);
}
-void ScriptEngine::ope7CFIB(EngineState * state, EngineFrame * frame) {
+void ScriptEngine::ope7CFIB(EngineState *state, EngineFrame *frame) {
state->pop();
op00NOOP(0xe7);
}
@@ -1198,7 +1199,7 @@ void ScriptEngine::op00NOOP(byte op) {
-ScriptAsset::ScriptAsset(ObjID id, Container * container) {
+ScriptAsset::ScriptAsset(ObjID id, Container *container) {
_id = id;
_container = container;
_ip = 0x0;
diff --git a/engines/macventure/script.h b/engines/macventure/script.h
index 5760a31e8a..afeed4a848 100644
--- a/engines/macventure/script.h
+++ b/engines/macventure/script.h
@@ -148,9 +148,9 @@ public:
private:
bool execFrame(bool execAll);
- bool loadScript(EngineFrame * frame, uint32 scriptID);
- bool resumeFunc(EngineFrame * frame);
- bool runFunc(EngineFrame * frame);
+ bool loadScript(EngineFrame *frame, uint32 scriptID);
+ bool resumeFunc(EngineFrame *frame);
+ bool runFunc(EngineFrame *frame);
private:
diff --git a/engines/macventure/sound.cpp b/engines/macventure/sound.cpp
index 492bf55b43..fd39e2bf5e 100644
--- a/engines/macventure/sound.cpp
+++ b/engines/macventure/sound.cpp
@@ -37,7 +37,7 @@ SoundManager::SoundManager(MacVentureEngine *engine, Audio::Mixer *mixer) {
debugC(1, kMVDebugSound, "Created sound manager with file %s", filename.c_str());
}
-SoundManager::~SoundManager(){
+SoundManager::~SoundManager() {
if (_container)
delete _container;
@@ -159,7 +159,7 @@ void SoundAsset::decode12(Common::SeekableReadStream *stream) {
byte ch = stream->readByte();
if (ch & 0x80) {
ch -= 0x80;
- uint32 env= ch * scale;
+ uint32 env = ch * scale;
ch = (env >> 8) & 0xff;
if (ch & 0x80) {
ch = 0x7f;
@@ -265,7 +265,7 @@ void SoundAsset::decode7e(Common::SeekableReadStream *stream) {
stream->readUint32BE();
_length = stream->readUint32BE();
_frequency = (stream->readUint32BE() * 22100 / 0x10000) | 0;
- uint32 last=0x80;
+ uint32 last = 0x80;
byte ch = 0;
for (uint i = 0; i < _length; i++) {
if (i & 1) {
diff --git a/engines/macventure/stringtable.h b/engines/macventure/stringtable.h
index 54aba03337..2f1d671696 100644
--- a/engines/macventure/stringtable.h
+++ b/engines/macventure/stringtable.h
@@ -79,7 +79,7 @@ private:
uint8 strLength = 0;
for (uint i = 0; i < numStrings; ++i) {
strLength = res->readByte();
- char* str = new char[strLength + 1];
+ char *str = new char[strLength + 1];
res->read(str, strLength);
str[strLength] = '\0';
// HACK until a proper special char implementation is found, this will have to do.
diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp
index 7981692c0a..a2777f8774 100644
--- a/engines/macventure/text.cpp
+++ b/engines/macventure/text.cpp
@@ -43,7 +43,7 @@ void TextAsset::decodeOld() {
Common::SeekableReadStream *res = _container->getItem(_id);
uint16 strLen = res->readUint16BE();
Common::BitStream32BELSB stream(res, true);
- char* str = new char[strLen + 1];
+ char *str = new char[strLen + 1];
bool lowercase = false;
char c;
for (uint16 i = 0; i < strLen; i++) {
diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp
index fc563cb639..4847dcf0f1 100644
--- a/engines/macventure/world.cpp
+++ b/engines/macventure/world.cpp
@@ -131,8 +131,9 @@ bool MacVenture::World::isObjActive(ObjID obj) {
ObjID World::getAncestor(ObjID objID) {
ObjID root = getObjAttr(1, kAttrParentObject);
- while (objID != 0 && objID != 1 && objID != root)
+ while (objID != 0 && objID != 1 && objID != root) {
objID = getObjAttr(objID, kAttrParentObject);
+ }
return objID;
}
@@ -279,11 +280,11 @@ void SaveGame::setAttr(uint32 attrID, ObjID objID, Attribute value) {
_groups[attrID][objID] = value;
}
-const Common::Array<AttributeGroup>& MacVenture::SaveGame::getGroups() {
+const Common::Array<AttributeGroup> &MacVenture::SaveGame::getGroups() {
return _groups;
}
-const AttributeGroup * SaveGame::getGroup(uint32 groupID) {
+const AttributeGroup *SaveGame::getGroup(uint32 groupID) {
assert(groupID < _groups.size());
return &(_groups[groupID]);
}
@@ -292,11 +293,11 @@ void SaveGame::setGlobal(uint32 attrID, Attribute value) {
_globals[attrID] = value;
}
-const Common::Array<uint16>& SaveGame::getGlobals() {
+const Common::Array<uint16> &SaveGame::getGlobals() {
return _globals;
}
-const Common::String & SaveGame::getText() {
+const Common::String &SaveGame::getText() {
return _text;
}
@@ -320,7 +321,7 @@ void SaveGame::saveInto(Common::OutSaveFile *file) {
file->write(_text.c_str(), _text.size());
}
-void SaveGame::loadGroups(MacVentureEngine *engine, Common::SeekableReadStream * res) {
+void SaveGame::loadGroups(MacVentureEngine *engine, Common::SeekableReadStream *res) {
GlobalSettings settings = engine->getGlobalSettings();
for (int i = 0; i < settings._numGroups; ++i) {
AttributeGroup g;
@@ -332,14 +333,14 @@ void SaveGame::loadGroups(MacVentureEngine *engine, Common::SeekableReadStream *
}
}
-void SaveGame::loadGlobals(MacVentureEngine *engine, Common::SeekableReadStream * res) {
+void SaveGame::loadGlobals(MacVentureEngine *engine, Common::SeekableReadStream *res) {
GlobalSettings settings = engine->getGlobalSettings();
for (int i = 0; i < settings._numGlobals; ++i) {
_globals.push_back(res->readUint16BE());
}
}
-void SaveGame::loadText(MacVentureEngine *engine, Common::SeekableReadStream * res) {
+void SaveGame::loadText(MacVentureEngine *engine, Common::SeekableReadStream *res) {
_text = "Placeholder Console Text";
}