diff options
author | Paul Gilbert | 2015-06-06 22:40:29 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-06 22:40:29 -0400 |
commit | 933e6751943fcb28fdb1b616f9834bd4f231f63d (patch) | |
tree | 4c4fc326b171ee60725af90c0afad08e779f04d3 /engines/sherlock/scalpel | |
parent | 3511f30a2621af4773df5271cdffb6275b9e829e (diff) | |
download | scummvm-rg350-933e6751943fcb28fdb1b616f9834bd4f231f63d.tar.gz scummvm-rg350-933e6751943fcb28fdb1b616f9834bd4f231f63d.tar.bz2 scummvm-rg350-933e6751943fcb28fdb1b616f9834bd4f231f63d.zip |
SHERLOCK: Setting up game specific People descendant classes
Diffstat (limited to 'engines/sherlock/scalpel')
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 1 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.cpp | 91 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.h | 59 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_scene.cpp | 1 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 23 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.h | 1 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_user_interface.cpp | 3 |
7 files changed, 178 insertions, 1 deletions
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 39d4437918..9d2c3b8d81 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -22,6 +22,7 @@ #include "engines/util.h" #include "sherlock/scalpel/scalpel.h" +#include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/tsage/logo.h" #include "sherlock/sherlock.h" #include "sherlock/music.h" diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp new file mode 100644 index 0000000000..5e661fe16a --- /dev/null +++ b/engines/sherlock/scalpel/scalpel_people.cpp @@ -0,0 +1,91 @@ +/* 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 "sherlock/scalpel/scalpel_people.h" +#include "sherlock/sherlock.h" + +namespace Sherlock { + +namespace Scalpel { + +void ScalpelPeople::setTalking(int speaker) { + Resources &res = *_vm->_res; + + // If no speaker is specified, then we can exit immediately + if (speaker == -1) + return; + + if (_portraitsOn) { + delete _talkPics; + Common::String filename = Common::String::format("%s.vgs", _characters[speaker]._portrait); + _talkPics = new ImageFile(filename); + + // Load portrait sequences + Common::SeekableReadStream *stream = res.load("sequence.txt"); + stream->seek(speaker * MAX_FRAME); + + int idx = 0; + do { + _portrait._sequences[idx] = stream->readByte(); + ++idx; + } while (idx < 2 || _portrait._sequences[idx - 2] || _portrait._sequences[idx - 1]); + + delete stream; + + _portrait._maxFrames = idx; + _portrait._frameNumber = 0; + _portrait._sequenceNumber = 0; + _portrait._images = _talkPics; + _portrait._imageFrame = &(*_talkPics)[0]; + _portrait._position = Common::Point(_portraitSide, 10); + _portrait._delta = Common::Point(0, 0); + _portrait._oldPosition = Common::Point(0, 0); + _portrait._goto = Common::Point(0, 0); + _portrait._flags = 5; + _portrait._status = 0; + _portrait._misc = 0; + _portrait._allow = 0; + _portrait._type = ACTIVE_BG_SHAPE; + _portrait._name = " "; + _portrait._description = " "; + _portrait._examine = " "; + _portrait._walkCount = 0; + + if (_holmesFlip || _speakerFlip) { + _portrait._flags |= 2; + + _holmesFlip = false; + _speakerFlip = false; + } + + if (_portraitSide == 20) + _portraitSide = 220; + else + _portraitSide = 20; + + _portraitLoaded = true; + } +} + +} // End of namespace Scalpel + +} // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_people.h b/engines/sherlock/scalpel/scalpel_people.h new file mode 100644 index 0000000000..714337722a --- /dev/null +++ b/engines/sherlock/scalpel/scalpel_people.h @@ -0,0 +1,59 @@ +/* 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 SHERLOCK_SCALPEL_PEOPLE_H +#define SHERLOCK_SCALPEL_PEOPLE_H + +#include "common/scummsys.h" +#include "sherlock/people.h" + +namespace Sherlock { + +class SherlockEngine; + +namespace Scalpel { + +// Animation sequence identifiers for characters +enum ScalpelSequences { + WALK_RIGHT = 0, WALK_DOWN = 1, WALK_LEFT = 2, WALK_UP = 3, STOP_LEFT = 4, + STOP_DOWN = 5, STOP_RIGHT = 6, STOP_UP = 7, WALK_UPRIGHT = 8, + WALK_DOWNRIGHT = 9, WALK_UPLEFT = 10, WALK_DOWNLEFT = 11, + STOP_UPRIGHT = 12, STOP_UPLEFT = 13, STOP_DOWNRIGHT = 14, + STOP_DOWNLEFT = 15, TALK_RIGHT = 6, TALK_LEFT = 4, +}; + +class ScalpelPeople : public People { +public: + ScalpelPeople(SherlockEngine *vm) : People(vm) {} + virtual ~ScalpelPeople() {} + + /** + * Setup the data for an animating speaker portrait at the top of the screen + */ + void setTalking(int speaker); +}; + +} // End of namespace Scalpel + +} // End of namespace Sherlock + +#endif diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp index e85bb35255..e0ad3a7b6d 100644 --- a/engines/sherlock/scalpel/scalpel_scene.cpp +++ b/engines/sherlock/scalpel/scalpel_scene.cpp @@ -21,6 +21,7 @@ */ #include "sherlock/scalpel/scalpel_scene.h" +#include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/scalpel.h" #include "sherlock/events.h" #include "sherlock/people.h" diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 65f7a76049..0d805c6177 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -21,6 +21,7 @@ */ #include "sherlock/scalpel/scalpel_talk.h" +#include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/scalpel_user_interface.h" #include "sherlock/sherlock.h" #include "sherlock/screen.h" @@ -154,6 +155,28 @@ ScalpelTalk::ScalpelTalk(SherlockEngine *vm) : Talk(vm) { _opcodeTable = OPCODE_METHODS; } +OpcodeReturn ScalpelTalk::cmdSwitchSpeaker(const byte *&str) { + ScalpelPeople &people = *(ScalpelPeople *)_vm->_people; + UserInterface &ui = *_vm->_ui; + + if (!(_speaker & SPEAKER_REMOVE)) + people.clearTalking(); + if (_talkToAbort) + return RET_EXIT; + + ui.clearWindow(); + _yp = CONTROLS_Y + 12; + _charCount = _line = 0; + + _speaker = *++str - 1; + people.setTalking(_speaker); + pullSequence(); + pushSequence(_speaker); + setSequence(_speaker); + + return RET_SUCCESS; +} + OpcodeReturn ScalpelTalk::cmdAssignPortraitLocation(const byte *&str) { People &people = *_vm->_people; diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index 1947e2cd79..88637906cc 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -37,6 +37,7 @@ namespace Scalpel { class ScalpelTalk : public Talk { private: + OpcodeReturn cmdSwitchSpeaker(const byte *&str); OpcodeReturn cmdAssignPortraitLocation(const byte *&str); OpcodeReturn cmdClearInfoLine(const byte *&str); OpcodeReturn cmdClearWindow(const byte *&str); diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index e2c66789ad..62083586e7 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -21,6 +21,7 @@ */ #include "sherlock/scalpel/scalpel_user_interface.h" +#include "sherlock/scalpel/scalpel_people.h" #include "sherlock/sherlock.h" #include "sherlock/scalpel/settings.h" @@ -1468,7 +1469,7 @@ void ScalpelUserInterface::doPickControl() { void ScalpelUserInterface::doTalkControl() { Events &events = *_vm->_events; Journal &journal = *_vm->_journal; - People &people = *_vm->_people; + ScalpelPeople &people = *(ScalpelPeople *)_vm->_people; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; Talk &talk = *_vm->_talk; |