Skip to content

Commit

Permalink
SHERLOCK: Add initialization of RT character portraits and names
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jun 6, 2015
1 parent 28c054d commit ca07e8f
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 1 deletion.
4 changes: 4 additions & 0 deletions engines/sherlock/detection.cpp
Expand Up @@ -44,6 +44,10 @@ Common::Platform SherlockEngine::getPlatform() const {
return _gameDescription->desc.platform;
}

Common::Language SherlockEngine::getLanguage() const {
return _gameDescription->desc.language;
}

} // End of namespace Sherlock

static const PlainGameDescriptor sherlockGames[] = {
Expand Down
1 change: 1 addition & 0 deletions engines/sherlock/module.mk
Expand Up @@ -13,6 +13,7 @@ MODULE_OBJS = \
scalpel/scalpel_user_interface.o \
scalpel/settings.o \
tattoo/tattoo.o \
tattoo/tattoo_resources.o \
tattoo/tattoo_scene.o \
tattoo/tattoo_talk.o \
tattoo/tattoo_user_interface.o \
Expand Down
20 changes: 19 additions & 1 deletion engines/sherlock/people.cpp
Expand Up @@ -583,19 +583,37 @@ void People::goAllTheWay() {

int People::findSpeaker(int speaker) {
Scene &scene = *_vm->_scene;
const char *portrait = _characters[speaker]._portrait;

for (int idx = 0; idx < (int)scene._bgShapes.size(); ++idx) {
Object &obj = scene._bgShapes[idx];

if (obj._type == ACTIVE_BG_SHAPE) {
Common::String name(obj._name.c_str(), obj._name.c_str() + 4);

if (name.equalsIgnoreCase(_characters[speaker]._portrait)
if (name.equalsIgnoreCase(portrait)
&& obj._name[4] >= '0' && obj._name[4] <= '9')
return idx;
}
}

// Fallback in Rose Tattoo
if (IS_ROSE_TATTOO) {
bool flag = _vm->readFlags(76);

if (_data[0]._type == CHARACTER && ((speaker == 0 && flag) || (speaker == 1 && !flag)))
return -1;

for (uint idx = 1; idx < MAX_CHARACTERS; ++idx) {
if (_data[idx]._type == CHARACTER) {
Common::String name(_data[idx]._name.c_str(), _data[idx]._name.c_str() + 4);

if (name.equalsIgnoreCase(portrait) && _data[idx]._npcName[4] >= '0' && _data[idx]._npcName[4] <= '9')
return idx + 256;
}
}
}

return -1;
}

Expand Down
5 changes: 5 additions & 0 deletions engines/sherlock/sherlock.h
Expand Up @@ -176,6 +176,11 @@ class SherlockEngine : public Engine {
*/
Common::Platform getPlatform() const;

/**
* Return the game's language
*/
Common::Language getLanguage() const;

/**
* Return a random number
*/
Expand Down
9 changes: 9 additions & 0 deletions engines/sherlock/tattoo/tattoo.cpp
Expand Up @@ -22,7 +22,9 @@

#include "engines/util.h"
#include "sherlock/tattoo/tattoo.h"
#include "sherlock/tattoo/tattoo_resources.h"
#include "sherlock/tattoo/tattoo_scene.h"
#include "sherlock/people.h"

namespace Sherlock {

Expand All @@ -47,6 +49,13 @@ void TattooEngine::initialize() {

// Add some more files to the cache
_res->addToCache("walk.lib");

// Set up list of people
for (int idx = 0; idx < TATTOO_MAX_PEOPLE; ++idx) {
_people->_characters.push_back(PersonData(
getLanguage() == Common::FR_FRA ? FRENCH_NAMES[idx] : ENGLISH_NAMES[idx],
PORTRAITS[idx], nullptr, nullptr));
}

// Starting scene
_scene->_goToScene = STARTING_INTRO_SCENE;
Expand Down

0 comments on commit ca07e8f

Please sign in to comment.