diff options
Diffstat (limited to 'engines/zvision/scripting')
32 files changed, 453 insertions, 501 deletions
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 31f68d7953..8ff6bd0496 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -275,7 +275,7 @@ bool ActionDissolve::execute() { ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { - sscanf(line.c_str(), "%hd %hd %f %f %f %f", &_distSlot, &_speed, &_st_angl, &_en_angl, &_st_lin, &_en_lin); + sscanf(line.c_str(), "%hd %hd %f %f %f %f", &_distSlot, &_speed, &_startAngle, &_endAngle, &_startLineScale, &_endLineScale); } ActionDistort::~ActionDistort() { @@ -286,7 +286,7 @@ bool ActionDistort::execute() { if (_engine->getScriptManager()->getSideFX(_distSlot)) return true; - _engine->getScriptManager()->addSideFX(new DistortNode(_engine, _distSlot, _speed, _st_angl, _en_angl, _st_lin, _en_lin)); + _engine->getScriptManager()->addSideFX(new DistortNode(_engine, _distSlot, _speed, _startAngle, _endAngle, _startLineScale, _endLineScale)); return true; } @@ -345,22 +345,22 @@ ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::S bool ActionInventory::execute() { switch (_type) { case 0: // add - _engine->getScriptManager()->invertory_add(_key); + _engine->getScriptManager()->inventoryAdd(_key); break; case 1: // addi - _engine->getScriptManager()->invertory_add(_engine->getScriptManager()->getStateValue(_key)); + _engine->getScriptManager()->inventoryAdd(_engine->getScriptManager()->getStateValue(_key)); break; case 2: // drop if (_key >= 0) - _engine->getScriptManager()->invertory_drop(_key); + _engine->getScriptManager()->inventoryDrop(_key); else - _engine->getScriptManager()->invertory_drop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem)); + _engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem)); break; case 3: // dropi - _engine->getScriptManager()->invertory_drop(_engine->getScriptManager()->getStateValue(_key)); + _engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(_key)); break; case 4: // cycle - _engine->getScriptManager()->invertory_cycle(); + _engine->getScriptManager()->inventoryCycle(); break; default: break; @@ -463,20 +463,20 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l ActionMusic::~ActionMusic() { if (!_universe) - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionMusic::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; if (_midi) { - _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotkey, _prog, _note, _volume)); + _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, _volume)); } else { if (!_engine->getSearchManager()->hasFile(_fileName)) return true; - _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotkey, _fileName, _loop, _volume)); + _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, _volume)); } return true; @@ -489,20 +489,20 @@ bool ActionMusic::execute() { ActionPanTrack::ActionPanTrack(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey), _pos(0), - _mus_slot(0) { + _musicSlot(0) { - sscanf(line.c_str(), "%u %d", &_mus_slot, &_pos); + sscanf(line.c_str(), "%u %d", &_musicSlot, &_pos); } ActionPanTrack::~ActionPanTrack() { - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionPanTrack::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new PanTrackNode(_engine, _slotkey, _mus_slot, _pos)); + _engine->getScriptManager()->addSideFX(new PanTrackNode(_engine, _slotKey, _musicSlot, _pos)); return true; } @@ -549,18 +549,18 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c } ActionPreloadAnimation::~ActionPreloadAnimation() { - _engine->getScriptManager()->deleteSideFx(_slotkey); + _engine->getScriptManager()->deleteSideFx(_slotKey); } bool ActionPreloadAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotkey); + AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotKey); if (!nod) { - nod = new AnimationNode(_engine, _slotkey, _fileName, _mask, _framerate, false); + nod = new AnimationNode(_engine, _slotKey, _fileName, _mask, _framerate, false); _engine->getScriptManager()->addSideFX(nod); } else nod->stop(); - _engine->getScriptManager()->setStateValue(_slotkey, 2); + _engine->getScriptManager()->setStateValue(_slotKey, 2); return true; } @@ -607,20 +607,20 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C } ActionPlayAnimation::~ActionPlayAnimation() { - _engine->getScriptManager()->deleteSideFx(_slotkey); + _engine->getScriptManager()->deleteSideFx(_slotKey); } bool ActionPlayAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotkey); + AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotKey); if (!nod) { - nod = new AnimationNode(_engine, _slotkey, _fileName, _mask, _framerate); + nod = new AnimationNode(_engine, _slotKey, _fileName, _mask, _framerate); _engine->getScriptManager()->addSideFX(nod); } else nod->stop(); if (nod) - nod->addPlayNode(_slotkey, _x, _y, _x2, _y2, _start, _end, _loopCount); + nod->addPlayNode(_slotKey, _x, _y, _x2, _y2, _start, _end, _loopCount); return true; } @@ -641,7 +641,7 @@ bool ActionPlayPreloadAnimation::execute() { AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_controlKey); if (nod) - nod->addPlayNode(_slotkey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount); + nod->addPlayNode(_slotKey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount); return true; } @@ -676,20 +676,20 @@ ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String } ActionRegion::~ActionRegion() { - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionRegion::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; Effect *effct = NULL; switch (_type) { case 0: { - uint16 s_x, s_y, frames; + uint16 centerX, centerY, frames; double amplitude, waveln, speed; - sscanf(_custom.c_str(), "%hu,%hu,%hu,%lf,%lf,%lf,", &s_x, &s_y, &frames, &litude, &waveln, &speed); - effct = new WaveFx(_engine, _slotkey, _rect, _unk1, frames, s_x, s_y, amplitude, waveln, speed); + sscanf(_custom.c_str(), "%hu,%hu,%hu,%lf,%lf,%lf,", ¢erX, ¢erY, &frames, &litude, &waveln, &speed); + effct = new WaveFx(_engine, _slotKey, _rect, _unk1, frames, centerX, centerY, amplitude, waveln, speed); } break; case 1: { @@ -701,7 +701,7 @@ bool ActionRegion::execute() { int8 minD; int8 maxD; EffectMap *_map = _engine->getRenderManager()->makeEffectMap(Common::Point(aX, aY), aD, _rect, &minD, &maxD); - effct = new LightFx(_engine, _slotkey, _rect, _unk1, _map, atoi(_custom.c_str()), minD, maxD); + effct = new LightFx(_engine, _slotKey, _rect, _unk1, _map, atoi(_custom.c_str()), minD, maxD); } break; case 9: { @@ -717,7 +717,7 @@ bool ActionRegion::execute() { _rect.setHeight(tempMask.h); EffectMap *_map = _engine->getRenderManager()->makeEffectMap(tempMask, 0); - effct = new FogFx(_engine, _slotkey, _rect, _unk1, _map, Common::String(buf)); + effct = new FogFx(_engine, _slotKey, _rect, _unk1, _map, Common::String(buf)); } break; default: @@ -725,7 +725,7 @@ bool ActionRegion::execute() { } if (effct) { - _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotkey, effct, _delay)); + _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotKey, effct, _delay)); _engine->getRenderManager()->addEffect(effct); } @@ -738,10 +738,10 @@ bool ActionRegion::execute() { ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { - char max_buf[64]; - memset(max_buf, 0, 64); - sscanf(line.c_str(), "%s", max_buf); - _max = new ValueSlot(_engine->getScriptManager(), max_buf); + char maxBuffer[64]; + memset(maxBuffer, 0, 64); + sscanf(line.c_str(), "%s", maxBuffer); + _max = new ValueSlot(_engine->getScriptManager(), maxBuffer); } ActionRandom::~ActionRandom() { @@ -751,7 +751,7 @@ ActionRandom::~ActionRandom() { bool ActionRandom::execute() { uint randNumber = _engine->getRandomSource()->getRandomNumber(_max->getValue()); - _engine->getScriptManager()->setStateValue(_slotkey, randNumber); + _engine->getScriptManager()->setStateValue(_slotKey, randNumber); return true; } @@ -941,9 +941,9 @@ bool ActionStreamVideo::execute() { ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { char fileName[25]; - int not_used; + int notUsed; - sscanf(line.c_str(), "%d %d %25s", &_syncto, ¬_used, fileName); + sscanf(line.c_str(), "%d %d %25s", &_syncto, ¬Used, fileName); _fileName = Common::String(fileName); } @@ -960,7 +960,7 @@ bool ActionSyncSound::execute() { if (animnode->getFrameDelay() > 200) // Hack for fix incorrect framedelay in some animpreload animnode->setNewFrameDelay(66); // ~15fps - _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotkey, _fileName, _syncto)); + _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); return true; } @@ -970,22 +970,22 @@ bool ActionSyncSound::execute() { ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { - char time_buf[64]; - memset(time_buf, 0, 64); - sscanf(line.c_str(), "%s", time_buf); - _time = new ValueSlot(_engine->getScriptManager(), time_buf); + char timeBuffer[64]; + memset(timeBuffer, 0, 64); + sscanf(line.c_str(), "%s", timeBuffer); + _time = new ValueSlot(_engine->getScriptManager(), timeBuffer); } ActionTimer::~ActionTimer() { if (_time) delete _time; - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionTimer::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new TimerNode(_engine, _slotkey, _time->getValue())); + _engine->getScriptManager()->addSideFX(new TimerNode(_engine, _slotKey, _time->getValue())); return true; } @@ -1003,13 +1003,13 @@ ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::Strin } ActionTtyText::~ActionTtyText() { - _engine->getScriptManager()->killSideFx(_slotkey); + _engine->getScriptManager()->killSideFx(_slotKey); } bool ActionTtyText::execute() { - if (_engine->getScriptManager()->getSideFX(_slotkey)) + if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new ttyTextNode(_engine, _slotkey, _filename, _r, _delay)); + _engine->getScriptManager()->addSideFX(new ttyTextNode(_engine, _slotKey, _filename, _r, _delay)); return true; } diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h index 5401af0876..03a249e580 100644 --- a/engines/zvision/scripting/actions.h +++ b/engines/zvision/scripting/actions.h @@ -41,7 +41,7 @@ class ValueSlot; */ class ResultAction { public: - ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotkey(slotkey) {} + ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotKey(slotkey) {} virtual ~ResultAction() {} /** * This is called by the script system whenever a Puzzle's criteria are found to be true. @@ -54,40 +54,8 @@ public: virtual bool execute() = 0; protected: ZVision *_engine; - int32 _slotkey; -}; - - -// The different types of actions -// DEBUG, -// DISABLE_CONTROL, -// DISABLE_VENUS, -// DISPLAY_MESSAGE, -// DISSOLVE, -// DISTORT, -// ENABLE_CONTROL, -// FLUSH_MOUSE_EVENTS, -// INVENTORY, -// KILL, -// MENU_BAR_ENABLE, -// MUSIC, -// PAN_TRACK, -// PLAY_PRELOAD, -// PREFERENCES, -// QUIT, -// RANDOM, -// REGION, -// RESTORE_GAME, -// ROTATE_TO, -// SAVE_GAME, -// SET_PARTIAL_SCREEN, -// SET_SCREEN, -// SET_VENUS, -// STOP, -// STREAM_VIDEO, -// SYNC_SOUND, -// TTY_TEXT, -// UNIVERSE_MUSIC, + int32 _slotKey; +}; class ActionAdd : public ResultAction { public: @@ -217,10 +185,10 @@ public: private: int16 _distSlot; int16 _speed; - float _st_angl; - float _en_angl; - float _st_lin; - float _en_lin; + float _startAngle; + float _endAngle; + float _startLineScale; + float _endLineScale; }; class ActionEnableControl : public ResultAction { @@ -290,7 +258,7 @@ public: private: int32 _pos; - uint32 _mus_slot; + uint32 _musicSlot; }; class ActionPlayAnimation : public ResultAction { diff --git a/engines/zvision/scripting/control.cpp b/engines/zvision/scripting/control.cpp index 9c8156961c..e69d57f75c 100644 --- a/engines/zvision/scripting/control.cpp +++ b/engines/zvision/scripting/control.cpp @@ -106,24 +106,24 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre renderTable->generateRenderTable(); } -void Control::getParams(const Common::String &input_str, Common::String ¶meter, Common::String &values) { - const char *chrs = input_str.c_str(); +void Control::getParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values) { + const char *chrs = inputStr.c_str(); uint lbr; - for (lbr = 0; lbr < input_str.size(); lbr++) + for (lbr = 0; lbr < inputStr.size(); lbr++) if (chrs[lbr] == '(') break; - if (lbr >= input_str.size()) + if (lbr >= inputStr.size()) return; uint rbr; - for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + for (rbr = lbr + 1; rbr < inputStr.size(); rbr++) if (chrs[rbr] == ')') break; - if (rbr >= input_str.size()) + if (rbr >= inputStr.size()) return; parameter = Common::String(chrs, chrs + lbr); @@ -131,9 +131,9 @@ void Control::getParams(const Common::String &input_str, Common::String ¶met } void Control::setVenus() { - if (_venus_id >= 0) - if (_engine->getScriptManager()->getStateValue(_venus_id) > 0) - _engine->getScriptManager()->setStateValue(StateKey_Venus, _venus_id); + if (_venusId >= 0) + if (_engine->getScriptManager()->getStateValue(_venusId) > 0) + _engine->getScriptManager()->setStateValue(StateKey_Venus, _venusId); } } // End of namespace ZVision diff --git a/engines/zvision/scripting/control.h b/engines/zvision/scripting/control.h index b784a66913..5814c9e419 100644 --- a/engines/zvision/scripting/control.h +++ b/engines/zvision/scripting/control.h @@ -54,7 +54,7 @@ public: CONTROL_PAINT }; - Control(ZVision *engine, uint32 key, ControlType type) : _engine(engine), _key(key), _type(type), _venus_id(-1) {} + Control(ZVision *engine, uint32 key, ControlType type) : _engine(engine), _key(key), _type(type), _venusId(-1) {} virtual ~Control() {} uint32 getKey() { @@ -120,14 +120,15 @@ public: virtual bool process(uint32 deltaTimeInMillis) { return false; } + void setVenus(); protected: ZVision *_engine; uint32 _key; - int32 _venus_id; + int32 _venusId; - void getParams(const Common::String &input_str, Common::String ¶meter, Common::String &values); + void getParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values); // Static member functions public: static void parseFlatControl(ZVision *engine); @@ -137,15 +138,6 @@ private: ControlType _type; }; -// TODO: Implement InputControl -// TODO: Implement SaveControl -// TODO: Implement SlotControl -// TODO: Implement SafeControl -// TODO: Implement FistControl -// TODO: Implement HotMovieControl -// TODO: Implement PaintControl -// TODO: Implement TilterControl - } // End of namespace ZVision #endif diff --git a/engines/zvision/scripting/controls/fist_control.cpp b/engines/zvision/scripting/controls/fist_control.cpp index 185bea09d2..9bb03cba51 100644 --- a/engines/zvision/scripting/controls/fist_control.cpp +++ b/engines/zvision/scripting/controls/fist_control.cpp @@ -80,7 +80,7 @@ FistControl::FistControl(ZVision *engine, uint32 key, Common::SeekableReadStream } else if (param.matchString("animation_id", true)) { _animationId = atoi(values.c_str()); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); @@ -152,13 +152,13 @@ bool FistControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - int n_fist = mouseIn(screenSpacePos, backgroundImageSpacePos); + int fistNumber = mouseIn(screenSpacePos, backgroundImageSpacePos); - if (n_fist >= 0) { + if (fistNumber >= 0) { setVenus(); uint32 oldStatus = _fiststatus; - _fiststatus ^= (1 << n_fist); + _fiststatus ^= (1 << fistNumber); for (int i = 0; i < _numEntries; i++) if (_entries[i]._bitsStrt == oldStatus && _entries[i]._bitsEnd == _fiststatus) { @@ -233,12 +233,12 @@ void FistControl::readDescFile(const Common::String &fileName) { (_fistsDwn[fist])[box] = Common::Rect(x1, y1, x2, y2); } else { int entry, start, end, sound; - char bits_start[33]; - char bits_end[33]; + char bitsStart[33]; + char bitsEnd[33]; entry = atoi(param.c_str()); - if (sscanf(values.c_str(), "%s %s %d %d (%d)", bits_start, bits_end, &start, &end, &sound) == 5) { - _entries[entry]._bitsStrt = readBits(bits_start); - _entries[entry]._bitsEnd = readBits(bits_end); + if (sscanf(values.c_str(), "%s %s %d %d (%d)", bitsStart, bitsEnd, &start, &end, &sound) == 5) { + _entries[entry]._bitsStrt = readBits(bitsStart); + _entries[entry]._bitsEnd = readBits(bitsEnd); _entries[entry]._anmStrt = start; _entries[entry]._anmEnd = end; _entries[entry]._sound = sound; @@ -293,24 +293,24 @@ int FistControl::mouseIn(const Common::Point &screenSpacePos, const Common::Poin return -1; } -void FistControl::getFistParams(const Common::String &input_str, Common::String ¶meter, Common::String &values) { - const char *chrs = input_str.c_str(); +void FistControl::getFistParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values) { + const char *chrs = inputStr.c_str(); uint lbr; - for (lbr = 0; lbr < input_str.size(); lbr++) + for (lbr = 0; lbr < inputStr.size(); lbr++) if (chrs[lbr] == ':') break; - if (lbr >= input_str.size()) + if (lbr >= inputStr.size()) return; uint rbr; - for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + for (rbr = lbr + 1; rbr < inputStr.size(); rbr++) if (chrs[rbr] == '~') break; - if (rbr >= input_str.size()) + if (rbr >= inputStr.size()) return; parameter = Common::String(chrs, chrs + lbr); diff --git a/engines/zvision/scripting/controls/fist_control.h b/engines/zvision/scripting/controls/fist_control.h index 8b229f964a..33c3c7b579 100644 --- a/engines/zvision/scripting/controls/fist_control.h +++ b/engines/zvision/scripting/controls/fist_control.h @@ -79,7 +79,7 @@ private: void clearFistArray(Common::Array< Common::Array<Common::Rect> > &arr); uint32 readBits(const char *str); int mouseIn(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); - void getFistParams(const Common::String &input_str, Common::String ¶meter, Common::String &values); + void getFistParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values); }; } // End of namespace ZVision diff --git a/engines/zvision/scripting/controls/hotmov_control.cpp b/engines/zvision/scripting/controls/hotmov_control.cpp index 6969ee1bfe..fd7afb92d1 100644 --- a/engines/zvision/scripting/controls/hotmov_control.cpp +++ b/engines/zvision/scripting/controls/hotmov_control.cpp @@ -44,12 +44,12 @@ HotMovControl::HotMovControl(ZVision *engine, uint32 key, Common::SeekableReadSt : Control(engine, key, CONTROL_HOTMOV) { _animation = NULL; _cycle = 0; - _cur_frame = -1; + _curFrame = -1; _lastRenderedFrame = -1; _frames.clear(); - _frame_time = 0; - _num_cycles = 0; - _num_frames = 0; + _frameTime = 0; + _cyclesCount = 0; + _framesCount = 0; _engine->getScriptManager()->setStateValue(_key, 0); @@ -73,16 +73,16 @@ HotMovControl::HotMovControl(ZVision *engine, uint32 key, Common::SeekableReadSt _rectangle = Common::Rect(x, y, width, height); } else if (param.matchString("num_frames", true)) { - _num_frames = atoi(values.c_str()); + _framesCount = atoi(values.c_str()); } else if (param.matchString("num_cycles", true)) { - _num_cycles = atoi(values.c_str()); + _cyclesCount = atoi(values.c_str()); } else if (param.matchString("animation", true)) { char filename[64]; sscanf(values.c_str(), "%s", filename); values = Common::String(filename); _animation = new MetaAnimation(values, _engine); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); @@ -117,21 +117,21 @@ bool HotMovControl::process(uint32 deltaTimeInMillis) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cycle < _num_cycles) { - _frame_time -= deltaTimeInMillis; + if (_cycle < _cyclesCount) { + _frameTime -= deltaTimeInMillis; - if (_frame_time <= 0) { - _cur_frame++; - if (_cur_frame >= _num_frames) { - _cur_frame = 0; + if (_frameTime <= 0) { + _curFrame++; + if (_curFrame >= _framesCount) { + _curFrame = 0; _cycle++; } - if (_cycle != _num_cycles) - renderFrame(_cur_frame); + if (_cycle != _cyclesCount) + renderFrame(_curFrame); else _engine->getScriptManager()->setStateValue(_key, 2); - _frame_time = _animation->frameTime(); + _frameTime = _animation->frameTime(); } } @@ -142,8 +142,8 @@ bool HotMovControl::onMouseMove(const Common::Point &screenSpacePos, const Commo if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cycle < _num_cycles) { - if (_frames[_cur_frame].contains(backgroundImageSpacePos)) { + if (_cycle < _cyclesCount) { + if (_frames[_curFrame].contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(CursorIndex_Active); return true; } @@ -156,8 +156,8 @@ bool HotMovControl::onMouseUp(const Common::Point &screenSpacePos, const Common: if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cycle < _num_cycles) { - if (_frames[_cur_frame].contains(backgroundImageSpacePos)) { + if (_cycle < _cyclesCount) { + if (_frames[_curFrame].contains(backgroundImageSpacePos)) { setVenus(); _engine->getScriptManager()->setStateValue(_key, 1); return true; @@ -168,7 +168,7 @@ bool HotMovControl::onMouseUp(const Common::Point &screenSpacePos, const Common: } void HotMovControl::readHsFile(const Common::String &fileName) { - if (_num_frames == 0) + if (_framesCount == 0) return; Common::File file; @@ -179,7 +179,7 @@ void HotMovControl::readHsFile(const Common::String &fileName) { Common::String line; - _frames.resize(_num_frames); + _frames.resize(_framesCount); while (!file.eos()) { line = file.readLine(); @@ -192,7 +192,7 @@ void HotMovControl::readHsFile(const Common::String &fileName) { sscanf(line.c_str(), "%d:%d %d %d %d~", &frame, &x, &y, &width, &height); - if (frame >= 0 && frame < _num_frames) + if (frame >= 0 && frame < _framesCount) _frames[frame] = Common::Rect(x, y, width, height); } file.close(); diff --git a/engines/zvision/scripting/controls/hotmov_control.h b/engines/zvision/scripting/controls/hotmov_control.h index ea12bab82b..9e01b40bab 100644 --- a/engines/zvision/scripting/controls/hotmov_control.h +++ b/engines/zvision/scripting/controls/hotmov_control.h @@ -39,12 +39,12 @@ public: ~HotMovControl(); private: - int32 _num_frames; - int32 _frame_time; - int32 _cur_frame; + int32 _framesCount; + int32 _frameTime; + int32 _curFrame; int32 _lastRenderedFrame; int32 _cycle; - int32 _num_cycles; + int32 _cyclesCount; MetaAnimation *_animation; Common::Rect _rectangle; Common::Array<Common::Rect> _frames; diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index 442c6cbc6a..8af436bb40 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -79,13 +79,13 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre sscanf(values.c_str(), "%u", &fontFormatNumber); - _string_init.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); + _stringInit.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); } else if (param.matchString("chooser_init_string", true)) { uint fontFormatNumber; sscanf(values.c_str(), "%u", &fontFormatNumber); - _string_chooser_init.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); + _stringChooserInit.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); } else if (param.matchString("next_tabstop", true)) { sscanf(values.c_str(), "%u", &_nextTabstop); } else if (param.matchString("cursor_dimensions", true)) { @@ -104,7 +104,7 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre _focused = true; _engine->getScriptManager()->setFocusControlKey(_key); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); @@ -201,9 +201,9 @@ bool InputControl::process(uint32 deltaTimeInMillis) { txt.create(_textRectangle.width(), _textRectangle.height(), _engine->_pixelFormat); if (!_readOnly || !_focused) - _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _string_init, txt); + _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt); else - _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _string_chooser_init, txt); + _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringChooserInit, txt); _engine->getRenderManager()->blitSurfaceToBkg(txt, _textRectangle.left, _textRectangle.top); @@ -211,15 +211,15 @@ bool InputControl::process(uint32 deltaTimeInMillis) { } if (_animation && !_readOnly && _focused) { - bool need_draw = true;// = _textChanged; + bool needDraw = true;// = _textChanged; _frameDelay -= deltaTimeInMillis; if (_frameDelay <= 0) { _frame = (_frame + 1) % _animation->frameCount(); _frameDelay = _animation->frameTime(); - need_draw = true; + needDraw = true; } - if (need_draw) { + if (needDraw) { const Graphics::Surface *srf = _animation->getFrameData(_frame); uint32 xx = _textRectangle.left + _txtWidth; if (xx >= _textRectangle.left + (_textRectangle.width() - _animation->width())) diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h index 5e2190f369..9a829d30f6 100644 --- a/engines/zvision/scripting/controls/input_control.h +++ b/engines/zvision/scripting/controls/input_control.h @@ -40,8 +40,8 @@ public: private: Common::Rect _textRectangle; Common::Rect _headerRectangle; - cTxtStyle _string_init; - cTxtStyle _string_chooser_init; + cTxtStyle _stringInit; + cTxtStyle _stringChooserInit; uint32 _nextTabstop; bool _focused; diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp index a9836b388e..1f176ef9d0 100644 --- a/engines/zvision/scripting/controls/lever_control.cpp +++ b/engines/zvision/scripting/controls/lever_control.cpp @@ -142,7 +142,7 @@ void LeverControl::parseLevFile(const Common::String &fileName) { _hotspotDelta.x = x; _hotspotDelta.y = y; } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } else { uint frameNumber; uint x, y; @@ -381,24 +381,24 @@ void LeverControl::renderFrame(uint frameNumber) { _engine->getRenderManager()->blitSurfaceToBkgScaled(*frameData, _animationCoords); } -void LeverControl::getLevParams(const Common::String &input_str, Common::String ¶meter, Common::String &values) { - const char *chrs = input_str.c_str(); +void LeverControl::getLevParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values) { + const char *chrs = inputStr.c_str(); uint lbr; - for (lbr = 0; lbr < input_str.size(); lbr++) + for (lbr = 0; lbr < inputStr.size(); lbr++) if (chrs[lbr] == ':') break; - if (lbr >= input_str.size()) + if (lbr >= inputStr.size()) return; uint rbr; - for (rbr = lbr + 1; rbr < input_str.size(); rbr++) + for (rbr = lbr + 1; rbr < inputStr.size(); rbr++) if (chrs[rbr] == '~') break; - if (rbr >= input_str.size()) + if (rbr >= inputStr.size()) return; parameter = Common::String(chrs, chrs + lbr); diff --git a/engines/zvision/scripting/controls/lever_control.h b/engines/zvision/scripting/controls/lever_control.h index 22789f777b..8de6d1e5c9 100644 --- a/engines/zvision/scripting/controls/lever_control.h +++ b/engines/zvision/scripting/controls/lever_control.h @@ -112,7 +112,7 @@ private: */ static int calculateVectorAngle(const Common::Point &pointOne, const Common::Point &pointTwo); void renderFrame(uint frameNumber); - void getLevParams(const Common::String &input_str, Common::String ¶meter, Common::String &values); + void getLevParams(const Common::String &inputStr, Common::String ¶meter, Common::String &values); }; } // End of namespace ZVision diff --git a/engines/zvision/scripting/controls/paint_control.cpp b/engines/zvision/scripting/controls/paint_control.cpp index 54c02a2568..cb3c17e0fd 100644 --- a/engines/zvision/scripting/controls/paint_control.cpp +++ b/engines/zvision/scripting/controls/paint_control.cpp @@ -64,7 +64,7 @@ PaintControl::PaintControl(ZVision *engine, uint32 key, Common::SeekableReadStre } else if (param.matchString("brush_file", true)) { _brush = _engine->getRenderManager()->loadImage(values, false); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } else if (param.matchString("paint_file", true)) { _paint = _engine->getRenderManager()->loadImage(values, false); } else if (param.matchString("eligible_objects", true)) { @@ -88,7 +88,7 @@ PaintControl::PaintControl(ZVision *engine, uint32 key, Common::SeekableReadStre int obj = atoi(st); - _eligible_objects.push_back(obj); + _eligibleObjects.push_back(obj); } } @@ -139,9 +139,9 @@ bool PaintControl::onMouseDown(const Common::Point &screenSpacePos, const Common return false; if (_rectangle.contains(backgroundImageSpacePos)) { - int mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); - if (eligeblity(mouse_item)) { + if (eligeblity(mouseItem)) { setVenus(); _mouseDown = true; } @@ -155,9 +155,9 @@ bool PaintControl::onMouseMove(const Common::Point &screenSpacePos, const Common return false; if (_rectangle.contains(backgroundImageSpacePos)) { - int mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); - if (eligeblity(mouse_item)) { + if (eligeblity(mouseItem)) { _engine->getCursorManager()->changeCursor(_cursor); if (_mouseDown) { @@ -178,30 +178,30 @@ bool PaintControl::onMouseMove(const Common::Point &screenSpacePos, const Common return false; } -bool PaintControl::eligeblity(int item_id) { - for (Common::List<int>::iterator it = _eligible_objects.begin(); it != _eligible_objects.end(); it++) - if (*it == item_id) +bool PaintControl::eligeblity(int itemId) { + for (Common::List<int>::iterator it = _eligibleObjects.begin(); it != _eligibleObjects.end(); it++) + if (*it == itemId) return true; return false; } Common::Rect PaintControl::paint(const Common::Point &point) { - Common::Rect paint_rect = Common::Rect(_brush->w, _brush->h); - paint_rect.moveTo(point); - paint_rect.clip(_rectangle); - - if (!paint_rect.isEmpty()) { - Common::Rect brush_rect = paint_rect; - brush_rect.translate(-point.x, -point.y); - - Common::Rect bkg_rect = paint_rect; - 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); - uint16 *from = (uint16 *)_paint->getBasePtr(bkg_rect.left, bkg_rect.top + yy); - uint16 *to = (uint16 *)_bkg->getBasePtr(bkg_rect.left, bkg_rect.top + yy); - for (int xx = 0; xx < brush_rect.width(); xx++) { + Common::Rect paintRect = Common::Rect(_brush->w, _brush->h); + paintRect.moveTo(point); + paintRect.clip(_rectangle); + + if (!paintRect.isEmpty()) { + Common::Rect brushRect = paintRect; + brushRect.translate(-point.x, -point.y); + + Common::Rect bkgRect = paintRect; + bkgRect.translate(-_rectangle.left, -_rectangle.top); + + for (int yy = 0; yy < brushRect.height(); yy++) { + uint16 *mask = (uint16 *)_brush->getBasePtr(brushRect.left, brushRect.top + yy); + uint16 *from = (uint16 *)_paint->getBasePtr(bkgRect.left, bkgRect.top + yy); + uint16 *to = (uint16 *)_bkg->getBasePtr(bkgRect.left, bkgRect.top + yy); + for (int xx = 0; xx < brushRect.width(); xx++) { if (*mask != 0) *(to + xx) = *(from + xx); @@ -210,7 +210,7 @@ Common::Rect PaintControl::paint(const Common::Point &point) { } } - return paint_rect; + return paintRect; } } // End of namespace ZVision diff --git a/engines/zvision/scripting/controls/paint_control.h b/engines/zvision/scripting/controls/paint_control.h index 54b96e8e4e..aac4755fcd 100644 --- a/engines/zvision/scripting/controls/paint_control.h +++ b/engines/zvision/scripting/controls/paint_control.h @@ -75,14 +75,14 @@ private: Graphics::Surface *_bkg; Graphics::Surface *_brush; - Common::List<int> _eligible_objects; + Common::List<int> _eligibleObjects; int _cursor; Common::Rect _rectangle; bool _mouseDown; - bool eligeblity(int item_id); + bool eligeblity(int itemId); Common::Rect paint(const Common::Point &point); }; diff --git a/engines/zvision/scripting/controls/push_toggle_control.cpp b/engines/zvision/scripting/controls/push_toggle_control.cpp index 561dd1dd20..ea4e947abe 100644 --- a/engines/zvision/scripting/controls/push_toggle_control.cpp +++ b/engines/zvision/scripting/controls/push_toggle_control.cpp @@ -75,7 +75,7 @@ PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::Seekab // Not used } } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); diff --git a/engines/zvision/scripting/controls/safe_control.cpp b/engines/zvision/scripting/controls/safe_control.cpp index 9df61ce341..de1ece5b19 100644 --- a/engines/zvision/scripting/controls/safe_control.cpp +++ b/engines/zvision/scripting/controls/safe_control.cpp @@ -43,18 +43,18 @@ namespace ZVision { SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) : Control(engine, key, CONTROL_SAFE) { - _num_states = 0; - _cur_state = 0; + _statesCount = 0; + _curState = 0; _animation = NULL; - _radius_inner = 0; - _radius_inner_sq = 0; - _radius_outer = 0; - _radius_outer_sq = 0; - _zero_pointer = 0; - _start_pointer = 0; - _cur_frame = -1; - _to_frame = 0; - _frame_time = 0; + _innerRaduis = 0; + _innerRadiusSqr = 0; + _outerRadius = 0; + _outerRadiusSqr = 0; + _zeroPointer = 0; + _startPointer = 0; + _curFrame = -1; + _targetFrame = 0; + _frameTime = 0; _lastRenderedFrame = -1; // Loop until we find the closing brace @@ -77,7 +77,7 @@ SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream _rectangle = Common::Rect(x, y, width, height); } else if (param.matchString("num_states", true)) { - _num_states = atoi(values.c_str()); + _statesCount = atoi(values.c_str()); } else if (param.matchString("center", true)) { int x; int y; @@ -85,29 +85,29 @@ SafeControl::SafeControl(ZVision *engine, uint32 key, Common::SeekableReadStream sscanf(values.c_str(), "%d %d", &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; + _innerRaduis = atoi(values.c_str()); + _innerRadiusSqr = _innerRaduis * _innerRaduis; } else if (param.matchString("radius", true)) { - _radius_outer = atoi(values.c_str()); - _radius_outer_sq = _radius_outer * _radius_outer; + _outerRadius = atoi(values.c_str()); + _outerRadiusSqr = _outerRadius * _outerRadius; } else if (param.matchString("zero_radians_offset", true)) { - _zero_pointer = atoi(values.c_str()); + _zeroPointer = atoi(values.c_str()); } else if (param.matchString("pointer_offset", true)) { - _start_pointer = atoi(values.c_str()); - _cur_state = _start_pointer; + _startPointer = atoi(values.c_str()); + _curState = _startPointer; } else if (param.matchString("cursor", true)) { // Not used } else if (param.matchString("mirrored", true)) { // Not used } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } line = stream.readLine(); trimCommentsAndWhiteSpace(&line); getParams(line, param, values); } - renderFrame(_cur_state); + renderFrame(_curState); } SafeControl::~SafeControl() { @@ -121,7 +121,7 @@ void SafeControl::renderFrame(uint frameNumber) { _lastRenderedFrame = frameNumber; } else if ((int16)frameNumber < _lastRenderedFrame) { _lastRenderedFrame = frameNumber; - frameNumber = (_num_states * 2) - frameNumber; + frameNumber = (_statesCount * 2) - frameNumber; } else { _lastRenderedFrame = frameNumber; } @@ -139,21 +139,20 @@ bool SafeControl::process(uint32 deltaTimeInMillis) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; - if (_cur_frame != _to_frame) { - _frame_time -= deltaTimeInMillis; + if (_curFrame != _targetFrame) { + _frameTime -= deltaTimeInMillis; - if (_frame_time <= 0) { - if (_cur_frame < _to_frame) { - _cur_frame++; - renderFrame(_cur_frame); - } else if (_cur_frame > _to_frame) { - _cur_frame--; - renderFrame(_cur_frame); + if (_frameTime <= 0) { + if (_curFrame < _targetFrame) { + _curFrame++; + renderFrame(_curFrame); + } else if (_curFrame > _targetFrame) { + _curFrame--; + renderFrame(_curFrame); } - _frame_time = _animation->frameTime(); + _frameTime = _animation->frameTime(); } } - return false; } @@ -163,12 +162,11 @@ bool SafeControl::onMouseMove(const Common::Point &screenSpacePos, const Common: if (_rectangle.contains(backgroundImageSpacePos)) { int32 mR = backgroundImageSpacePos.sqrDist(_center); - if (mR <= _radius_outer_sq && mR >= _radius_inner_sq) { + if (mR <= _outerRadiusSqr && mR >= _innerRadiusSqr) { _engine->getCursorManager()->changeCursor(CursorIndex_Active); return true; } } - return false; } @@ -178,30 +176,29 @@ bool SafeControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P if (_rectangle.contains(backgroundImageSpacePos)) { int32 mR = backgroundImageSpacePos.sqrDist(_center); - if (mR <= _radius_outer_sq && mR >= _radius_inner_sq) { + if (mR <= _outerRadiusSqr && mR >= _innerRadiusSqr) { setVenus(); Common::Point tmp = backgroundImageSpacePos - _center; float dd = atan2(tmp.x, tmp.y) * 57.29578; - int16 dp_state = 360 / _num_states; + int16 dp_state = 360 / _statesCount; - int16 m_state = (_num_states - ((((int16)dd + 540) % 360) / dp_state)) % _num_states; + int16 m_state = (_statesCount - ((((int16)dd + 540) % 360) / dp_state)) % _statesCount; - int16 tmp2 = (m_state + _cur_state - _zero_pointer + _num_states - 1) % _num_states; + int16 tmp2 = (m_state + _curState - _zeroPointer + _statesCount - 1) % _statesCount; - _cur_frame = (_cur_state + _num_states - _start_pointer) % _num_states; + _curFrame = (_curState + _statesCount - _startPointer) % _statesCount; - _cur_state = (_num_states * 2 + tmp2) % _num_states; + _curState = (_statesCount * 2 + tmp2) % _statesCount; - _to_frame = (_cur_state + _num_states - _start_pointer) % _num_states; + _targetFrame = (_curState + _statesCount - _startPointer) % _statesCount; - _engine->getScriptManager()->setStateValue(_key, _cur_state); + _engine->getScriptManager()->setStateValue(_key, _curState); return true; } } - return false; } diff --git a/engines/zvision/scripting/controls/safe_control.h b/engines/zvision/scripting/controls/safe_control.h index 2477d8c26d..e682e35050 100644 --- a/engines/zvision/scripting/controls/safe_control.h +++ b/engines/zvision/scripting/controls/safe_control.h @@ -40,20 +40,20 @@ public: ~SafeControl(); private: - int16 _num_states; - int16 _cur_state; + int16 _statesCount; + int16 _curState; MetaAnimation *_animation; Common::Point _center; Common::Rect _rectangle; - int16 _radius_inner; - int32 _radius_inner_sq; - int16 _radius_outer; - int32 _radius_outer_sq; - int16 _zero_pointer; - int16 _start_pointer; - int16 _cur_frame; - int16 _to_frame; - int32 _frame_time; + int16 _innerRaduis; + int32 _innerRadiusSqr; + int16 _outerRadius; + int32 _outerRadiusSqr; + int16 _zeroPointer; + int16 _startPointer; + int16 _curFrame; + int16 _targetFrame; + int32 _frameTime; int16 _lastRenderedFrame; diff --git a/engines/zvision/scripting/controls/save_control.cpp b/engines/zvision/scripting/controls/save_control.cpp index a0b19db513..7e1a65a9cc 100644 --- a/engines/zvision/scripting/controls/save_control.cpp +++ b/engines/zvision/scripting/controls/save_control.cpp @@ -50,13 +50,13 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream while (!stream.eos() && !line.contains('}')) { if (param.matchString("savebox", true)) { - int save_id; - int input_id; + int saveId; + int inputId; - sscanf(values.c_str(), "%d %d", &save_id, &input_id); - save_elmnt elmnt; - elmnt.input_key = input_id; - elmnt.save_id = save_id; + sscanf(values.c_str(), "%d %d", &saveId, &inputId); + saveElement elmnt; + elmnt.inputKey = inputId; + elmnt.saveId = saveId; elmnt.exist = false; _inputs.push_back(elmnt); } else if (param.matchString("control_type", true)) { @@ -72,11 +72,11 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream } for (saveElmntList::iterator iter = _inputs.begin(); iter != _inputs.end(); ++iter) { - Control *ctrl = _engine->getScriptManager()->getControl(iter->input_key); + Control *ctrl = _engine->getScriptManager()->getControl(iter->inputKey); if (ctrl && ctrl->getType() == Control::CONTROL_INPUT) { InputControl *inp = (InputControl *)ctrl; inp->setReadOnly(!_saveControl); - Common::SeekableReadStream *save = _engine->getSaveManager()->getSlotFile(iter->save_id); + Common::SeekableReadStream *save = _engine->getSaveManager()->getSlotFile(iter->saveId); if (save) { SaveGameHeader header; _engine->getSaveManager()->readSaveGameHeader(save, header); @@ -90,7 +90,7 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream bool SaveControl::process(uint32 deltaTimeInMillis) { for (saveElmntList::iterator iter = _inputs.begin(); iter != _inputs.end(); ++iter) { - Control *ctrl = _engine->getScriptManager()->getControl(iter->input_key); + Control *ctrl = _engine->getScriptManager()->getControl(iter->inputKey); if (ctrl && ctrl->getType() == Control::CONTROL_INPUT) { InputControl *inp = (InputControl *)ctrl; if (inp->enterPress()) { @@ -102,7 +102,7 @@ bool SaveControl::process(uint32 deltaTimeInMillis) { toSave = false; if (toSave) { - _engine->getSaveManager()->saveGameBuffered(iter->save_id, inp->getText()); + _engine->getSaveManager()->saveGameBuffered(iter->saveId, inp->getText()); _engine->delayedMessage(_engine->getStringManager()->getTextLine(StringManager::ZVISION_STR_SAVED), 2000); _engine->getScriptManager()->changeLocation(_engine->getScriptManager()->getLastMenuLocation()); } @@ -110,7 +110,7 @@ bool SaveControl::process(uint32 deltaTimeInMillis) { _engine->timedMessage(_engine->getStringManager()->getTextLine(StringManager::ZVISION_STR_SAVEEMPTY), 2000); } } else { - _engine->getSaveManager()->loadGame(iter->save_id); + _engine->getSaveManager()->loadGame(iter->saveId); return true; } break; diff --git a/engines/zvision/scripting/controls/save_control.h b/engines/zvision/scripting/controls/save_control.h index 942b9c9269..fefb0e0ce2 100644 --- a/engines/zvision/scripting/controls/save_control.h +++ b/engines/zvision/scripting/controls/save_control.h @@ -35,12 +35,12 @@ public: SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); private: - struct save_elmnt { - int save_id; - int input_key; + struct saveElement { + int saveId; + int inputKey; bool exist; }; - typedef Common::List<save_elmnt> saveElmntList; + typedef Common::List<saveElement> saveElmntList; saveElmntList _inputs; bool _saveControl; diff --git a/engines/zvision/scripting/controls/slot_control.cpp b/engines/zvision/scripting/controls/slot_control.cpp index 46ee320eb5..074d1905b4 100644 --- a/engines/zvision/scripting/controls/slot_control.cpp +++ b/engines/zvision/scripting/controls/slot_control.cpp @@ -38,7 +38,7 @@ namespace ZVision { SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) : Control(engine, key, CONTROL_SLOT) { - _rendered_item = 0; + _renderedItem = 0; _bkg = NULL; // Loop until we find the closing brace @@ -70,9 +70,9 @@ SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream } else if (param.matchString("cursor", true)) { _cursor = _engine->getCursorManager()->getCursorId(values); } else if (param.matchString("distance_id", true)) { - sscanf(values.c_str(), "%c", &_distance_id); + sscanf(values.c_str(), "%c", &_distanceId); } else if (param.matchString("venus_id", true)) { - _venus_id = atoi(values.c_str()); + _venusId = atoi(values.c_str()); } else if (param.matchString("eligible_objects", true)) { char buf[256]; memset(buf, 0, 256); @@ -94,7 +94,7 @@ SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream int obj = atoi(st); - _eligible_objects.push_back(obj); + _eligibleObjects.push_back(obj); } } @@ -124,26 +124,26 @@ bool SlotControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P setVenus(); int item = _engine->getScriptManager()->getStateValue(_key); - int mouse_item = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); + int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem); if (item != 0) { - if (mouse_item != 0) { - if (eligeblity(mouse_item)) { - _engine->getScriptManager()->invertory_drop(mouse_item); - _engine->getScriptManager()->invertory_add(item); - _engine->getScriptManager()->setStateValue(_key, mouse_item); + if (mouseItem != 0) { + if (eligeblity(mouseItem)) { + _engine->getScriptManager()->inventoryDrop(mouseItem); + _engine->getScriptManager()->inventoryAdd(item); + _engine->getScriptManager()->setStateValue(_key, mouseItem); } } else { - _engine->getScriptManager()->invertory_add(item); + _engine->getScriptManager()->inventoryAdd(item); _engine->getScriptManager()->setStateValue(_key, 0); } - } else if (mouse_item == 0) { + } else if (mouseItem == 0) { if (eligeblity(0)) { - _engine->getScriptManager()->invertory_drop(0); + _engine->getScriptManager()->inventoryDrop(0); _engine->getScriptManager()->setStateValue(_key, 0); } - } else if (eligeblity(mouse_item)) { - _engine->getScriptManager()->setStateValue(_key, mouse_item); - _engine->getScriptManager()->invertory_drop(mouse_item); + } else if (eligeblity(mouseItem)) { + _engine->getScriptManager()->setStateValue(_key, mouseItem); + _engine->getScriptManager()->inventoryDrop(mouseItem); } } return false; @@ -166,13 +166,13 @@ bool SlotControl::process(uint32 deltaTimeInMillis) { return false; if (_engine->canRender()) { - int cur_item = _engine->getScriptManager()->getStateValue(_key); - if (cur_item != _rendered_item) { - if (_rendered_item != 0 && cur_item == 0) { + int curItem = _engine->getScriptManager()->getStateValue(_key); + if (curItem != _renderedItem) { + if (_renderedItem != 0 && curItem == 0) { _engine->getRenderManager()->blitSurfaceToBkg(*_bkg, _rectangle.left, _rectangle.top); - _rendered_item = cur_item; + _renderedItem = curItem; } else { - if (_rendered_item == 0) { + if (_renderedItem == 0) { if (_bkg) delete _bkg; @@ -183,9 +183,9 @@ bool SlotControl::process(uint32 deltaTimeInMillis) { char buf[16]; if (_engine->getGameId() == GID_NEMESIS) - sprintf(buf, "%d%cobj.tga", cur_item, _distance_id); + sprintf(buf, "%d%cobj.tga", curItem, _distanceId); else - sprintf(buf, "g0z%cu%2.2x1.tga", _distance_id, cur_item); + sprintf(buf, "g0z%cu%2.2x1.tga", _distanceId, curItem); Graphics::Surface *srf = _engine->getRenderManager()->loadImage(buf); @@ -202,16 +202,16 @@ bool SlotControl::process(uint32 deltaTimeInMillis) { delete srf; - _rendered_item = cur_item; + _renderedItem = curItem; } } } return false; } -bool SlotControl::eligeblity(int item_id) { - for (Common::List<int>::iterator it = _eligible_objects.begin(); it != _eligible_objects.end(); it++) - if (*it == item_id) +bool SlotControl::eligeblity(int itemId) { + for (Common::List<int>::iterator it = _eligibleObjects.begin(); it != _eligibleObjects.end(); it++) + if (*it == itemId) return true; return false; } diff --git a/engines/zvision/scripting/controls/slot_control.h b/engines/zvision/scripting/controls/slot_control.h index 7799785aa5..86fd261f25 100644 --- a/engines/zvision/scripting/controls/slot_control.h +++ b/engines/zvision/scripting/controls/slot_control.h @@ -66,13 +66,13 @@ private: Common::Rect _hotspot; int _cursor; - char _distance_id; + char _distanceId; - int _rendered_item; + int _renderedItem; - Common::List<int> _eligible_objects; + Common::List<int> _eligibleObjects; - bool eligeblity(int item_id); + bool eligeblity(int itemId); Graphics::Surface *_bkg; diff --git a/engines/zvision/scripting/inventory.cpp b/engines/zvision/scripting/inventory.cpp index f8b22970c4..98d063395b 100644 --- a/engines/zvision/scripting/inventory.cpp +++ b/engines/zvision/scripting/inventory.cpp @@ -27,95 +27,95 @@ namespace ZVision { -int8 ScriptManager::invertory_getCount() { +int8 ScriptManager::inventoryGetCount() { return getStateValue(StateKey_Inv_Cnt_Slot); } -void ScriptManager::invertory_setCount(int8 cnt) { +void ScriptManager::inventorySetCount(int8 cnt) { setStateValue(StateKey_Inv_Cnt_Slot, cnt); } -int16 ScriptManager::invertory_getItem(int8 id) { +int16 ScriptManager::inventoryGetItem(int8 id) { if (id < 49 && id >= 0) return getStateValue(StateKey_Inv_1_Slot + id); return -1; } -void ScriptManager::invertory_setItem(int8 id, int16 item) { +void ScriptManager::inventorySetItem(int8 id, int16 item) { if (id < 49 && id >= 0) setStateValue(StateKey_Inv_1_Slot + id, item); } -void ScriptManager::invertory_add(int16 item) { - int8 cnt = invertory_getCount(); +void ScriptManager::inventoryAdd(int16 item) { + int8 cnt = inventoryGetCount(); if (cnt < 49) { - bool not_exist = true; + bool notExist = true; if (cnt == 0) { - invertory_setItem(0, 0); - invertory_setCount(1); // we needed empty item for cycle code + inventorySetItem(0, 0); + inventorySetCount(1); // we needed empty item for cycle code cnt = 1; } for (int8 cur = 0; cur < cnt; cur++) - if (invertory_getItem(cur) == item) { - not_exist = false; + if (inventoryGetItem(cur) == item) { + notExist = false; break; } - if (not_exist) { + if (notExist) { for (int8 i = cnt; i > 0; i--) - invertory_setItem(i, invertory_getItem(i - 1)); + inventorySetItem(i, inventoryGetItem(i - 1)); - invertory_setItem(0, item); + inventorySetItem(0, item); setStateValue(StateKey_InventoryItem, item); - invertory_setCount(cnt + 1); + inventorySetCount(cnt + 1); } } } -void ScriptManager::invertory_drop(int16 item) { - int8 items_cnt = invertory_getCount(); +void ScriptManager::inventoryDrop(int16 item) { + int8 itemCount = inventoryGetCount(); // if items in inventory > 0 - if (items_cnt != 0) { + if (itemCount != 0) { int8 index = 0; // finding needed item - while (index < items_cnt) { - if (invertory_getItem(index) == item) + while (index < itemCount) { + if (inventoryGetItem(index) == item) break; index++; } // if item in the inventory - if (items_cnt != index) { + if (itemCount != index) { // shift all items left with rewrite founded item - for (int8 v = index; v < items_cnt - 1 ; v++) - invertory_setItem(v, invertory_getItem(v + 1)); + for (int8 v = index; v < itemCount - 1 ; v++) + inventorySetItem(v, inventoryGetItem(v + 1)); // del last item - invertory_setItem(items_cnt - 1, 0); - invertory_setCount(invertory_getCount() - 1); + inventorySetItem(itemCount - 1, 0); + inventorySetCount(inventoryGetCount() - 1); - setStateValue(StateKey_InventoryItem, invertory_getItem(0)); + setStateValue(StateKey_InventoryItem, inventoryGetItem(0)); } } } -void ScriptManager::invertory_cycle() { - int8 item_cnt = invertory_getCount(); - int8 cur_item = invertory_getItem(0); - if (item_cnt > 1) { - for (int8 i = 0; i < item_cnt - 1; i++) - invertory_setItem(i, invertory_getItem(i + 1)); +void ScriptManager::inventoryCycle() { + int8 itemCount = inventoryGetCount(); + int8 curItem = inventoryGetItem(0); + if (itemCount > 1) { + for (int8 i = 0; i < itemCount - 1; i++) + inventorySetItem(i, inventoryGetItem(i + 1)); - invertory_setItem(item_cnt - 1, cur_item); + inventorySetItem(itemCount - 1, curItem); - setStateValue(StateKey_InventoryItem, invertory_getItem(0)); + setStateValue(StateKey_InventoryItem, inventoryGetItem(0)); } } diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp index 5e0387f0d9..697de58ed8 100644 --- a/engines/zvision/scripting/scr_file_handling.cpp +++ b/engines/zvision/scripting/scr_file_handling.cpp @@ -46,7 +46,7 @@ namespace ZVision { -void ScriptManager::parseScrFile(const Common::String &fileName, script_scope &scope) { +void ScriptManager::parseScrFile(const Common::String &fileName, ScriptScope &scope) { Common::File file; if (!_engine->getSearchManager()->openFile(file, fileName)) { warning("Script file not found: %s", fileName.c_str()); @@ -70,15 +70,15 @@ void ScriptManager::parseScrFile(const Common::String &fileName, script_scope &s if (getStateFlag(puzzle->key) & Puzzle::ONCE_PER_INST) setStateValue(puzzle->key, 0); parsePuzzle(puzzle, file); - scope._puzzles.push_back(puzzle); + scope.puzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { Control *ctrl = parseControl(line, file); if (ctrl) - scope._controls.push_back(ctrl); + scope.controls.push_back(ctrl); } } - scope.proc_count = 0; + scope.procCount = 0; } void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream) { @@ -196,8 +196,8 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis for (pos = startpos; pos < line.size(); pos++) if (chrs[pos] == '(') break; - Common::String s_slot(chrs + startpos, chrs + pos); - slot = atoi(s_slot.c_str()); + Common::String strSlot(chrs + startpos, chrs + pos); + slot = atoi(strSlot.c_str()); startpos = pos + 1; } diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp index 7df48183bd..2a54cc4314 100644 --- a/engines/zvision/scripting/script_manager.cpp +++ b/engines/zvision/scripting/script_manager.cpp @@ -76,7 +76,7 @@ void ScriptManager::update(uint deltaTimeMillis) { _currentLocation.room != _nextLocation.room || _currentLocation.view != _nextLocation.view || _currentLocation.world != _nextLocation.world) - do_changeLocation(); + ChangeLocationReal(); updateNodes(deltaTimeMillis); if (! execScope(nodeview)) @@ -90,35 +90,35 @@ void ScriptManager::update(uint deltaTimeMillis) { updateControls(deltaTimeMillis); } -bool ScriptManager::execScope(script_scope &scope) { +bool ScriptManager::execScope(ScriptScope &scope) { // Swap queues - PuzzleList *tmp = scope.exec_queue; - scope.exec_queue = scope.scope_queue; - scope.scope_queue = tmp; - scope.scope_queue->clear(); + PuzzleList *tmp = scope.execQueue; + scope.execQueue = scope.scopeQueue; + scope.scopeQueue = tmp; + scope.scopeQueue->clear(); - for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter) + for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter) (*PuzzleIter)->addedBySetState = 0; - if (scope.proc_count < 2 || getStateValue(StateKey_ExecScopeStyle)) { - for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter) - if (!checkPuzzleCriteria(*PuzzleIter, scope.proc_count)) + if (scope.procCount < 2 || getStateValue(StateKey_ExecScopeStyle)) { + for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter) + if (!checkPuzzleCriteria(*PuzzleIter, scope.procCount)) return false; } else { - for (PuzzleList::iterator PuzzleIter = scope.exec_queue->begin(); PuzzleIter != scope.exec_queue->end(); ++PuzzleIter) - if (!checkPuzzleCriteria(*PuzzleIter, scope.proc_count)) + for (PuzzleList::iterator PuzzleIter = scope.execQueue->begin(); PuzzleIter != scope.execQueue->end(); ++PuzzleIter) + if (!checkPuzzleCriteria(*PuzzleIter, scope.procCount)) return false; } - if (scope.proc_count < 2) { - scope.proc_count++; + if (scope.procCount < 2) { + scope.procCount++; } return true; } -void ScriptManager::referenceTableAddPuzzle(uint32 key, puzzle_ref ref) { +void ScriptManager::referenceTableAddPuzzle(uint32 key, PuzzleRef ref) { if (_referenceTable.contains(key)) { - Common::Array<puzzle_ref> *arr = &_referenceTable[key]; + Common::Array<PuzzleRef> *arr = &_referenceTable[key]; for (uint32 i = 0; i < arr->size(); i++) if ((*arr)[i].puz == ref.puz) return; @@ -127,12 +127,12 @@ void ScriptManager::referenceTableAddPuzzle(uint32 key, puzzle_ref ref) { _referenceTable[key].push_back(ref); } -void ScriptManager::addPuzzlesToReferenceTable(script_scope &scope) { +void ScriptManager::addPuzzlesToReferenceTable(ScriptScope &scope) { // Iterate through each local Puzzle - for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter) { + for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter) { Puzzle *puzzlePtr = (*PuzzleIter); - puzzle_ref ref; + PuzzleRef ref; ref.scope = &scope; ref.puz = puzzlePtr; @@ -270,22 +270,22 @@ void ScriptManager::cleanStateTable() { } } -void ScriptManager::cleanScriptScope(script_scope &scope) { - scope._priv_queue_one.clear(); - scope._priv_queue_two.clear(); - scope.scope_queue = &scope._priv_queue_one; - scope.exec_queue = &scope._priv_queue_two; - for (PuzzleList::iterator iter = scope._puzzles.begin(); iter != scope._puzzles.end(); ++iter) +void ScriptManager::cleanScriptScope(ScriptScope &scope) { + scope.privQueueOne.clear(); + scope.privQueueTwo.clear(); + scope.scopeQueue = &scope.privQueueOne; + scope.execQueue = &scope.privQueueTwo; + for (PuzzleList::iterator iter = scope.puzzles.begin(); iter != scope.puzzles.end(); ++iter) delete(*iter); - scope._puzzles.clear(); + scope.puzzles.clear(); - for (ControlList::iterator iter = scope._controls.begin(); iter != scope._controls.end(); ++iter) + for (ControlList::iterator iter = scope.controls.begin(); iter != scope.controls.end(); ++iter) delete(*iter); - scope._controls.clear(); + scope.controls.clear(); - scope.proc_count = 0; + scope.procCount = 0; } int ScriptManager::getStateValue(uint32 key) { @@ -297,10 +297,10 @@ int ScriptManager::getStateValue(uint32 key) { void ScriptManager::queuePuzzles(uint32 key) { if (_referenceTable.contains(key)) { - Common::Array<puzzle_ref> *arr = &_referenceTable[key]; + Common::Array<PuzzleRef> *arr = &_referenceTable[key]; for (int32 i = arr->size() - 1; i >= 0; i--) if (!(*arr)[i].puz->addedBySetState) { - (*arr)[i].scope->scope_queue->push_back((*arr)[i].puz); + (*arr)[i].scope->scopeQueue->push_back((*arr)[i].puz); (*arr)[i].puz->addedBySetState = true; } } @@ -518,7 +518,7 @@ void ScriptManager::changeLocation(char _world, char _room, char _node, char _vi } } -void ScriptManager::do_changeLocation() { +void ScriptManager::ChangeLocationReal() { assert(_nextLocation.world != 0); debug(1, "Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset); @@ -605,7 +605,7 @@ void ScriptManager::do_changeLocation() { addPuzzlesToReferenceTable(nodeview); } - _activeControls = &nodeview._controls; + _activeControls = &nodeview.controls; // Revert to the idle cursor _engine->getCursorManager()->changeCursor(CursorIndex_Idle); @@ -701,19 +701,17 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) { return; } - Location next_loc; + Location nextLocation; - next_loc.world = stream->readByte(); - next_loc.room = stream->readByte(); - next_loc.node = stream->readByte(); - next_loc.view = stream->readByte(); - next_loc.offset = stream->readUint32LE() & 0x0000FFFF; + nextLocation.world = stream->readByte(); + nextLocation.room = stream->readByte(); + nextLocation.node = stream->readByte(); + nextLocation.view = stream->readByte(); + nextLocation.offset = stream->readUint32LE() & 0x0000FFFF; - // What the fck, eos is not 'return pos >= size' - // while (!stream->eos()) {*/ while (stream->pos() < stream->size()) { uint32 tag = stream->readUint32BE(); - uint32 tag_size = stream->readUint32LE(); + uint32 tagSize = stream->readUint32LE(); switch (tag) { case MKTAG('T', 'I', 'M', 'R'): { uint32 key = stream->readUint32LE(); @@ -726,22 +724,22 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) { } break; case MKTAG('F', 'L', 'A', 'G'): - for (uint32 i = 0; i < tag_size / 2; i++) + for (uint32 i = 0; i < tagSize / 2; i++) setStateFlagSilent(i, stream->readUint16LE()); break; case MKTAG('P', 'U', 'Z', 'Z'): - for (uint32 i = 0; i < tag_size / 2; i++) + for (uint32 i = 0; i < tagSize / 2; i++) setStateValueSilent(i, stream->readUint16LE()); break; default: - stream->seek(tag_size, SEEK_CUR); + stream->seek(tagSize, SEEK_CUR); } } - _nextLocation = next_loc; + _nextLocation = nextLocation; + + ChangeLocationReal(); - do_changeLocation(); - // Place for read prefs _engine->setRenderDelay(10); setStateValue(StateKey_RestoreFlag, 1); @@ -792,23 +790,23 @@ void ScriptManager::flushEvent(Common::EventType type) { } } -ValueSlot::ValueSlot(ScriptManager *sc_man, const char *slot_val): - _sc_man(sc_man) { +ValueSlot::ValueSlot(ScriptManager *scriptManager, const char *slotValue): + _scriptManager(scriptManager) { value = 0; slot = false; - const char *is_slot = strstr(slot_val, "["); - if (is_slot) { + const char *isSlot = strstr(slotValue, "["); + if (isSlot) { slot = true; - value = atoi(is_slot + 1); + value = atoi(isSlot + 1); } else { slot = false; - value = atoi(slot_val); + value = atoi(slotValue); } } int16 ValueSlot::getValue() { if (slot) { if (value >= 0) - return _sc_man->getStateValue(value); + return _scriptManager->getStateValue(value); else return 0; } else diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h index ddb8c885aa..5701cde6d0 100644 --- a/engines/zvision/scripting/script_manager.h +++ b/engines/zvision/scripting/script_manager.h @@ -123,24 +123,24 @@ public: private: ZVision *_engine; - struct script_scope { - uint32 proc_count; + struct ScriptScope { + uint32 procCount; - PuzzleList *scope_queue; // For adding puzzles to queue - PuzzleList *exec_queue; // Switch to it when execute - PuzzleList _priv_queue_one; - PuzzleList _priv_queue_two; + PuzzleList *scopeQueue; // For adding puzzles to queue + PuzzleList *execQueue; // Switch to it when execute + PuzzleList privQueueOne; + PuzzleList privQueueTwo; - PuzzleList _puzzles; - ControlList _controls; + PuzzleList puzzles; + ControlList controls; }; - struct puzzle_ref { + struct PuzzleRef { Puzzle *puz; - script_scope *scope; + ScriptScope *scope; }; - typedef Common::HashMap<uint32, Common::Array<puzzle_ref> > PuzzleMap; + typedef Common::HashMap<uint32, Common::Array<PuzzleRef> > PuzzleMap; /** * Holds the global state variable. Do NOT directly modify this. Use the accessors and @@ -157,10 +157,10 @@ private: EventList _controlEvents; - script_scope universe; - script_scope world; - script_scope room; - script_scope nodeview; + ScriptScope universe; + ScriptScope world; + ScriptScope room; + ScriptScope nodeview; /** Holds the currently active timers, musics, other */ SideFXList _activeSideFx; @@ -249,30 +249,30 @@ public: Location getLastMenuLocation(); private: - void referenceTableAddPuzzle(uint32 key, puzzle_ref ref); - void addPuzzlesToReferenceTable(script_scope &scope); + void referenceTableAddPuzzle(uint32 key, PuzzleRef ref); + void addPuzzlesToReferenceTable(ScriptScope &scope); void updateNodes(uint deltaTimeMillis); void updateControls(uint deltaTimeMillis); bool checkPuzzleCriteria(Puzzle *puzzle, uint counter); void cleanStateTable(); - void cleanScriptScope(script_scope &scope); - bool execScope(script_scope &scope); + void cleanScriptScope(ScriptScope &scope); + bool execScope(ScriptScope &scope); /** Perform change location */ - void do_changeLocation(); + void ChangeLocationReal(); - int8 invertory_getCount(); - void invertory_setCount(int8 cnt); - int16 invertory_getItem(int8 id); - void invertory_setItem(int8 id, int16 item); + int8 inventoryGetCount(); + void inventorySetCount(int8 cnt); + int16 inventoryGetItem(int8 id); + void inventorySetItem(int8 id, int16 item); void setStateFlagSilent(uint32 key, uint value); void setStateValueSilent(uint32 key, int value); public: - void invertory_add(int16 item); - void invertory_drop(int16 item); - void invertory_cycle(); + void inventoryAdd(int16 item); + void inventoryDrop(int16 item); + void inventoryCycle(); // TODO: Make this private. It was only made public so Console::cmdParseAllScrFiles() could use it /** @@ -281,7 +281,7 @@ public: * @param fileName Name of the .scr file * @param isGlobal Are the puzzles included in the file global (true). AKA, the won't be purged during location changes */ - void parseScrFile(const Common::String &fileName, script_scope &scope); + void parseScrFile(const Common::String &fileName, ScriptScope &scope); private: /** @@ -332,12 +332,12 @@ private: class ValueSlot { public: - ValueSlot(ScriptManager *sc_man, const char *slot_val); + ValueSlot(ScriptManager *scriptManager, const char *slotValue); int16 getValue(); private: int16 value; bool slot; - ScriptManager *_sc_man; + ScriptManager *_scriptManager; }; diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp index bd9c543d52..98ac4e3b37 100644 --- a/engines/zvision/scripting/sidefx/animation_node.cpp +++ b/engines/zvision/scripting/sidefx/animation_node.cpp @@ -75,19 +75,19 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { const Graphics::Surface *frame = NULL; - if (nod->_cur_frm == -1) { // Start of new playlist node - nod->_cur_frm = nod->start; + if (nod->_curFrame == -1) { // Start of new playlist node + nod->_curFrame = nod->start; - _animation->seekToFrame(nod->_cur_frm); + _animation->seekToFrame(nod->_curFrame); frame = _animation->decodeNextFrame(); nod->_delay = _frmDelay; if (nod->slot) _engine->getScriptManager()->setStateValue(nod->slot, 1); } else { - nod->_cur_frm++; + nod->_curFrame++; - if (nod->_cur_frm > nod->stop) { + if (nod->_curFrame > nod->stop) { nod->loop--; if (nod->loop == 0) { @@ -99,8 +99,8 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { return _DisposeAfterUse; } - nod->_cur_frm = nod->start; - _animation->seekToFrame(nod->_cur_frm); + nod->_curFrame = nod->start; + _animation->seekToFrame(nod->_curFrame); } frame = _animation->decodeNextFrame(); @@ -156,18 +156,18 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) { -void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops) { +void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops) { playnode nod; nod.loop = loops; nod.pos = Common::Rect(x, y, x2 + 1, y2 + 1); - nod.start = start_frame; - nod.stop = end_frame; + nod.start = startFrame; + nod.stop = endFrame; if (nod.stop >= (int)_animation->frameCount()) nod.stop = _animation->frameCount() - 1; nod.slot = slot; - nod._cur_frm = -1; + nod._curFrame = -1; nod._delay = 0; nod._scaled = NULL; _playList.push_back(nod); diff --git a/engines/zvision/scripting/sidefx/animation_node.h b/engines/zvision/scripting/sidefx/animation_node.h index 4d1c74bccf..dab3d88d80 100644 --- a/engines/zvision/scripting/sidefx/animation_node.h +++ b/engines/zvision/scripting/sidefx/animation_node.h @@ -52,7 +52,7 @@ public: int32 start; int32 stop; int32 loop; - int32 _cur_frm; + int32 _curFrame; int32 _delay; Graphics::Surface *_scaled; }; @@ -71,7 +71,7 @@ private: public: bool process(uint32 deltaTimeInMillis); - void addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops = 1); + void addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops = 1); bool stop(); diff --git a/engines/zvision/scripting/sidefx/distort_node.cpp b/engines/zvision/scripting/sidefx/distort_node.cpp index 576a1f8592..9be6b29413 100644 --- a/engines/zvision/scripting/sidefx/distort_node.cpp +++ b/engines/zvision/scripting/sidefx/distort_node.cpp @@ -34,7 +34,7 @@ namespace ZVision { -DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl, float en_angl, float st_lin, float en_lin) +DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale) : SideFX(engine, key, SIDEFX_DISTORT) { _angle = _engine->getRenderManager()->getRenderTable()->getAngle(); @@ -42,15 +42,15 @@ DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl _speed = speed; _incr = true; - _st_angl = st_angl; - _en_angl = en_angl; - _st_lin = st_lin; - _en_lin = en_lin; + _startAngle = startAngle; + _endAngle = endAngle; + _startLineScale = startLineScale; + _endLineScale = endLineScale; _curFrame = 1.0; - _diff_angl = en_angl - st_angl; - _diff_lin = en_lin - st_lin; + _diffAngle = endAngle - startAngle; + _diffLinScale = endLineScale - startLineScale; _frmSpeed = (float)speed / 15.0; _frames = ceil((5.0 - _frmSpeed * 2.0) / _frmSpeed); @@ -85,7 +85,7 @@ bool DistortNode::process(uint32 deltaTimeInMillis) { float diff = (1.0 / (5.0 - (_curFrame * _frmSpeed))) / (5.0 - _frmSpeed); - setParams(_st_angl + diff * _diff_angl, _st_lin + diff * _diff_lin); + setParams(_startAngle + diff * _diffAngle, _startLineScale + diff * _diffLinScale); return false; } diff --git a/engines/zvision/scripting/sidefx/distort_node.h b/engines/zvision/scripting/sidefx/distort_node.h index cba9c5eff2..787a69bdde 100644 --- a/engines/zvision/scripting/sidefx/distort_node.h +++ b/engines/zvision/scripting/sidefx/distort_node.h @@ -31,21 +31,21 @@ class ZVision; class DistortNode : public SideFX { public: - DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl, float en_angl, float st_lin, float en_lin); + DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale); ~DistortNode(); bool process(uint32 deltaTimeInMillis); private: int16 _speed; - float _st_angl; - float _en_angl; - float _st_lin; - float _en_lin; + float _startAngle; + float _endAngle; + float _startLineScale; + float _endLineScale; float _frmSpeed; - float _diff_angl; - float _diff_lin; + float _diffAngle; + float _diffLinScale; bool _incr; int16 _frames; diff --git a/engines/zvision/scripting/sidefx/music_node.cpp b/engines/zvision/scripting/sidefx/music_node.cpp index 4420da3e96..e9baadb011 100644 --- a/engines/zvision/scripting/sidefx/music_node.cpp +++ b/engines/zvision/scripting/sidefx/music_node.cpp @@ -38,15 +38,15 @@ namespace ZVision { MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool loop, int8 volume) - : MusicNode_BASE(engine, key, SIDEFX_AUDIO) { + : MusicNodeBASE(engine, key, SIDEFX_AUDIO) { _loop = loop; _volume = volume; _crossfade = false; - _crossfade_target = 0; - _crossfade_time = 0; + _crossfadeTarget = 0; + _crossfadeTime = 0; _attenuate = 0; _pantrack = false; - _pantrack_X = 0; + _pantrackPosition = 0; _sub = NULL; Audio::RewindableAudioStream *audioStream; @@ -93,7 +93,7 @@ MusicNode::~MusicNode() { void MusicNode::setPanTrack(int16 pos) { if (!_stereo) { _pantrack = true; - _pantrack_X = pos; + _pantrackPosition = pos; setVolume(_volume); } } @@ -104,8 +104,8 @@ void MusicNode::unsetPanTrack() { } void MusicNode::setFade(int32 time, uint8 target) { - _crossfade_target = target; - _crossfade_time = time; + _crossfadeTarget = target; + _crossfadeTime = time; _crossfade = true; } @@ -116,14 +116,14 @@ bool MusicNode::process(uint32 deltaTimeInMillis) { uint8 _newvol = _volume; if (_crossfade) { - if (_crossfade_time > 0) { - if ((int32)deltaTimeInMillis > _crossfade_time) - deltaTimeInMillis = _crossfade_time; - _newvol += floor(((float)(_crossfade_target - _newvol) / (float)_crossfade_time)) * (float)deltaTimeInMillis; - _crossfade_time -= deltaTimeInMillis; + if (_crossfadeTime > 0) { + if ((int32)deltaTimeInMillis > _crossfadeTime) + deltaTimeInMillis = _crossfadeTime; + _newvol += floor(((float)(_crossfadeTarget - _newvol) / (float)_crossfadeTime)) * (float)deltaTimeInMillis; + _crossfadeTime -= deltaTimeInMillis; } else { _crossfade = false; - _newvol = _crossfade_target; + _newvol = _crossfadeTarget; } } @@ -136,17 +136,17 @@ bool MusicNode::process(uint32 deltaTimeInMillis) { return false; } -void MusicNode::setVolume(uint8 new_volume) { +void MusicNode::setVolume(uint8 newVolume) { if (_pantrack) { - int cur_x = _engine->getScriptManager()->getStateValue(StateKey_ViewPos); - cur_x -= _pantrack_X; + int curX = _engine->getScriptManager()->getStateValue(StateKey_ViewPos); + curX -= _pantrackPosition; int32 _width = _engine->getRenderManager()->getBkgSize().x; - if (cur_x < (-_width) / 2) - cur_x += _width; - else if (cur_x >= _width / 2) - cur_x -= _width; + if (curX < (-_width) / 2) + curX += _width; + else if (curX >= _width / 2) + curX -= _width; - float norm = (float)cur_x / ((float)_width / 2.0); + float norm = (float)curX / ((float)_width / 2.0); float lvl = fabs(norm); if (lvl > 0.5) lvl = (lvl - 0.5) * 1.7; @@ -157,16 +157,16 @@ void MusicNode::setVolume(uint8 new_volume) { if (_engine->_mixer->isSoundHandleActive(_handle)) { _engine->_mixer->setChannelBalance(_handle, bal); - _engine->_mixer->setChannelVolume(_handle, new_volume * lvl); + _engine->_mixer->setChannelVolume(_handle, newVolume * lvl); } } else { if (_engine->_mixer->isSoundHandleActive(_handle)) { _engine->_mixer->setChannelBalance(_handle, 0); - _engine->_mixer->setChannelVolume(_handle, new_volume); + _engine->_mixer->setChannelVolume(_handle, newVolume); } } - _volume = new_volume; + _volume = newVolume; } PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos) @@ -175,7 +175,7 @@ PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos) SideFX *fx = _engine->getScriptManager()->getSideFX(slot); if (fx && fx->getType() == SIDEFX_AUDIO) { - MusicNode_BASE *mus = (MusicNode_BASE *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; mus->setPanTrack(pos); } } @@ -183,14 +183,14 @@ PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos) PanTrackNode::~PanTrackNode() { SideFX *fx = _engine->getScriptManager()->getSideFX(_slot); if (fx && fx->getType() == SIDEFX_AUDIO) { - MusicNode_BASE *mus = (MusicNode_BASE *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; mus->unsetPanTrack(); } } MusicMidiNode::MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume) - : MusicNode_BASE(engine, key, SIDEFX_AUDIO) { + : MusicNodeBASE(engine, key, SIDEFX_AUDIO) { _volume = volume; _prog = program; _noteNumber = note; @@ -230,11 +230,11 @@ bool MusicMidiNode::process(uint32 deltaTimeInMillis) { return false; } -void MusicMidiNode::setVolume(uint8 new_volume) { +void MusicMidiNode::setVolume(uint8 newVolume) { if (_chan >= 0) { - _engine->getMidiManager()->setVolume(_chan, new_volume); + _engine->getMidiManager()->setVolume(_chan, newVolume); } - _volume = new_volume; + _volume = newVolume; } } // End of namespace ZVision diff --git a/engines/zvision/scripting/sidefx/music_node.h b/engines/zvision/scripting/sidefx/music_node.h index 262b13085e..954e2f474e 100644 --- a/engines/zvision/scripting/sidefx/music_node.h +++ b/engines/zvision/scripting/sidefx/music_node.h @@ -33,10 +33,10 @@ class String; namespace ZVision { -class MusicNode_BASE : public SideFX { +class MusicNodeBASE : public SideFX { public: - MusicNode_BASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {} - ~MusicNode_BASE() {} + MusicNodeBASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {} + ~MusicNodeBASE() {} /** * Decrement the timer by the delta time. If the timer is finished, set the status @@ -55,7 +55,7 @@ public: virtual void setFade(int32 time, uint8 target) = 0; }; -class MusicNode : public MusicNode_BASE { +class MusicNode : public MusicNodeBASE { public: MusicNode(ZVision *engine, uint32 key, Common::String &file, bool loop, int8 volume); ~MusicNode(); @@ -79,19 +79,19 @@ public: private: int32 _timeLeft; bool _pantrack; - int32 _pantrack_X; + int32 _pantrackPosition; int32 _attenuate; uint8 _volume; bool _loop; bool _crossfade; - uint8 _crossfade_target; - int32 _crossfade_time; + uint8 _crossfadeTarget; + int32 _crossfadeTime; bool _stereo; Audio::SoundHandle _handle; Subtitle *_sub; }; -class MusicMidiNode : public MusicNode_BASE { +class MusicMidiNode : public MusicNodeBASE { public: MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume); ~MusicMidiNode(); diff --git a/engines/zvision/scripting/sidefx/ttytext_node.h b/engines/zvision/scripting/sidefx/ttytext_node.h index a6326c733b..a229129b9d 100644 --- a/engines/zvision/scripting/sidefx/ttytext_node.h +++ b/engines/zvision/scripting/sidefx/ttytext_node.h @@ -50,15 +50,12 @@ public: bool process(uint32 deltaTimeInMillis); private: Common::Rect _r; - //int16 x; - //int16 y; - //uint16 w; - //uint16 h; + cTxtStyle _style; - sTTFont _fnt; + StyledTTFont _fnt; Common::String _txtbuf; uint32 _txtpos; - //int32 txtsize; + int32 _delay; int32 _nexttime; Graphics::Surface _img; |