Partial fix for bug #885488 (Some INSANE trouble)

o Finally fixed seek error. Now I never encounter it, though there are weird
   SAUD errors in some cases.
 o Started to hunt cave-dude-only bug

svn-id: r12653
This commit is contained in:
Eugene Sandulenko 2004-01-28 04:07:54 +00:00
parent 4c430c9b4a
commit ece80a4a1f
5 changed files with 23 additions and 17 deletions

View File

@ -40,10 +40,7 @@
// TODO (in no particular order): // TODO (in no particular order):
// o Ben's velocity don't get zeroed after crash // o Ben's velocity don't get zeroed after crash
// o Mine road used to have correct behaviour with ESC but now is not.
// Instead of skipping portions of road it just restarts
// o Road signs are not aligned properly // o Road signs are not aligned properly
// o With goggles on there is a seek error
// o SAUD complaining again // o SAUD complaining again
// o Insane::postCase16() has workaround. Cockpit is not transparent so it is // o Insane::postCase16() has workaround. Cockpit is not transparent so it is
// disabled now // disabled now

View File

@ -200,7 +200,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
} }
void Insane::proc62(void) { void Insane::proc62(void) {
if (readArray(58) == 0) if (readArray(58) != 0)
_enemy[EN_TORQUE].field_10 = 1; _enemy[EN_TORQUE].field_10 = 1;
if (_enemy[EN_TORQUE].field_8 == 0) { if (_enemy[EN_TORQUE].field_8 == 0) {
@ -217,15 +217,22 @@ void Insane::proc62(void) {
int32 en, edi, ebp, edx, esi, eax, ebx, ecx; int32 en, edi, ebp, edx, esi, eax, ebx, ecx;
for (en = 0; _enemy[en].field_10 == 0; en++); edx = eax = 0;
en -= 4;
for (eax = 0; eax < 9; eax++)
if (_enemy[eax].field_10 == 0)
edx++;
edx -= 4;
en = edx;
ebp = 0; ebp = 0;
edi = 0; edi = 0;
_loop1: _loop1:
edi++; edi++;
if (edi > 14) if (edi >= 14)
goto loc5; goto loc5;
edx = rand() / 11; edx = rand() / 11;
@ -351,6 +358,9 @@ void Insane::proc63(void) {
} }
void Insane::proc64(int32 enemy1) { void Insane::proc64(int32 enemy1) {
if (enemy1 >= _val215d)
return;
_val215d--; _val215d--;
for (int en = enemy1; en < _val215d; en++) for (int en = enemy1; en < _val215d; en++)

View File

@ -1052,7 +1052,7 @@ void Insane::postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 140, 168, 1, 2, 0, "%s", buf); smlayer_showStatusMsg(-1, renderBitmap, codecparam, 140, 168, 1, 2, 0, "%s", buf);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 170, 43, 1, 2, 0, "%s", buf); smlayer_showStatusMsg(-1, renderBitmap, codecparam, 170, 43, 1, 2, 0, "%s", buf);
// FIXME: it should be transparent // FIXME: it should be transparent, so now it is disabled
//smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0); //smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
if (!_val124_) if (!_val124_)

View File

@ -191,6 +191,7 @@ uint32 FileChunk::getDword() {
void FileChunk::reinit(uint32 offset) { void FileChunk::reinit(uint32 offset) {
_offset = 0; _offset = 0;
_data->seek(0);
_type = _data->readUint32BE(); _type = _data->readUint32BE();
_size = _data->readUint32BE(); _size = _data->readUint32BE();
_curPos = 0; _curPos = 0;

View File

@ -872,6 +872,9 @@ void SmushPlayer::parseNextFrame() {
case TYPE_FRME: case TYPE_FRME:
handleFrame(*sub); handleFrame(*sub);
break; break;
case TYPE_AHDR: // FT INSANE may seek file to the beginning
handleAnimHeader(*sub);
break;
default: default:
error("Unknown Chunk found at %x: %x, %d", _base->tell(), sub->getType(), sub->getSize()); error("Unknown Chunk found at %x: %x, %d", _base->tell(), sub->getType(), sub->getSize());
} }
@ -964,28 +967,23 @@ void SmushPlayer::insanity(bool flag) {
} }
void SmushPlayer::seekSan(const char *file, const char *directory, int32 pos, int32 contFrame) { void SmushPlayer::seekSan(const char *file, const char *directory, int32 pos, int32 contFrame) {
Chunk *sub;
if (file) { if (file) {
if (_base) if (_base)
delete _base; delete _base;
_base = new FileChunk(file, directory); _base = new FileChunk(file, directory);
pos = 0; if (pos >= 8)
pos -= 8;
} else { } else {
_base->reinit(pos); _base->reinit(pos);
} }
if (pos != 8 && pos) { if (pos != 8 && pos) {
_base->seek(pos, FileChunk::seek_start);
_middleAudio = true; _middleAudio = true;
} else {
_base->seek(pos, FileChunk::seek_start);
sub = _base->subBlock();
checkBlock(*sub, TYPE_AHDR);
handleAnimHeader(*sub);
} }
_base->seek(pos, FileChunk::seek_start);
_frame = contFrame; _frame = contFrame;
} }