From a65ec38f8ddfb2a856619880d005ccd1a766623a Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Fri, 10 Oct 2014 16:50:59 +0700 Subject: ZVISION: Fix code style --- engines/zvision/scripting/control.h | 14 ++++++--- .../zvision/scripting/controls/fist_control.cpp | 30 +++++++++--------- .../zvision/scripting/controls/paint_control.cpp | 4 +-- engines/zvision/scripting/controls/paint_control.h | 4 ++- .../zvision/scripting/controls/safe_control.cpp | 4 +-- engines/zvision/scripting/script_manager.cpp | 36 +++++++++++----------- 6 files changed, 49 insertions(+), 43 deletions(-) (limited to 'engines/zvision') diff --git a/engines/zvision/scripting/control.h b/engines/zvision/scripting/control.h index 7c8a273419..8708f033af 100644 --- a/engines/zvision/scripting/control.h +++ b/engines/zvision/scripting/control.h @@ -40,7 +40,7 @@ class ZVision; class Control { public: - enum ControlType { + enum ControlType { CONTROL_UNKNOW, CONTROL_INPUT, CONTROL_PUSHTGL, @@ -63,7 +63,7 @@ public: } ControlType getType() { - return _type; + return _type; } virtual void focus() {} @@ -101,13 +101,17 @@ public: * * @param keycode The key that was pressed */ - virtual bool onKeyDown(Common::KeyState keyState) {return false;} + virtual bool onKeyDown(Common::KeyState keyState) { + return false; + } /** * Called when a key is released. Default is NOP. * * @param keycode The key that was pressed */ - virtual bool onKeyUp(Common::KeyState keyState) {return false;} + virtual bool onKeyUp(Common::KeyState keyState) { + return false; + } /** * Processes the node given the deltaTime since last frame. Default is NOP. * @@ -130,7 +134,7 @@ public: static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream); static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); private: - ControlType _type; + ControlType _type; }; // TODO: Implement InputControl diff --git a/engines/zvision/scripting/controls/fist_control.cpp b/engines/zvision/scripting/controls/fist_control.cpp index 46b87ddb79..89aeb53be6 100644 --- a/engines/zvision/scripting/controls/fist_control.cpp +++ b/engines/zvision/scripting/controls/fist_control.cpp @@ -121,17 +121,17 @@ bool FistControl::process(uint32 deltaTimeInMillis) { if (_frameCur <= _frameEnd) { _frameTime -= deltaTimeInMillis; - if (_frameTime <= 0) { - _frameTime = _animation->frameTime(); + if (_frameTime <= 0) { + _frameTime = _animation->frameTime(); - renderFrame(_frameCur); + renderFrame(_frameCur); - _frameCur++; + _frameCur++; - if (_frameCur > _frameEnd) - _engine->getScriptManager()->setStateValue(_animationId, 2); + if (_frameCur > _frameEnd) + _engine->getScriptManager()->setStateValue(_animationId, 2); + } } - } return false; } @@ -142,7 +142,7 @@ bool FistControl::onMouseMove(const Common::Point &screenSpacePos, const Common: if (mouseIn(screenSpacePos, backgroundImageSpacePos) >= 0) { _engine->getCursorManager()->changeCursor(_cursor); - return true; + return true; } return false; @@ -160,7 +160,7 @@ bool FistControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P uint32 oldStatus = _fiststatus; _fiststatus ^= (1 << n_fist); - for(int i = 0; i < _numEntries; i++) + for (int i = 0; i < _numEntries; i++) if (_entries[i]._bitsStrt == oldStatus && _entries[i]._bitsEnd == _fiststatus) { _frameCur = _entries[i]._anmStrt; _frameEnd = _entries[i]._anmEnd; @@ -264,25 +264,25 @@ uint32 FistControl::readBits(const char *str) { int FistControl::mouseIn(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (_order) { - for(int i = 0; i < _fistnum; i++) { + for (int i = 0; i < _fistnum; i++) { if (((_fiststatus >> i) & 1) == 1) { - for(uint j = 0; j < _fistsDwn[i].size(); j++) + for (uint j = 0; j < _fistsDwn[i].size(); j++) if ((_fistsDwn[i])[j].contains(backgroundImageSpacePos)) return i; } else { - for(uint j = 0; j < _fistsUp[i].size(); j++) + for (uint j = 0; j < _fistsUp[i].size(); j++) if ((_fistsUp[i])[j].contains(backgroundImageSpacePos)) return i; } } } else { - for(int i = _fistnum - 1; i >= 0; i--) { + for (int i = _fistnum - 1; i >= 0; i--) { if (((_fiststatus >> i) & 1) == 1) { - for(uint j = 0; j < _fistsDwn[i].size(); j++) + for (uint j = 0; j < _fistsDwn[i].size(); j++) if ((_fistsDwn[i])[j].contains(backgroundImageSpacePos)) return i; } else { - for(uint j = 0; j < _fistsUp[i].size(); j++) + for (uint j = 0; j < _fistsUp[i].size(); j++) if ((_fistsUp[i])[j].contains(backgroundImageSpacePos)) return i; } diff --git a/engines/zvision/scripting/controls/paint_control.cpp b/engines/zvision/scripting/controls/paint_control.cpp index a350e9b599..2891f1b1f9 100644 --- a/engines/zvision/scripting/controls/paint_control.cpp +++ b/engines/zvision/scripting/controls/paint_control.cpp @@ -98,7 +98,7 @@ PaintControl::PaintControl(ZVision *engine, uint32 key, Common::SeekableReadStre } if (_paint) { - _colorKey = _paint->format.RGBToColor(255,0,255); + _colorKey = _paint->format.RGBToColor(255, 0, 255); _bkg = new Graphics::Surface; _bkg->create(_rectangle.width(), _rectangle.height(), _paint->format); _bkg->fillRect(Common::Rect(_rectangle.width(), _rectangle.height()), _colorKey); @@ -194,7 +194,7 @@ Common::Rect PaintControl::paint(const Common::Point &point) { brush_rect.translate(-point.x, -point.y); Common::Rect bkg_rect = paint_rect; - bkg_rect.translate( -_rectangle.left, -_rectangle.top ); + bkg_rect.translate(-_rectangle.left, -_rectangle.top); for (int yy = 0; yy < brush_rect.height(); yy++) { uint16 *mask = (uint16 *)_brush->getBasePtr(brush_rect.left, brush_rect.top + yy); diff --git a/engines/zvision/scripting/controls/paint_control.h b/engines/zvision/scripting/controls/paint_control.h index c74431e681..54b96e8e4e 100644 --- a/engines/zvision/scripting/controls/paint_control.h +++ b/engines/zvision/scripting/controls/paint_control.h @@ -59,7 +59,9 @@ public: */ bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); - bool process(uint32 deltaTimeInMillis) { return false; }; + bool process(uint32 deltaTimeInMillis) { + return false; + }; private: /** diff --git a/engines/zvision/scripting/controls/safe_control.cpp b/engines/zvision/scripting/controls/safe_control.cpp index d5eff09502..ba809148a3 100644 --- a/engines/zvision/scripting/controls/safe_control.cpp +++ b/engines/zvision/scripting/controls/safe_control.cpp @@ -83,7 +83,7 @@ SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream int y; sscanf(values.c_str(), "%d %d", &x, &y); - _center = Common::Point(x,y); + _center = Common::Point(x, y); } else if (param.matchString("dial_inner_radius", true)) { _radius_inner = atoi(values.c_str()); _radius_inner_sq = _radius_inner * _radius_inner; @@ -188,7 +188,7 @@ bool SafeControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P int16 m_state = (_num_states - ((((int16)dd + 540) % 360) / dp_state)) % _num_states; - int16 tmp2 = (m_state + _cur_state - _zero_pointer + _num_states - 1 ) % _num_states; + int16 tmp2 = (m_state + _cur_state - _zero_pointer + _num_states - 1) % _num_states; _cur_frame = (_cur_state + _num_states - _start_pointer) % _num_states; diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp index 7a2854d230..fea3c2e199 100644 --- a/engines/zvision/scripting/script_manager.cpp +++ b/engines/zvision/scripting/script_manager.cpp @@ -160,28 +160,28 @@ void ScriptManager::updateControls(uint deltaTimeMillis) { Common::Event _event = _controlEvents.front(); Common::Point imageCoord; switch (_event.type) { - case Common::EVENT_LBUTTONDOWN: - imageCoord = _engine->getRenderManager()->screenSpaceToImageSpace(_event.mouse); - onMouseDown(_event.mouse, imageCoord); - break; - case Common::EVENT_LBUTTONUP: - imageCoord = _engine->getRenderManager()->screenSpaceToImageSpace(_event.mouse); - onMouseUp(_event.mouse, imageCoord); - break; - case Common::EVENT_KEYDOWN: - onKeyDown(_event.kbd); - break; - case Common::EVENT_KEYUP: - onKeyUp(_event.kbd); - break; - default: - break; + case Common::EVENT_LBUTTONDOWN: + imageCoord = _engine->getRenderManager()->screenSpaceToImageSpace(_event.mouse); + onMouseDown(_event.mouse, imageCoord); + break; + case Common::EVENT_LBUTTONUP: + imageCoord = _engine->getRenderManager()->screenSpaceToImageSpace(_event.mouse); + onMouseUp(_event.mouse, imageCoord); + break; + case Common::EVENT_KEYDOWN: + onKeyDown(_event.kbd); + break; + case Common::EVENT_KEYUP: + onKeyUp(_event.kbd); + break; + default: + break; } _controlEvents.pop_front(); } for (ControlList::iterator iter = _activeControls->begin(); iter != _activeControls->end(); iter++) - if ( (*iter)->process(deltaTimeMillis) ) + if ((*iter)->process(deltaTimeMillis)) break; } @@ -540,7 +540,7 @@ void ScriptManager::do_changeLocation() { if (_nextLocation.world == 'g' && _nextLocation.room == 'j') { if (_nextLocation.node == 's' && _nextLocation.view == 'e' && - _currentLocation.world != 'g' && _currentLocation.room != 'j') + _currentLocation.world != 'g' && _currentLocation.room != 'j') _engine->getSaveManager()->prepareSaveBuffer(); } else { if (_currentLocation.world == 'g' && _currentLocation.room == 'j') -- cgit v1.2.3