SHERLOCK: Free freeing and resetting People list

This commit is contained in:
Paul Gilbert 2015-05-25 08:21:57 -04:00
parent 40afa01369
commit bcb8c02ba1
2 changed files with 19 additions and 9 deletions

View file

@ -73,11 +73,16 @@ void Sprite::setImageFrame() {
int imageNumber = _walkSequences[_sequenceNumber][frameNum];
if (IS_SERRATED_SCALPEL)
imageNumber = imageNumber + +_walkSequences[_sequenceNumber][0] - 2;
imageNumber = imageNumber + _walkSequences[_sequenceNumber][0] - 2;
else if (imageNumber > _numFrames)
imageNumber = 1;
_imageFrame = &(_altSequences ? *_altImages : *_images)[imageNumber];
// Get the images to use
ImageFile *images = _altSequences ? _altImages : _images;
assert(images);
// Set the frame pointer
_imageFrame = &(*images)[imageNumber];
}
void Sprite::adjustSprite() {

View file

@ -164,14 +164,17 @@ void People::reset() {
// Load the default walk sequences
p._oldWalkSequence = -1;
p._walkSequences.resize(MAX_HOLMES_SEQUENCE);
for (int idx = 0; idx < MAX_HOLMES_SEQUENCE; ++idx) {
p._walkSequences[idx]._sequences.clear();
const byte *pSrc = &CHARACTER_SEQUENCES[idx][0];
do {
p._walkSequences[idx]._sequences.push_back(*pSrc);
} while (*pSrc++);
if (IS_SERRATED_SCALPEL) {
p._walkSequences.resize(MAX_HOLMES_SEQUENCE);
for (int seqIdx = 0; seqIdx < MAX_HOLMES_SEQUENCE; ++seqIdx) {
p._walkSequences[seqIdx]._sequences.clear();
const byte *pSrc = &CHARACTER_SEQUENCES[seqIdx][0];
do {
p._walkSequences[seqIdx]._sequences.push_back(*pSrc);
} while (*pSrc++);
}
}
}
@ -259,6 +262,8 @@ bool People::freeWalk() {
if (_data[idx]._walkLoaded) {
delete _data[idx]._images;
_data[idx]._images = nullptr;
_data[idx]._walkLoaded = false;
result = true;
}
}