From 65bb902be931a510181c50cc85402cb70359d4e7 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 2 Mar 2007 11:37:42 +0000 Subject: - Fixed the actor freeze issue in the garage in Bargon Attack - Some minor fixes svn-id: r25921 --- engines/gob/game_v2.cpp | 7 +++++++ engines/gob/inter_v2.cpp | 29 ++++++++++++++++++----------- engines/gob/scenery.cpp | 1 + 3 files changed, 26 insertions(+), 11 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 01974a0ce3..11d3743320 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -1038,8 +1038,15 @@ void Game_v2::collisionsBlock(void) { WRITE_VAR(16, _activeCollResId & 0xFFF); if (collPtr->funcLeave != 0) { + int16 collResIdBak = _activeCollResId; + int16 collIndexBak = _activeCollIndex; + timeKey = _vm->_util->getTimeKey(); collSub(collPtr->funcLeave); + + _activeCollResId = collResIdBak; + _activeCollIndex = collIndexBak; + _vm->_inter->animPalette(); deltaTime = timeVal - (_vm->_util->getTimeKey() - timeKey); diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index cb973290aa..987fe597ca 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -774,7 +774,7 @@ void Inter_v2::checkSwitchTable(char **ppExec) { _vm->_global->_inter_execPtr++; if (!found && (value == (int8) *_vm->_global->_inter_execPtr)) found = true; - _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += 2; break; default: @@ -1539,11 +1539,13 @@ bool Inter_v2::o2_playSound(char &cmdCount, int16 &counter, int16 &retFlag) { int16 freq2; int16 repCount; // di int16 index; // si + int16 endRep; index = _vm->_parse->parseValExpr(); repCount = _vm->_parse->parseValExpr(); frequency = _vm->_parse->parseValExpr(); + warning("playSound(%d, %d, %d)", index, repCount, frequency); _soundEndTimeKey = 0; if (_vm->_game->_soundSamples[index] == 0) return false; @@ -1555,17 +1557,15 @@ bool Inter_v2::o2_playSound(char &cmdCount, int16 &counter, int16 &retFlag) { repCount = -repCount; _soundEndTimeKey = _vm->_util->getTimeKey(); - if (frequency == 0) - freq2 = _vm->_game->_soundSamples[index]->frequency; - else - freq2 = frequency; + freq2 = frequency ? frequency : _vm->_game->_soundSamples[index]->frequency; + endRep = MAX(repCount - 1, 1); + _soundStopVal = (10 * (_vm->_game->_soundSamples[index]->size / 2)) / freq2; _soundEndTimeKey += - ((_vm->_game->_soundSamples[index]->size * repCount - + ((_vm->_game->_soundSamples[index]->size * endRep - _vm->_game->_soundSamples[index]->size / 2) * 1000) / freq2; } - // loc_E2F3 if ((_vm->_game->_soundTypes[index] & 8)) { if (_vm->_adlib) { _vm->_adlib->load((byte *) _vm->_game->_soundSamples[index]->data, index); @@ -1574,7 +1574,7 @@ bool Inter_v2::o2_playSound(char &cmdCount, int16 &counter, int16 &retFlag) { } } else { _vm->_snd->stopSound(0); - _vm->_snd->playSample(_vm->_game->_soundSamples[index], repCount, frequency); + _vm->_snd->playSample(_vm->_game->_soundSamples[index], repCount - 1, frequency); } return false; @@ -1962,6 +1962,16 @@ void Inter_v2::o2_initMult(void) { posYVar = _vm->_parse->parseVarIndex(); animDataVar = _vm->_parse->parseVarIndex(); + if (_vm->_mult->_objects && (oldObjCount != _vm->_mult->_objCount)) { + warning("Initializing new objects without having cleaned up the old ones at first"); + delete[] _vm->_mult->_objects; + delete[] _vm->_mult->_renderData2; + delete[] _vm->_mult->_orderArray; + _vm->_mult->_objects = 0; + _vm->_mult->_renderData2 = 0; + _vm->_mult->_orderArray = 0; + } + if (_vm->_mult->_objects == 0) { _vm->_mult->_renderData2 = new Mult::Mult_Object*[_vm->_mult->_objCount]; memset(_vm->_mult->_renderData2, 0, _vm->_mult->_objCount * sizeof(Mult::Mult_Object*)); @@ -1990,9 +2000,6 @@ void Inter_v2::o2_initMult(void) { _vm->_mult->_objects[i].goblinX = 1; _vm->_mult->_objects[i].goblinY = 1; } - } else if (oldObjCount != _vm->_mult->_objCount) { - error("o2_initMult: Object count changed, but storage didn't (old count = %d, new count = %d)", - oldObjCount, _vm->_mult->_objCount); } if (_vm->_anim->_animSurf != 0 && diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp index 74fa602161..8b3b12831f 100644 --- a/engines/gob/scenery.cpp +++ b/engines/gob/scenery.cpp @@ -222,6 +222,7 @@ void Scenery::freeStatic(int16 index) { delete[] _statics[index].pieces; delete[] _statics[index].piecesFromExt; + _statics[index].layersCount = 0; _staticPictCount[index] = -1; } -- cgit v1.2.3