MADS: Fix crash if you talk to intern in gurney room too quickly
This commit is contained in:
parent
82faf6b50d
commit
d23e493b46
3 changed files with 23 additions and 3 deletions
|
@ -2581,6 +2581,12 @@ void Scene318::handleInternDialog(int quoteId, int quoteNum, uint32 timeout) {
|
|||
_scene->_kernelMessages.reset();
|
||||
_internTalkingFl = true;
|
||||
|
||||
// WORKAROUND: In case the player launches multiple talk selections with the
|
||||
// intern before previous ones have finished, take care of removing any
|
||||
int seqIndex;
|
||||
while ((seqIndex = _scene->_sequences.findByTrigger(63)) != -1)
|
||||
_scene->_sequences.remove(seqIndex);
|
||||
|
||||
for (int i = 0; i < quoteNum; i++) {
|
||||
_game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON;
|
||||
_scene->_sequences.addTimer(180, 63);
|
||||
|
|
|
@ -144,7 +144,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri
|
|||
return seqIndex;
|
||||
}
|
||||
|
||||
int SequenceList::addTimer(int timeout, int abortVal) {
|
||||
int SequenceList::addTimer(int timeout, int endTrigger) {
|
||||
Scene &scene = _vm->_game->_scene;
|
||||
uint seqIndex;
|
||||
for (seqIndex = 0; seqIndex < _entries.size(); ++seqIndex) {
|
||||
|
@ -164,7 +164,7 @@ int SequenceList::addTimer(int timeout, int abortVal) {
|
|||
se._entries._count = 0;
|
||||
se._triggerMode = _vm->_game->_triggerSetupMode;
|
||||
se._actionNouns = _vm->_game->_scene._action._activeAction;
|
||||
addSubEntry(seqIndex, SEQUENCE_TRIGGER_EXPIRE, 0, abortVal);
|
||||
addSubEntry(seqIndex, SEQUENCE_TRIGGER_EXPIRE, 0, endTrigger);
|
||||
|
||||
return seqIndex;
|
||||
}
|
||||
|
@ -181,6 +181,19 @@ void SequenceList::remove(int seqIndex) {
|
|||
scene._spriteSlots.deleteTimer(seqIndex);
|
||||
}
|
||||
|
||||
int SequenceList::findByTrigger(int trigger) {
|
||||
for (int idx = 0; idx < _entries.size(); ++idx) {
|
||||
if (_entries[idx]._active) {
|
||||
for (uint subIdx = 0; subIdx < _entries[idx]._entries._count; ++subIdx) {
|
||||
if (_entries[idx]._entries._trigger[subIdx] == trigger)
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) {
|
||||
Scene &scene = _vm->_game->_scene;
|
||||
SequenceEntry &timerEntry = _entries[seqIndex];
|
||||
|
|
|
@ -101,8 +101,9 @@ public:
|
|||
int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, int scale, int depth,
|
||||
int frameInc, SpriteAnimType animType, int numSprites, int frameStart);
|
||||
|
||||
int addTimer(int timeout, int abortVal);
|
||||
int addTimer(int timeout, int endTrigger);
|
||||
void remove(int seqIndex);
|
||||
int findByTrigger(int trigger);
|
||||
void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot);
|
||||
bool loadSprites(int seqIndex);
|
||||
void tick();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue