aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
authorBorja Lorente2016-08-15 11:28:30 +0200
committerBorja Lorente2016-08-19 16:30:18 +0200
commit09fe00eb2a8f11e274901a4af4e19ec5275ff7e8 (patch)
treecd3a1419f3d2410f3e6e65595445acdeb1b3eb26 /engines/macventure
parentfd01961d55e5e749adea193cdadd184aefcd5887 (diff)
downloadscummvm-rg350-09fe00eb2a8f11e274901a4af4e19ec5275ff7e8.tar.gz
scummvm-rg350-09fe00eb2a8f11e274901a4af4e19ec5275ff7e8.tar.bz2
scummvm-rg350-09fe00eb2a8f11e274901a4af4e19ec5275ff7e8.zip
MACVENTURE: Fix indentation and braces
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/container.h4
-rw-r--r--engines/macventure/controls.h35
-rw-r--r--engines/macventure/dialog.cpp20
-rw-r--r--engines/macventure/gui.cpp13
-rw-r--r--engines/macventure/image.cpp6
-rw-r--r--engines/macventure/macventure.cpp17
-rw-r--r--engines/macventure/module.mk21
-rw-r--r--engines/macventure/object.cpp30
-rw-r--r--engines/macventure/object.h38
-rw-r--r--engines/macventure/script.cpp10
-rw-r--r--engines/macventure/sound.cpp2
-rw-r--r--engines/macventure/text.cpp51
-rw-r--r--engines/macventure/windows.h4
-rw-r--r--engines/macventure/world.cpp4
14 files changed, 78 insertions, 177 deletions
diff --git a/engines/macventure/container.h b/engines/macventure/container.h
index 6979afbb4e..b65c1578cd 100644
--- a/engines/macventure/container.h
+++ b/engines/macventure/container.h
@@ -210,8 +210,8 @@ protected:
ContainerHeader _header;
- Common::Array<uint16> _huff; // huffman masks
- Common::Array<uint8> _lens; // huffman lengths
+ Common::Array<uint16> _huff; // huffman masks
+ Common::Array<uint8> _lens; // huffman lengths
Common::Array<ItemGroup> _groups;
Common::String _filename;
diff --git a/engines/macventure/controls.h b/engines/macventure/controls.h
index 574ae6afbe..3f23aa825d 100644
--- a/engines/macventure/controls.h
+++ b/engines/macventure/controls.h
@@ -41,24 +41,25 @@ enum ControlType { // HACK, should correspond exactly with the types of controls
};
enum ControlAction { // HACK, figure out a way to put it in engine
- kNoCommand = 0,
- kStartOrResume = 1,
- kClose = 2,
- kTick = 3,
- kActivateObject = 4,
- kMoveObject = 5,
- kConsume = 6,
- kExamine = 7,
- kGo = 8,
- kHit = 9,
- kOpen = 10,
- kOperate = 11,
- kSpeak = 12,
- kBabble = 13,
- kTargetName = 14,
- kDebugObject = 15,
- kClickToContinue = 16
+ kNoCommand = 0,
+ kStartOrResume = 1,
+ kClose = 2,
+ kTick = 3,
+ kActivateObject = 4,
+ kMoveObject = 5,
+ kConsume = 6,
+ kExamine = 7,
+ kGo = 8,
+ kHit = 9,
+ kOpen = 10,
+ kOperate = 11,
+ kSpeak = 12,
+ kBabble = 13,
+ kTargetName = 14,
+ kDebugObject = 15,
+ kClickToContinue = 16
};
+
struct ControlData {
Common::Rect bounds;
uint16 scrollValue;
diff --git a/engines/macventure/dialog.cpp b/engines/macventure/dialog.cpp
index 0edec40c4d..ce420a25c3 100644
--- a/engines/macventure/dialog.cpp
+++ b/engines/macventure/dialog.cpp
@@ -46,7 +46,7 @@ Dialog::~Dialog() {
void Dialog::handleDialogAction(DialogElement *trigger, DialogAction action) {
switch(action) {
- case kDACloseDialog:
+ case kDACloseDialog:
_gui->closeDialog();
break;
case kDASubmit:
@@ -71,7 +71,7 @@ void Dialog::handleDialogAction(DialogElement *trigger, DialogAction action) {
break;
default:
break;
- }
+ }
}
const Graphics::Font& Dialog::getFont() {
@@ -84,11 +84,11 @@ bool Dialog::processEvent(Common::Event event) {
}
}
-void Dialog::addButton(Common::String title, MacVenture::DialogAction action, Common::Point position, uint width, uint height) {
+void Dialog::addButton(Common::String title, MacVenture::DialogAction action, Common::Point position, uint width, uint height) {
_elements.push_back(new DialogButton(this, title, action, position, width, height));
}
-void Dialog::addText(Common::String content, Common::Point position) {
+void Dialog::addText(Common::String content, Common::Point position) {
_elements.push_back(new DialogPlainText(this, content, position));
}
@@ -96,7 +96,7 @@ void Dialog::addTextInput(Common::Point position, int width, int height) {
_elements.push_back(new DialogTextInput(this, position, width, height));
}
-void Dialog::draw() {
+void Dialog::draw() {
Graphics::ManagedSurface compose;
// Compose the surface
compose.create(_bounds.width(), _bounds.height());
@@ -149,7 +149,7 @@ DialogElement::DialogElement(Dialog *dialog, Common::String title, DialogAction
_bounds = Common::Rect(position.x, position.y, position.x + width, position.y + height);
}
-bool DialogElement::processEvent(MacVenture::Dialog *dialog, Common::Event event) {
+bool DialogElement::processEvent(MacVenture::Dialog *dialog, Common::Event event) {
return doProcessEvent(dialog, event);
}
@@ -218,7 +218,7 @@ bool DialogTextInput::doProcessEvent(Dialog *dialog, Common::Event event) {
if (!_text.empty()) {
_text.deleteLastChar();
dialog->setUserInput(_text);
- return true;
+ return true;
}
break;
default:
@@ -228,9 +228,9 @@ bool DialogTextInput::doProcessEvent(Dialog *dialog, Common::Event event) {
return true;
}
break;
- }
- }
- return false;
+ }
+ }
+ return false;
}
void DialogTextInput::doDraw(MacVenture::Dialog *dialog, Graphics::ManagedSurface &target) {
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 66136100b6..8ced27957d 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -594,7 +594,7 @@ void Gui::drawMainGameWindow() {
if (DebugMan.isDebugChannelEnabled(kMVDebugGUI)) {
Graphics::MacWindow *win = findWindow(data.refcon);
- Common::Rect innerDims = win->getInnerDimensions();
+ Common::Rect innerDims = win->getInnerDimensions();
int x = win->getDimensions().left;
int y = win->getDimensions().top;
innerDims.translate(-x, -y);
@@ -624,7 +624,7 @@ void Gui::drawInventories() {
if (DebugMan.isDebugChannelEnabled(kMVDebugGUI)) {
Graphics::MacWindow *win = findWindow(data.refcon);
- Common::Rect innerDims = win->getInnerDimensions();
+ Common::Rect innerDims = win->getInnerDimensions();
int x = win->getDimensions().left;
int y = win->getDimensions().top;
innerDims.translate(-x, -y);
@@ -846,8 +846,7 @@ void Gui::updateExit(ObjID obj) {
_exitsData->remove_at(ctl);
if (!_engine->isHiddenExit(obj) &&
- _engine->getParent(obj) == _engine->getParent(1))
- {
+ _engine->getParent(obj) == _engine->getParent(1)) {
ControlData data;
data.titleLength = 0;
data.refcon = (ControlAction)obj; // Objects can be exits (actions)
@@ -1290,8 +1289,7 @@ bool Gui::processCommandEvents(WindowClick click, Common::Event &event) {
if (it->isInsideBounds(position)) {
it->select();
data = *it;
- }
- else {
+ } else {
it->unselect();
}
}
@@ -1357,8 +1355,7 @@ bool MacVenture::Gui::processExitsEvents(WindowClick click, Common::Event & even
button = *it;
_engine->handleObjectSelect(button.getData().refcon, kExitsWindow, false, false);
return true;
- }
- else {
+ } else {
it->unselect();
}
}
diff --git a/engines/macventure/image.cpp b/engines/macventure/image.cpp
index 812e2e3dad..1b0e59d565 100644
--- a/engines/macventure/image.cpp
+++ b/engines/macventure/image.cpp
@@ -122,8 +122,7 @@ void ImageAsset::decodePPIC(ObjID id, Common::Array<byte> &data, uint &bitHeight
data.push_back(0);
}
- switch (mode)
- {
+ switch (mode) {
case MacVenture::kPPIC0:
decodePPIC0(stream, data, bitHeight, bitWidth, rowBytes);
break;
@@ -279,8 +278,7 @@ void ImageAsset::decodeHuffGraphic(const PPICHuff & huff, Common::BitStream & st
for (uint y = 0; y < bitHeight; y++) {
uint16 v = 0;
if (flags & 2) {
- for (uint x = 0; x < rowBytes; x++)
- {
+ for (uint x = 0; x < rowBytes; x++) {
data[pos] ^= v;
v = data[pos];
pos++;
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 1244c83d16..76a4791572 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -393,12 +393,7 @@ void MacVentureEngine::handleObjectSelect(ObjID objID, WindowReference win, bool
} else {
if (objID == 0) {
unselectAll();
- //if (windata.type == kAnimateBack) {
- //doLasso(win, event, canDrag);
- //}
- //else {
- objID = win;
- //}
+ objID = win;
}
if (objID > 0) {
int currentObjectIndex = findObjectInArray(objID, _currentSelection);
@@ -543,10 +538,9 @@ bool MacVenture::MacVentureEngine::runScriptEngine() {
updateState(true);
}
}
- if (_selectedControl == 1)
+ if (_selectedControl == 1) {
_gameChanged = false;
-
- else if (isGameRunning()) {
+ } else if (isGameRunning()) {
if (_scriptEngine->runControl(kTick, _selectedControl, _destObject, _deltaPoint)) {
_haltedAtEnd = true;
return true;
@@ -1024,7 +1018,7 @@ ObjID MacVentureEngine::getParent(ObjID objID) {
Common::Rect MacVentureEngine::getObjBounds(ObjID objID) {
Common::Point pos = getObjPosition(objID);
- WindowReference win = findParentWindow(objID);
+ WindowReference win = findParentWindow(objID);
if (win != kNoWindow) { // If it's not in a window YET, we don't really care about the border
BorderBounds bounds = borderBounds(_gui->getWindowData(win).type); // HACK
pos.x += bounds.leftOffset;
@@ -1045,8 +1039,7 @@ uint MacVentureEngine::getOverlapPercent(ObjID one, ObjID other) {
Common::Rect oneBounds = getObjBounds(one);
Common::Rect otherBounds = getObjBounds(other);
if (otherBounds.intersects(oneBounds) ||
- oneBounds.intersects(otherBounds))
- {
+ oneBounds.intersects(otherBounds)) {
uint areaOne = oneBounds.width() * oneBounds.height();
uint areaOther = otherBounds.width() * otherBounds.height();
return (areaOther * 100 / areaOne) | 0;
diff --git a/engines/macventure/module.mk b/engines/macventure/module.mk
index 7b81018394..ee240269fc 100644
--- a/engines/macventure/module.mk
+++ b/engines/macventure/module.mk
@@ -1,21 +1,20 @@
MODULE := engines/macventure
MODULE_OBJS := \
- image.o \
+ controls.o \
+ datafiles.o \
detection.o \
- object.o \
- text.o \
- world.o \
- script.o \
- macventure.o \
- gui.o \
dialog.o \
- controls.o \
+ gui.o \
+ image.o \
+ macventure.o \
prebuilt_dialogs.o \
- windows.o \
- sound.o \
saveload.o \
- datafiles.o
+ script.o \
+ sound.o \
+ text.o \
+ windows.o \
+ world.o
MODULE_DIRS += \
diff --git a/engines/macventure/object.cpp b/engines/macventure/object.cpp
deleted file mode 100644
index 18a734ccd1..0000000000
--- a/engines/macventure/object.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-*/
-
-#include "macventure/object.h"
-
-namespace MacVenture {
-
-Object::Object() {}
-Object::~Object() {}
-
-} // End of namespace MacVenture \ No newline at end of file
diff --git a/engines/macventure/object.h b/engines/macventure/object.h
deleted file mode 100644
index 1712ec6c17..0000000000
--- a/engines/macventure/object.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-*/
-
-#ifndef MACVENTURE_OBJECT_H
-#define MACVENTURE_OBJECT_H
-
-#include "macventure/macventure.h"
-
-namespace MacVenture {
-
-class Object {
-public:
- Object();
- ~Object();
-};
-
-} // End of namespace MacVenture
-
-#endif \ No newline at end of file
diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp
index 5aa8e3cc19..3dc9509555 100644
--- a/engines/macventure/script.cpp
+++ b/engines/macventure/script.cpp
@@ -648,17 +648,13 @@ void ScriptEngine::op95SORT(EngineState * state, EngineFrame * frame) {
if (step<0) step += num;
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;
- if (start == end)
- {
+ if (start == end) {
end++;
start = end;
- }
- else
- {
+ } else {
word a = state->peek(end);
word b = state->peek(start);
state->poke(end, b);
diff --git a/engines/macventure/sound.cpp b/engines/macventure/sound.cpp
index 455a1916ac..eb0941607c 100644
--- a/engines/macventure/sound.cpp
+++ b/engines/macventure/sound.cpp
@@ -56,7 +56,7 @@ uint32 SoundManager::playSound(ObjID sound) {
void SoundManager::ensureLoaded(ObjID sound) {
if (!_assets.contains(sound))
- _assets[sound] = new SoundAsset(_container, sound);
+ _assets[sound] = new SoundAsset(_container, sound);
}
SoundAsset::SoundAsset(Container *container, ObjID id) :
diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp
index 745def2cc4..095b0f3332 100644
--- a/engines/macventure/text.cpp
+++ b/engines/macventure/text.cpp
@@ -34,8 +34,7 @@ TextAsset::TextAsset(MacVentureEngine *engine, ObjID objid, ObjID source, ObjID
if (_isOld) {
decodeOld();
- }
- else {
+ } else {
decodeHuffman();
}
}
@@ -51,35 +50,28 @@ void TextAsset::decodeOld() {
char val = stream.getBits(5);
if (val == 0x0) { // Space
c = ' ';
- }
- else if (val >= 0x1 && val <= 0x1A) {
+ } else if (val >= 0x1 && val <= 0x1A) {
if (lowercase) { // Ascii a-z
c = val + 0x60;
- }
- else { // Ascii A-Z
+ } else { // Ascii A-Z
c = val + 0x40;
}
lowercase = true;
- }
- else if (val == 0x1B) {
+ } else if (val == 0x1B) {
if (lowercase) {
c = '.';
- }
- else {
+ } else {
c = ',';
}
lowercase = true;
- }
- else if (val == 0x1C) {
+ } else if (val == 0x1C) {
if (lowercase) {
c = 0x27; // Ascii '
- }
- else {
+ } else {
c = 0x22; // Ascii '"'
}
lowercase = true;
- }
- else if (val == 0x1D) { // Composite
+ } else if (val == 0x1D) { // Composite
ObjID subval = stream.getBits(16);
Common::String child;
if (subval & 0x8000) {
@@ -95,15 +87,12 @@ void TextAsset::decodeOld() {
c = '?'; // HACK Will fix later, should append
}
lowercase = true;
- }
- else if (val == 0x1E) {
+ } else if (val == 0x1E) {
c = stream.getBits(8);
lowercase = true;
- }
- else if (val == 0x1F) {
+ } else if (val == 0x1F) {
lowercase = !lowercase;
- }
- else {
+ } else {
warning("Unrecognized char in old text %d, pos %d", _id, i);
}
str[i] = c;
@@ -121,8 +110,7 @@ void TextAsset::decodeHuffman() {
uint16 strLen = 0;
if (stream.getBit()) {
strLen = stream.getBits(15);
- }
- else {
+ } else {
strLen = stream.getBits(7);
}
// OK up to here
@@ -179,22 +167,19 @@ void TextAsset::decodeHuffman() {
Common::String TextAsset::getNoun(ObjID subval) {
ObjID obj;
Common::String name;
- if (subval & 8)
+ if (subval & 8) {
obj = _targetObj;
- else
+ } else {
obj = _sourceObj;
- if ((subval & 3) == 1)
- {
+ }
+ if ((subval & 3) == 1) {
uint idx = _engine->getPrefixNdx(obj);
idx = ((idx >> 4) & 3) + 1;
name = _engine->getNoun(idx);
- }
- else
- {
+ } else {
// HACK, there should be a pool of assets or something like in the GUI
name = *TextAsset(_engine, obj, _sourceObj, _targetObj, _container, _isOld, _huffman).decode();
- switch (subval & 3)
- {
+ switch (subval & 3) {
case 2:
name = _engine->getPrefixString(0, obj) + name;
break;
diff --git a/engines/macventure/windows.h b/engines/macventure/windows.h
index fe3f9275d0..1727698ad4 100644
--- a/engines/macventure/windows.h
+++ b/engines/macventure/windows.h
@@ -27,7 +27,7 @@
#include "common/array.h"
namespace MacVenture {
- // massive HACK
+// massive HACK
typedef uint32 ObjID;
enum WindowReference {
@@ -92,7 +92,7 @@ struct BorderBounds {
uint16 bottomOffset;
BorderBounds(uint16 l, uint16 t, uint16 r, uint16 b) :
- leftOffset(l), topOffset(t), rightOffset(r), bottomOffset(b) {}
+ leftOffset(l), topOffset(t), rightOffset(r), bottomOffset(b) {}
};
}
#endif
diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp
index 20695dbff6..35cfbd1533 100644
--- a/engines/macventure/world.cpp
+++ b/engines/macventure/world.cpp
@@ -5,7 +5,7 @@
namespace MacVenture {
-World::World(MacVentureEngine *engine, Common::MacResManager *resMan) {
+World::World(MacVentureEngine *engine, Common::MacResManager *resMan) {
_resourceManager = resMan;
_engine = engine;
_saveGame = NULL;
@@ -104,7 +104,7 @@ bool MacVenture::World::isObjActive(ObjID obj) {
if (!getAncestor(obj)) return false; // If our ancestor is the garbage (obj 0), we're inactive
if (_engine->getInvolvedObjects() >= 2 && // If (we need > 1 objs for the command) &&
destObj > 0 && // we have a destination object &&
- !getAncestor(destObj)) // but that destination object is in the garbage
+ !getAncestor(destObj)) // but that destination object is in the garbage
return false;
if (selectedControl != kMoveObject) return true; // We only need one
// Handle move object