SHERLOCK: Re-factored Scalpel arrays out of Animation
This commit is contained in:
parent
0d3750a768
commit
7b2da2abc5
3 changed files with 104 additions and 39 deletions
|
@ -26,39 +26,6 @@
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
// The following are a list of filenames played in the prologue that have
|
|
||||||
// special effects associated with them at specific frames
|
|
||||||
|
|
||||||
#define FRAMES_END 32000
|
|
||||||
#define PROLOGUE_NAMES_COUNT 6
|
|
||||||
#define TITLE_NAMES_COUNT 7
|
|
||||||
static const char *const PROLOGUE_NAMES[6] = {
|
|
||||||
"subway1", "subway2", "finale2", "suicid", "coff3", "coff4"
|
|
||||||
};
|
|
||||||
static const int PROLOGUE_FRAMES[6][9] = {
|
|
||||||
{ 4, 26, 54, 72, 92, 134, FRAMES_END },
|
|
||||||
{ 2, 80, 95, 117, 166, FRAMES_END },
|
|
||||||
{ 1, FRAMES_END },
|
|
||||||
{ 42, FRAMES_END },
|
|
||||||
{ FRAMES_END },
|
|
||||||
{ FRAMES_END }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Title animations file list
|
|
||||||
static const char *const TITLE_NAMES[7] = {
|
|
||||||
"27pro1", "14note", "coff1", "coff2", "coff3", "coff4", "14kick"
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int TITLE_FRAMES[7][9] = {
|
|
||||||
{ 29, 131, FRAMES_END },
|
|
||||||
{ 55, 80, 95, 117, 166, FRAMES_END },
|
|
||||||
{ 15, FRAMES_END },
|
|
||||||
{ 4, 37, 92, FRAMES_END },
|
|
||||||
{ 2, 43, FRAMES_END },
|
|
||||||
{ 2, FRAMES_END },
|
|
||||||
{ 10, 50, FRAMES_END }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int NO_FRAMES = FRAMES_END;
|
static const int NO_FRAMES = FRAMES_END;
|
||||||
|
|
||||||
Animation::Animation(SherlockEngine *vm): _vm(vm) {
|
Animation::Animation(SherlockEngine *vm): _vm(vm) {
|
||||||
|
@ -171,6 +138,48 @@ bool Animation::play(const Common::String &filename, int minDelay, int fade,
|
||||||
return !skipped && !_vm->shouldQuit();
|
return !skipped && !_vm->shouldQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the prologue name array
|
||||||
|
*/
|
||||||
|
void Animation::setPrologueNames(const char *const *names, int count) {
|
||||||
|
for (int idx = 0; idx < count; ++idx, names++) {
|
||||||
|
_prologueNames.push_back(*names);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the prologue frame array
|
||||||
|
*/
|
||||||
|
void Animation::setPrologueFrames(const int *frames, int count, int maxFrames) {
|
||||||
|
_prologueFrames.resize(count);
|
||||||
|
|
||||||
|
for (int idx = 0; idx < count; ++idx, frames + maxFrames) {
|
||||||
|
_prologueFrames[idx].resize(maxFrames);
|
||||||
|
Common::copy(frames, frames + maxFrames, &_prologueFrames[idx][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the title name array
|
||||||
|
*/
|
||||||
|
void Animation::setTitleNames(const char *const *names, int count) {
|
||||||
|
for (int idx = 0; idx < count; ++idx, names++) {
|
||||||
|
_titleNames.push_back(*names);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the title frame array
|
||||||
|
*/
|
||||||
|
void Animation::setTitleFrames(const int *frames, int count, int maxFrames) {
|
||||||
|
_titleFrames.resize(count);
|
||||||
|
|
||||||
|
for (int idx = 0; idx < count; ++idx, frames + maxFrames) {
|
||||||
|
_titleFrames[idx].resize(maxFrames);
|
||||||
|
Common::copy(frames, frames + maxFrames, &_titleFrames[idx][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for whether an animation is being played that has associated sound
|
* Checks for whether an animation is being played that has associated sound
|
||||||
*/
|
*/
|
||||||
|
@ -178,16 +187,16 @@ const int *Animation::checkForSoundFrames(const Common::String &filename) {
|
||||||
const int *frames = &NO_FRAMES;
|
const int *frames = &NO_FRAMES;
|
||||||
|
|
||||||
if (_vm->_soundOverride.empty()) {
|
if (_vm->_soundOverride.empty()) {
|
||||||
for (int idx = 0; idx < PROLOGUE_NAMES_COUNT; ++idx) {
|
for (Common::Array<const char *>::size_type idx = 0; idx < _prologueNames.size(); ++idx) {
|
||||||
if (filename.equalsIgnoreCase(PROLOGUE_NAMES[idx])) {
|
if (filename.equalsIgnoreCase(_prologueNames[idx])) {
|
||||||
frames = &PROLOGUE_FRAMES[idx][0];
|
frames = &_prologueFrames[idx][0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int idx = 0; idx < TITLE_NAMES_COUNT; ++idx) {
|
for (Common::Array<const char *>::size_type idx = 0; idx < _titleNames.size(); ++idx) {
|
||||||
if (filename.equalsIgnoreCase(TITLE_NAMES[idx])) {
|
if (filename.equalsIgnoreCase(_titleNames[idx])) {
|
||||||
frames = &TITLE_FRAMES[idx][0];
|
frames = &_titleFrames[idx][0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,20 +25,35 @@
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
|
#include "common/array.h"
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
|
#define FRAMES_END 32000
|
||||||
|
|
||||||
class SherlockEngine;
|
class SherlockEngine;
|
||||||
|
|
||||||
class Animation {
|
class Animation {
|
||||||
private:
|
private:
|
||||||
SherlockEngine *_vm;
|
SherlockEngine *_vm;
|
||||||
|
|
||||||
|
Common::Array<const char *> _prologueNames;
|
||||||
|
Common::Array<Common::Array<int>> _prologueFrames;
|
||||||
|
|
||||||
|
Common::Array<const char *> _titleNames;
|
||||||
|
Common::Array<Common::Array<int>> _titleFrames;
|
||||||
|
|
||||||
const int *checkForSoundFrames(const Common::String &filename);
|
const int *checkForSoundFrames(const Common::String &filename);
|
||||||
public:
|
public:
|
||||||
public:
|
public:
|
||||||
Animation(SherlockEngine *vm);
|
Animation(SherlockEngine *vm);
|
||||||
|
|
||||||
|
void setPrologueNames(const char *const *names, int count);
|
||||||
|
void setPrologueFrames(const int *frames, int count, int maxFrames);
|
||||||
|
|
||||||
|
void setTitleNames(const char *const *names, int count);
|
||||||
|
void setTitleFrames(const int *frames, int count, int maxFrames);
|
||||||
|
|
||||||
bool play(const Common::String &filename, int minDelay, int fade, bool setPalette, int speed);
|
bool play(const Common::String &filename, int minDelay, int fade, bool setPalette, int speed);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,46 @@
|
||||||
|
|
||||||
#include "sherlock/scalpel/scalpel.h"
|
#include "sherlock/scalpel/scalpel.h"
|
||||||
#include "sherlock/sherlock.h"
|
#include "sherlock/sherlock.h"
|
||||||
|
#include "sherlock/animation.h"
|
||||||
|
|
||||||
namespace Sherlock {
|
namespace Sherlock {
|
||||||
|
|
||||||
namespace Scalpel {
|
namespace Scalpel {
|
||||||
|
|
||||||
|
#define PROLOGUE_NAMES_COUNT 6
|
||||||
|
|
||||||
|
// The following are a list of filenames played in the prologue that have
|
||||||
|
// special effects associated with them at specific frames
|
||||||
|
static const char *const PROLOGUE_NAMES[PROLOGUE_NAMES_COUNT] = {
|
||||||
|
"subway1", "subway2", "finale2", "suicid", "coff3", "coff4"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int PROLOGUE_FRAMES[6][9] = {
|
||||||
|
{ 4, 26, 54, 72, 92, 134, FRAMES_END },
|
||||||
|
{ 2, 80, 95, 117, 166, FRAMES_END },
|
||||||
|
{ 1, FRAMES_END },
|
||||||
|
{ 42, FRAMES_END },
|
||||||
|
{ FRAMES_END },
|
||||||
|
{ FRAMES_END }
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TITLE_NAMES_COUNT 7
|
||||||
|
|
||||||
|
// Title animations file list
|
||||||
|
static const char *const TITLE_NAMES[TITLE_NAMES_COUNT] = {
|
||||||
|
"27pro1", "14note", "coff1", "coff2", "coff3", "coff4", "14kick"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int TITLE_FRAMES[7][9] = {
|
||||||
|
{ 29, 131, FRAMES_END },
|
||||||
|
{ 55, 80, 95, 117, 166, FRAMES_END },
|
||||||
|
{ 15, FRAMES_END },
|
||||||
|
{ 4, 37, 92, FRAMES_END },
|
||||||
|
{ 2, 43, FRAMES_END },
|
||||||
|
{ 2, FRAMES_END },
|
||||||
|
{ 10, 50, FRAMES_END }
|
||||||
|
};
|
||||||
|
|
||||||
#define NUM_PLACES 100
|
#define NUM_PLACES 100
|
||||||
const int MAP_X[NUM_PLACES] = {
|
const int MAP_X[NUM_PLACES] = {
|
||||||
0, 368, 0, 219, 0, 282, 0, 43, 0, 0, 396, 408, 0, 0, 0, 568, 37, 325,
|
0, 368, 0, 219, 0, 282, 0, 43, 0, 0, 396, 408, 0, 0, 0, 568, 37, 325,
|
||||||
|
@ -227,6 +262,12 @@ void ScalpelEngine::initialize() {
|
||||||
// Set up constants used by the talk system
|
// Set up constants used by the talk system
|
||||||
_talk->setSequences(&TALK_SEQUENCES[0][0], &STILL_SEQUENCES[0][0], MAX_PEOPLE);
|
_talk->setSequences(&TALK_SEQUENCES[0][0], &STILL_SEQUENCES[0][0], MAX_PEOPLE);
|
||||||
|
|
||||||
|
_animation->setPrologueNames(&PROLOGUE_NAMES[0], PROLOGUE_NAMES_COUNT);
|
||||||
|
_animation->setPrologueFrames(&PROLOGUE_FRAMES[0][0], 6, 9);
|
||||||
|
|
||||||
|
_animation->setTitleNames(&TITLE_NAMES[0], TITLE_NAMES_COUNT);
|
||||||
|
_animation->setTitleFrames(&TITLE_FRAMES[0][0], 7, 9);
|
||||||
|
|
||||||
// Starting scene
|
// Starting scene
|
||||||
if (getIsDemo())
|
if (getIsDemo())
|
||||||
_scene->_goToScene = 3;
|
_scene->_goToScene = 3;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue