Skip to content

Commit

Permalink
ZVISION: Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Oct 10, 2014
1 parent ac74070 commit a65ec38
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 43 deletions.
14 changes: 9 additions & 5 deletions engines/zvision/scripting/control.h
Expand Up @@ -40,7 +40,7 @@ class ZVision;
class Control {
public:

enum ControlType {
enum ControlType {
CONTROL_UNKNOW,
CONTROL_INPUT,
CONTROL_PUSHTGL,
Expand All @@ -63,7 +63,7 @@ class Control {
}

ControlType getType() {
return _type;
return _type;
}

virtual void focus() {}
Expand Down Expand Up @@ -101,13 +101,17 @@ class Control {
*
* @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.
*
Expand All @@ -130,7 +134,7 @@ class Control {
static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream);
static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream);
private:
ControlType _type;
ControlType _type;
};

// TODO: Implement InputControl
Expand Down
30 changes: 15 additions & 15 deletions engines/zvision/scripting/controls/fist_control.cpp
Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions engines/zvision/scripting/controls/paint_control.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion engines/zvision/scripting/controls/paint_control.h
Expand Up @@ -59,7 +59,9 @@ class PaintControl : public Control {
*/
bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);

bool process(uint32 deltaTimeInMillis) { return false; };
bool process(uint32 deltaTimeInMillis) {
return false;
};

private:
/**
Expand Down
4 changes: 2 additions & 2 deletions engines/zvision/scripting/controls/safe_control.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
36 changes: 18 additions & 18 deletions engines/zvision/scripting/script_manager.cpp
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit a65ec38

Please sign in to comment.