diff options
author | whitertandrek | 2018-03-22 07:47:45 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 467d3f1ab890bfca77629dd239b670ee4797bfe8 (patch) | |
tree | b534737f1dbafc4ec98a044d576f2457dc919517 /engines/pink/objects/actions | |
parent | 824b3fa38e965e425d09239f2ac81c4853eb43e8 (diff) | |
download | scummvm-rg350-467d3f1ab890bfca77629dd239b670ee4797bfe8.tar.gz scummvm-rg350-467d3f1ab890bfca77629dd239b670ee4797bfe8.tar.bz2 scummvm-rg350-467d3f1ab890bfca77629dd239b670ee4797bfe8.zip |
PINK: did a big file movement for better readability. Almost implemented
conditions and sideEffects. Added more classes. Now engine can play intro's sound.
Diffstat (limited to 'engines/pink/objects/actions')
-rw-r--r-- | engines/pink/objects/actions/action.cpp | 34 | ||||
-rw-r--r-- | engines/pink/objects/actions/action.h | 46 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_cel.cpp | 34 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_cel.h | 41 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_hide.cpp | 48 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_hide.h | 42 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_play.cpp | 39 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_play.h | 42 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_sound.cpp | 72 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_sound.h | 54 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_still.cpp | 39 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_still.h | 41 | ||||
-rw-r--r-- | engines/pink/objects/actions/walk_action.cpp | 40 | ||||
-rw-r--r-- | engines/pink/objects/actions/walk_action.h | 42 |
14 files changed, 614 insertions, 0 deletions
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp new file mode 100644 index 0000000000..0853e377aa --- /dev/null +++ b/engines/pink/objects/actions/action.cpp @@ -0,0 +1,34 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action.h" +#include "engines/pink/objects/actors/actor.h" +#include "engines/pink/archive.h" + +namespace Pink { + +void Action::deserialize(Archive &archive) { + NamedObject::deserialize(archive); + _actor = static_cast<Actor*>(archive.readObject()); +} + +} // End of namespace Pink diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h new file mode 100644 index 0000000000..5b164a3052 --- /dev/null +++ b/engines/pink/objects/actions/action.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_H +#define PINK_ACTION_H + +#include "engines/pink/objects/object.h" + +namespace Pink { + +class Actor; + +class Action : public NamedObject { +public: + virtual void deserialize(Archive &archive); + virtual void start(bool unk) {}; + virtual void end() {}; + virtual void update() {}; + virtual void toConsole() {}; + +protected: + Actor *_actor; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp new file mode 100644 index 0000000000..f1c350473f --- /dev/null +++ b/engines/pink/objects/actions/action_cel.cpp @@ -0,0 +1,34 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include <common/debug.h> +#include "action_cel.h" +#include "engines/pink/archive.h" + +namespace Pink { + +void ActionCEL::deserialize(Archive &archive) { + Action::deserialize(archive); + archive >> _fileName >> _z; +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h new file mode 100644 index 0000000000..8c6a61a405 --- /dev/null +++ b/engines/pink/objects/actions/action_cel.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_CEL_H +#define PINK_ACTION_CEL_H + +#include "action.h" + +namespace Pink { + +class ActionCEL : public Action { +public: + virtual void deserialize(Archive &archive); + +protected: + Common::String _fileName; + uint32 _z; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp new file mode 100644 index 0000000000..7df43662bc --- /dev/null +++ b/engines/pink/objects/actions/action_hide.cpp @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action_hide.h" +#include "engines/pink/objects/actors/actor.h" +#include <engines/pink/archive.h> +#include <common/debug.h> + + +namespace Pink { + +void Pink::ActionHide::deserialize(Archive &archive) { + Action::deserialize(archive); +} + +void ActionHide::play(bool unk_startNow) { + debug("ActionHide %s is now in playing state", _name.c_str()); + _actor->endAction(); +} + +void ActionHide::end() { + debug("ActionHide %s is ended", _name.c_str()); +} + +void ActionHide::toConsole() { + debug("\tActionHide: _name = %s", _name.c_str()); +} + +} //End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h new file mode 100644 index 0000000000..fa6e717ede --- /dev/null +++ b/engines/pink/objects/actions/action_hide.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_HIDE_H +#define PINK_ACTION_HIDE_H + +#include "action.h" + +namespace Pink { + +class ActionHide : public Action { +public: + virtual void deserialize(Archive &archive); + + virtual void toConsole(); + + virtual void play(bool unk_startNow); + virtual void end(); +}; + +} //End of namespace Pink + +#endif diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp new file mode 100644 index 0000000000..5e6b692d30 --- /dev/null +++ b/engines/pink/objects/actions/action_play.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include <common/debug.h> +#include "action_play.h" +#include "engines/pink/archive.h" + +namespace Pink { + +void ActionPlay::deserialize(Archive &archive) { + ActionStill::deserialize(archive); + archive >> _stopFrame; +} + +void ActionPlay::toConsole() { + debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u," + " _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame); +} + +} // End of namespace Pink diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h new file mode 100644 index 0000000000..d53b44a1d1 --- /dev/null +++ b/engines/pink/objects/actions/action_play.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_PLAY_H +#define PINK_ACTION_PLAY_H + +#include "action.h" +#include "action_still.h" + +namespace Pink { + +class ActionPlay : public ActionStill { +public: + virtual void deserialize(Archive &archive); + virtual void toConsole(); + +private: + uint32 _stopFrame; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp new file mode 100644 index 0000000000..f389f97a1a --- /dev/null +++ b/engines/pink/objects/actions/action_sound.cpp @@ -0,0 +1,72 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include <common/debug.h> +#include "action_sound.h" +#include "engines/pink/archive.h" +#include <engines/pink/objects/actors/actor.h> +#include <engines/pink/objects/pages/game_page.h> +#include <engines/pink/sound.h> + + +namespace Pink { + +ActionSound::ActionSound() + : _sound(nullptr), _isStopped(1) +{} + +void ActionSound::deserialize(Archive &archive) { + Action::deserialize(archive); + archive >> _fileName; + _volume = archive.readDWORD(); + _isLoop = (bool) archive.readDWORD(); + _isBackground = (bool) archive.readDWORD(); +} + +void ActionSound::toConsole() { + debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u," + " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground); +} + +void ActionSound::start(bool unk) { + assert(!_sound); + _sound = _actor->getPage()->loadSound(_fileName); + + Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType + : Audio::Mixer::SoundType::kSpeechSoundType; + _sound->play(soundType, _volume, _isLoop); + if (_isLoop) + _actor->endAction(); +} + +void ActionSound::end() { + _sound->stop(); + delete _sound; + _sound = nullptr; +} + +void ActionSound::update() { + if (!_sound->isPlaying()) + _actor->endAction(); +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h new file mode 100644 index 0000000000..e4bb2f1822 --- /dev/null +++ b/engines/pink/objects/actions/action_sound.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_SOUND_H +#define PINK_ACTION_SOUND_H + +#include "action.h" + +namespace Pink { + +class Sound; + +class ActionSound : public Action { +public: + ActionSound(); + virtual void deserialize(Archive &archive); + + virtual void toConsole(); + + virtual void start(bool unk_startNow); + virtual void end(); + virtual void update(); + +private: + Sound *_sound; + Common::String _fileName; + uint32 _volume; + bool _isLoop; + bool _isBackground; + bool _isStopped; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp new file mode 100644 index 0000000000..3c6bf17cad --- /dev/null +++ b/engines/pink/objects/actions/action_still.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include <common/debug.h> +#include "action_still.h" +#include "engines/pink/archive.h" + +namespace Pink { + +void ActionStill::deserialize(Archive &archive) { + ActionCEL::deserialize(archive); + archive >> _startFrame; +} + +void ActionStill::toConsole() { + debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u", + _name.c_str(), _fileName.c_str(), _startFrame); +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h new file mode 100644 index 0000000000..075371a9cc --- /dev/null +++ b/engines/pink/objects/actions/action_still.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_STILL_H +#define PINK_ACTION_STILL_H + +#include "action_cel.h" + +namespace Pink { + +class ActionStill : public ActionCEL { +public: + virtual void deserialize(Archive &archive); + virtual void toConsole(); + +protected: + uint32 _startFrame; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp new file mode 100644 index 0000000000..39be8f4443 --- /dev/null +++ b/engines/pink/objects/actions/walk_action.cpp @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "walk_action.h" +#include <engines/pink/archive.h> +#include <common/debug.h> + +namespace Pink { + +void WalkAction::deserialize(Archive &archive) { + ActionCEL::deserialize(archive); + uint32 calcFramePositions = archive.readDWORD(); + _toCalcFramePositions = calcFramePositions ? true : false; +} + +void WalkAction::toConsole() { + debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u", + _name.c_str(), _fileName.c_str(), _toCalcFramePositions); +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h new file mode 100644 index 0000000000..923811fe47 --- /dev/null +++ b/engines/pink/objects/actions/walk_action.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_WALK_ACTION_H +#define PINK_WALK_ACTION_H + +#include "action_cel.h" + +namespace Pink { + +class WalkAction : public ActionCEL { +public: + virtual void deserialize(Archive &archive); + + virtual void toConsole(); + +private: + bool _toCalcFramePositions; +}; + +} + +#endif |