2007-07-29 16:33:11 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
#include "kyra/kyra_hof.h"
|
2007-07-29 16:33:11 +00:00
|
|
|
#include "kyra/screen_v2.h"
|
2007-10-10 09:06:15 +00:00
|
|
|
#include "kyra/sound.h"
|
2007-07-29 16:33:11 +00:00
|
|
|
#include "kyra/wsamovie.h"
|
2008-05-02 14:46:30 +00:00
|
|
|
#include "kyra/resource.h"
|
2007-07-29 16:33:11 +00:00
|
|
|
|
|
|
|
#include "common/func.h"
|
|
|
|
|
|
|
|
namespace Kyra {
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::enterNewScene(%d, %d, %d, %d, %d)", newScene, facing, unk1, unk2, unk3);
|
2007-10-13 06:57:47 +00:00
|
|
|
if (_newChapterFile != _currentTalkFile) {
|
|
|
|
_currentTalkFile = _newChapterFile;
|
2008-01-27 02:05:37 +00:00
|
|
|
if (_flags.isTalkie) {
|
|
|
|
showMessageFromCCode(265, 150, 0);
|
|
|
|
_screen->updateScreen();
|
|
|
|
openTalkFile(_currentTalkFile);
|
|
|
|
}
|
2007-10-13 06:57:47 +00:00
|
|
|
showMessage(0, 207);
|
|
|
|
_screen->updateScreen();
|
|
|
|
}
|
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_screen->hideMouse();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (!unk3) {
|
2008-03-16 02:00:14 +00:00
|
|
|
updateWaterFlasks();
|
2008-03-16 12:34:23 +00:00
|
|
|
displayInvWsaLastFrame();
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (unk1) {
|
|
|
|
int x = _mainCharacter.x1;
|
|
|
|
int y = _mainCharacter.y1;
|
|
|
|
|
|
|
|
switch (facing) {
|
|
|
|
case 0:
|
|
|
|
y -= 6;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
x = 335;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
y = 147;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
x = -16;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
moveCharacter(facing, x, y);
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-10-10 09:06:15 +00:00
|
|
|
bool newSoundFile = false;
|
2008-04-06 13:32:41 +00:00
|
|
|
uint32 waitTime = 0;
|
2007-10-10 09:06:15 +00:00
|
|
|
if (_sceneList[newScene].sound != _lastMusicCommand) {
|
|
|
|
newSoundFile = true;
|
2008-04-06 13:32:41 +00:00
|
|
|
waitTime = _system->getMillis() + 1000;
|
2007-10-10 09:06:15 +00:00
|
|
|
_sound->beginFadeOut();
|
|
|
|
}
|
2008-02-18 23:04:37 +00:00
|
|
|
|
2008-03-16 17:16:17 +00:00
|
|
|
_chatAltFlag = false;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (!unk3) {
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->init(&_sceneScriptState, &_sceneScriptData);
|
|
|
|
_emc->start(&_sceneScriptState, 5);
|
|
|
|
while (_emc->isValid(&_sceneScriptState))
|
|
|
|
_emc->run(&_sceneScriptState);
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
Common::for_each(_wsaSlots, _wsaSlots+ARRAYSIZE(_wsaSlots), Common::mem_fun(&WSAMovieV2::close));
|
|
|
|
_specialExitCount = 0;
|
|
|
|
memset(_specialExitTable, -1, sizeof(_specialExitTable));
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_mainCharacter.sceneId = newScene;
|
|
|
|
_sceneList[newScene].flags &= ~1;
|
|
|
|
loadScenePal();
|
|
|
|
unloadScene();
|
|
|
|
loadSceneMsc();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
SceneDesc &scene = _sceneList[newScene];
|
|
|
|
_sceneExit1 = scene.exit1;
|
|
|
|
_sceneExit2 = scene.exit2;
|
|
|
|
_sceneExit3 = scene.exit3;
|
|
|
|
_sceneExit4 = scene.exit4;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-10-10 09:06:15 +00:00
|
|
|
if (newSoundFile) {
|
2008-04-06 13:32:41 +00:00
|
|
|
if (_sound->getMusicType() == Sound::kAdlib) {
|
2008-04-06 14:58:02 +00:00
|
|
|
while (_sound->isPlaying())
|
2008-04-06 13:32:41 +00:00
|
|
|
_system->delayMillis(10);
|
|
|
|
} else {
|
|
|
|
while (waitTime > _system->getMillis())
|
|
|
|
_system->delayMillis(10);
|
|
|
|
}
|
2007-10-10 09:06:15 +00:00
|
|
|
snd_loadSoundFile(_sceneList[newScene].sound);
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
startSceneScript(unk3);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_overwriteSceneFacing) {
|
|
|
|
facing = _mainCharacter.facing;
|
|
|
|
_overwriteSceneFacing = false;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
enterNewSceneUnk1(facing, unk2, unk3);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
setTimer1DelaySecs(-1);
|
|
|
|
_sceneScriptState.regs[3] = 1;
|
|
|
|
enterNewSceneUnk2(unk3);
|
|
|
|
_screen->showMouse();
|
|
|
|
_unk5 = 0;
|
2007-11-09 16:52:39 +00:00
|
|
|
setNextIdleAnimTimer();
|
2007-09-24 21:58:11 +00:00
|
|
|
|
|
|
|
_currentScene = newScene;
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::enterNewSceneUnk1(int facing, int unk1, int unk2) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::enterNewSceneUnk1(%d, %d, %d)", facing, unk1, unk2);
|
2007-07-29 16:33:11 +00:00
|
|
|
int x = 0, y = 0;
|
|
|
|
int x2 = 0, y2 = 0;
|
|
|
|
bool needProc = true;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_mainCharX == -1 && _mainCharY == -1) {
|
|
|
|
switch (facing+1) {
|
|
|
|
case 1: case 2: case 8:
|
|
|
|
x2 = _sceneEnterX3;
|
|
|
|
y2 = _sceneEnterY3;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 3:
|
|
|
|
x2 = _sceneEnterX4;
|
|
|
|
y2 = _sceneEnterY4;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 4: case 5: case 6:
|
|
|
|
x2 = _sceneEnterX1;
|
|
|
|
y2 = _sceneEnterY1;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 7:
|
|
|
|
x2 = _sceneEnterX2;
|
|
|
|
y2 = _sceneEnterY2;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
default:
|
|
|
|
x2 = y2 = -1;
|
|
|
|
break;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (x2 >= 316)
|
|
|
|
x2 = 312;
|
|
|
|
if (y2 >= 141)
|
|
|
|
y2 = 139;
|
|
|
|
if (x2 <= 4)
|
|
|
|
x2 = 8;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_mainCharX >= 0) {
|
|
|
|
x = x2 = _mainCharX;
|
|
|
|
needProc = false;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_mainCharY >= 0) {
|
|
|
|
y = y2 = _mainCharY;
|
|
|
|
needProc = false;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_mainCharX = _mainCharY = -1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (unk1 && needProc) {
|
|
|
|
x = x2;
|
|
|
|
y = y2;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
switch (facing) {
|
|
|
|
case 0:
|
|
|
|
y2 = 147;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 2:
|
|
|
|
x2 = -16;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 4:
|
|
|
|
y2 = y - 4;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 6:
|
|
|
|
x2 = 335;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
x2 &= ~3;
|
|
|
|
x &= ~3;
|
|
|
|
y2 &= ~1;
|
|
|
|
y &= ~1;
|
|
|
|
|
|
|
|
_mainCharacter.facing = facing;
|
|
|
|
_mainCharacter.x1 = _mainCharacter.x2 = x2;
|
|
|
|
_mainCharacter.y1 = _mainCharacter.y2 = y2;
|
|
|
|
initSceneAnims(unk2);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-10-10 09:06:15 +00:00
|
|
|
if (!unk2)
|
|
|
|
snd_playWanderScoreViaMap(_sceneList[_mainCharacter.sceneId].sound, 0);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (unk1 && !unk2 && _mainCharacter.animFrame != 32)
|
|
|
|
moveCharacter(facing, x, y);
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::enterNewSceneUnk2(int unk1) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::enterNewSceneUnk2(%d)", unk1);
|
2007-07-29 16:33:11 +00:00
|
|
|
_unk3 = -1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-02-18 23:04:37 +00:00
|
|
|
if (_flags.isTalkie) {
|
|
|
|
if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 &&
|
|
|
|
!queryGameFlag(0x1F1) && !queryGameFlag(0x192) && !queryGameFlag(0x193) &&
|
|
|
|
_mainCharacter.sceneId != 70 && !queryGameFlag(0x159) && _mainCharacter.sceneId != 37) {
|
|
|
|
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
|
|
|
|
updateCharacterAnim(0);
|
|
|
|
refreshAnimObjectsIfNeed();
|
|
|
|
}
|
|
|
|
} else if (_mainCharX != -1 && _mainCharY != -1) {
|
|
|
|
if (_characterFrameTable[_mainCharacter.facing] == 25)
|
|
|
|
_mainCharacter.facing = 5;
|
2007-07-29 16:33:11 +00:00
|
|
|
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
|
|
|
|
updateCharacterAnim(0);
|
|
|
|
refreshAnimObjectsIfNeed();
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (!unk1) {
|
|
|
|
runSceneScript4(0);
|
2008-02-22 00:33:56 +00:00
|
|
|
zanthSceneStartupChat();
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_unk4 = 0;
|
|
|
|
_unk3 = -1;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
int KyraEngine_HoF::trySceneChange(int *moveTable, int unk1, int updateChar) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::trySceneChange(%p, %d, %d)", (const void*)moveTable, unk1, updateChar);
|
2007-07-29 16:33:11 +00:00
|
|
|
bool running = true;
|
|
|
|
bool unkFlag = false;
|
|
|
|
int8 updateType = -1;
|
|
|
|
int changedScene = 0;
|
|
|
|
const int *moveTableStart = moveTable;
|
|
|
|
_unk4 = 0;
|
2007-10-12 01:26:27 +00:00
|
|
|
while (running && !_quitFlag) {
|
2007-07-29 16:33:11 +00:00
|
|
|
if (*moveTable >= 0 && *moveTable <= 7) {
|
|
|
|
_mainCharacter.facing = getOppositeFacingDirection(*moveTable);
|
|
|
|
unkFlag = true;
|
|
|
|
} else {
|
|
|
|
if (*moveTable == 8) {
|
|
|
|
running = false;
|
|
|
|
} else {
|
|
|
|
++moveTable;
|
|
|
|
unkFlag = false;
|
|
|
|
}
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (checkSceneChange()) {
|
|
|
|
running = false;
|
|
|
|
changedScene = 1;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (unk1) {
|
2008-03-16 14:32:49 +00:00
|
|
|
if (skipFlag()) {
|
|
|
|
resetSkipFlag(false);
|
2007-10-09 09:03:57 +00:00
|
|
|
running = false;
|
|
|
|
_unk4 = 1;
|
|
|
|
}
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (!unkFlag || !running)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
int ret = 0;
|
|
|
|
if (moveTable == moveTableStart || moveTable[1] == 8)
|
|
|
|
ret = updateCharPos(0);
|
|
|
|
else
|
|
|
|
ret = updateCharPos(moveTable);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
++moveTable;
|
|
|
|
|
|
|
|
++updateType;
|
|
|
|
if (!updateType) {
|
|
|
|
update();
|
|
|
|
} else if (updateType == 1) {
|
|
|
|
refreshAnimObjectsIfNeed();
|
|
|
|
updateType = -1;
|
|
|
|
}
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (updateChar)
|
|
|
|
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
updateCharacterAnim(0);
|
|
|
|
refreshAnimObjectsIfNeed();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (!changedScene && !_unk4) {
|
|
|
|
//XXX
|
|
|
|
}
|
|
|
|
return changedScene;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
int KyraEngine_HoF::checkSceneChange() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::checkSceneChange()");
|
2007-07-29 16:33:11 +00:00
|
|
|
SceneDesc &curScene = _sceneList[_mainCharacter.sceneId];
|
|
|
|
int charX = _mainCharacter.x1, charY = _mainCharacter.y1;
|
|
|
|
int facing = 0;
|
|
|
|
int process = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_screen->getLayer(charX, charY) == 1 && _unk3 == -6) {
|
|
|
|
facing = 0;
|
|
|
|
process = 1;
|
|
|
|
} else if (charX >= 316 && _unk3 == -5) {
|
|
|
|
facing = 2;
|
|
|
|
process = 1;
|
|
|
|
} else if (charY >= 142 && _unk3 == -4) {
|
|
|
|
facing = 4;
|
|
|
|
process = 1;
|
|
|
|
} else if (charX <= 4 && _unk3 == -3) {
|
|
|
|
facing = 6;
|
|
|
|
process = 1;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (!process)
|
|
|
|
return 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 newScene = 0xFFFF;
|
|
|
|
switch (facing) {
|
|
|
|
case 0:
|
|
|
|
newScene = curScene.exit1;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 2:
|
|
|
|
newScene = curScene.exit2;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 4:
|
|
|
|
newScene = curScene.exit3;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
case 6:
|
|
|
|
newScene = curScene.exit4;
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
default:
|
|
|
|
newScene = _mainCharacter.sceneId;
|
|
|
|
break;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (newScene == 0xFFFF)
|
|
|
|
return 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
enterNewScene(newScene, facing, 1, 1, 0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::unloadScene() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::unloadScene()");
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->unload(&_sceneScriptData);
|
2007-07-29 16:33:11 +00:00
|
|
|
freeSceneShapePtrs();
|
|
|
|
freeSceneAnims();
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::loadScenePal() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::loadScenePal()");
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 sceneId = _mainCharacter.sceneId;
|
|
|
|
memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
char filename[14];
|
2008-05-02 14:46:30 +00:00
|
|
|
strcpy(filename, _sceneList[sceneId].filename1);
|
2007-07-29 16:33:11 +00:00
|
|
|
strcat(filename, ".COL");
|
|
|
|
_screen->loadBitmap(filename, 3, 3, 0);
|
|
|
|
memcpy(_screen->getPalette(1), _screen->getCPagePtr(3), 384);
|
|
|
|
memset(_screen->getPalette(1), 0, 3);
|
|
|
|
memcpy(_scenePal, _screen->getCPagePtr(3)+336, 432);
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::loadSceneMsc() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::loadSceneMsc()");
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 sceneId = _mainCharacter.sceneId;
|
|
|
|
char filename[14];
|
2008-05-02 14:46:30 +00:00
|
|
|
strcpy(filename, _sceneList[sceneId].filename1);
|
2007-07-29 16:33:11 +00:00
|
|
|
strcat(filename, ".MSC");
|
|
|
|
_screen->loadBitmap(filename, 3, 5, 0);
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::startSceneScript(int unk1) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::startSceneScript(%d)", unk1);
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 sceneId = _mainCharacter.sceneId;
|
|
|
|
char filename[14];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
strcpy(filename, _sceneList[sceneId].filename1);
|
2008-03-27 22:07:57 +00:00
|
|
|
if (sceneId == 68 && (queryGameFlag(0x1BC) || queryGameFlag(0x1BD)))
|
2008-01-27 19:47:41 +00:00
|
|
|
strcpy(filename, "DOORX");
|
2007-07-29 16:33:11 +00:00
|
|
|
strcat(filename, ".CPS");
|
|
|
|
|
|
|
|
_screen->loadBitmap(filename, 3, 3, 0);
|
|
|
|
resetScaleTable();
|
|
|
|
_useCharPal = false;
|
|
|
|
memset(_charPalTable, 0, sizeof(_charPalTable));
|
2007-10-09 04:47:41 +00:00
|
|
|
memset(_layerFlagTable, 0, sizeof(_layerFlagTable));
|
2007-07-29 16:33:11 +00:00
|
|
|
memset(_specialSceneScriptState, 0, sizeof(_specialSceneScriptState));
|
|
|
|
|
|
|
|
_sceneEnterX1 = 160;
|
|
|
|
_sceneEnterY1 = 0;
|
|
|
|
_sceneEnterX2 = 296;
|
|
|
|
_sceneEnterY2 = 72;
|
|
|
|
_sceneEnterX3 = 160;
|
|
|
|
_sceneEnterY3 = 128;
|
|
|
|
_sceneEnterX4 = 24;
|
|
|
|
_sceneEnterY4 = 72;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneCommentString = "Undefined scene comment string!";
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->init(&_sceneScriptState, &_sceneScriptData);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
strcpy(filename, _sceneList[sceneId].filename1);
|
2007-07-29 16:33:11 +00:00
|
|
|
strcat(filename, ".");
|
2008-01-27 02:05:37 +00:00
|
|
|
strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-04-19 14:31:10 +00:00
|
|
|
_res->exists(filename, true);
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->load(filename, &_sceneScriptData, &_opcodes);
|
2007-07-29 16:33:11 +00:00
|
|
|
runSceneScript7();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->start(&_sceneScriptState, 0);
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneScriptState.regs[0] = sceneId;
|
|
|
|
_sceneScriptState.regs[5] = unk1;
|
2008-04-29 15:12:09 +00:00
|
|
|
while (_emc->isValid(&_sceneScriptState))
|
|
|
|
_emc->run(&_sceneScriptState);
|
2007-07-29 16:33:11 +00:00
|
|
|
|
|
|
|
memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
for (int i = 0; i < 10; ++i) {
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->init(&_sceneSpecialScripts[i], &_sceneScriptData);
|
|
|
|
_emc->start(&_sceneSpecialScripts[i], i+8);
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneSpecialScriptsTimer[i] = 0;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneEnterX1 &= ~3;
|
|
|
|
_sceneEnterX2 &= ~3;
|
|
|
|
_sceneEnterX3 &= ~3;
|
|
|
|
_sceneEnterX4 &= ~3;
|
|
|
|
_sceneEnterY1 &= ~1;
|
|
|
|
_sceneEnterY2 &= ~1;
|
|
|
|
_sceneEnterY3 &= ~1;
|
|
|
|
_sceneEnterY4 &= ~1;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::runSceneScript2() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::runSceneScript2()");
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->init(&_sceneScriptState, &_sceneScriptData);
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneScriptState.regs[4] = _itemInHand;
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->start(&_sceneScriptState, 2);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
while (_emc->isValid(&_sceneScriptState))
|
|
|
|
_emc->run(&_sceneScriptState);
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::runSceneScript4(int unk1) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::runSceneScript4(%d)", unk1);
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneScriptState.regs[4] = _itemInHand;
|
|
|
|
_sceneScriptState.regs[5] = unk1;
|
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->start(&_sceneScriptState, 4);
|
|
|
|
while (_emc->isValid(&_sceneScriptState))
|
|
|
|
_emc->run(&_sceneScriptState);
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::runSceneScript7() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::runSceneScript7()");
|
2007-07-29 16:33:11 +00:00
|
|
|
int oldPage = _screen->_curPage;
|
|
|
|
_screen->_curPage = 2;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->start(&_sceneScriptState, 7);
|
|
|
|
while (_emc->isValid(&_sceneScriptState))
|
|
|
|
_emc->run(&_sceneScriptState);
|
2007-07-29 16:33:11 +00:00
|
|
|
|
|
|
|
_screen->_curPage = oldPage;
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::initSceneAnims(int unk1) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::initSceneAnims(%d)", unk1);
|
2007-07-29 16:33:11 +00:00
|
|
|
for (int i = 0; i < ARRAYSIZE(_animObjects); ++i)
|
|
|
|
_animObjects[i].enabled = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
bool animInit = false;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
AnimObj *animState = &_animObjects[0];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_mainCharacter.animFrame != 32)
|
|
|
|
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->enabled = 1;
|
|
|
|
animState->xPos1 = _mainCharacter.x1;
|
|
|
|
animState->yPos1 = _mainCharacter.y1;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->shapePtr = getShapePtr(_mainCharacter.animFrame);
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->shapeIndex1 = animState->shapeIndex2 = _mainCharacter.animFrame;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
int frame = _mainCharacter.animFrame - 9;
|
|
|
|
int shapeX = _shapeDescTable[frame].xAdd;
|
|
|
|
int shapeY = _shapeDescTable[frame].yAdd;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->xPos2 = _mainCharacter.x1;
|
|
|
|
animState->yPos2 = _mainCharacter.y1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-02 15:39:51 +00:00
|
|
|
_charScale = getScale(_mainCharacter.x1, _mainCharacter.y1);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-02 15:39:51 +00:00
|
|
|
int shapeXScaled = (shapeX * _charScale) >> 8;
|
|
|
|
int shapeYScaled = (shapeY * _charScale) >> 8;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->xPos2 += shapeXScaled;
|
|
|
|
animState->yPos2 += shapeYScaled;
|
|
|
|
animState->xPos3 = animState->xPos2;
|
|
|
|
animState->yPos3 = animState->yPos2;
|
|
|
|
animState->needRefresh = 1;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->specialRefresh = 1;
|
2007-07-29 16:33:11 +00:00
|
|
|
|
|
|
|
_animList = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
AnimObj *charAnimState = animState;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
|
|
animState = &_animObjects[i+1];
|
|
|
|
animState->enabled = 0;
|
|
|
|
animState->needRefresh = 0;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->specialRefresh = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_sceneAnims[i].flags & 1) {
|
|
|
|
animState->enabled = 1;
|
|
|
|
animState->needRefresh = 1;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->specialRefresh = 1;
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->animFlags = _sceneAnims[i].flags & 8;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_sceneAnims[i].flags & 2)
|
|
|
|
animState->flags = 0x800;
|
|
|
|
else
|
|
|
|
animState->flags = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_sceneAnims[i].flags & 4)
|
|
|
|
animState->flags |= 1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->xPos1 = _sceneAnims[i].x;
|
|
|
|
animState->yPos1 = _sceneAnims[i].y;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_sceneAnims[i].flags & 0x20)
|
|
|
|
animState->shapePtr = _sceneShapeTable[_sceneAnims[i].shapeIndex];
|
|
|
|
else
|
|
|
|
animState->shapePtr = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_sceneAnims[i].flags & 0x40) {
|
|
|
|
animState->shapeIndex3 = _sceneAnims[i].shapeIndex;
|
|
|
|
animState->animNum = i;
|
|
|
|
} else {
|
|
|
|
animState->shapeIndex3 = 0xFFFF;
|
|
|
|
animState->animNum = 0xFFFF;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->shapeIndex2 = 0xFFFF;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->xPos3 = animState->xPos2 = _sceneAnims[i].x2;
|
|
|
|
animState->yPos3 = animState->yPos2 = _sceneAnims[i].y2;
|
|
|
|
animState->width = _sceneAnims[i].width;
|
|
|
|
animState->height = _sceneAnims[i].height;
|
|
|
|
animState->width2 = animState->height2 = _sceneAnims[i].specialSize;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_sceneAnims[i].flags & 1) {
|
|
|
|
if (animInit) {
|
|
|
|
_animList = addToAnimListSorted(_animList, animState);
|
|
|
|
} else {
|
|
|
|
_animList = initAnimList(_animList, animState);
|
|
|
|
animInit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (animInit) {
|
|
|
|
_animList = addToAnimListSorted(_animList, charAnimState);
|
|
|
|
} else {
|
|
|
|
_animList = initAnimList(_animList, charAnimState);
|
|
|
|
animInit = true;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
for (int i = 0; i < 30; ++i) {
|
|
|
|
animState = &_animObjects[i+11];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 shapeIndex = _itemList[i].id;
|
|
|
|
if (shapeIndex == 0xFFFF || _itemList[i].sceneId != _mainCharacter.sceneId) {
|
|
|
|
animState->enabled = 0;
|
|
|
|
animState->needRefresh = 0;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->specialRefresh = 0;
|
2007-07-29 16:33:11 +00:00
|
|
|
} else {
|
|
|
|
animState->xPos1 = _itemList[i].x;
|
|
|
|
animState->yPos1 = _itemList[i].y;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->shapePtr = getShapePtr(64+shapeIndex);
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->shapeIndex1 = animState->shapeIndex2 = shapeIndex+64;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->xPos2 = _itemList[i].x;
|
|
|
|
animState->yPos2 = _itemList[i].y;
|
|
|
|
int objectScale = getScale(animState->xPos2, animState->yPos2);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
const uint8 *shape = getShapePtr(animState->shapeIndex1);
|
|
|
|
animState->xPos2 -= (_screen->getShapeScaledWidth(shape, objectScale) >> 1);
|
|
|
|
animState->yPos2 -= (_screen->getShapeScaledHeight(shape, objectScale) >> 1);
|
|
|
|
animState->xPos3 = animState->xPos2;
|
|
|
|
animState->yPos3 = animState->yPos2;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
animState->enabled = 1;
|
|
|
|
animState->needRefresh = 1;
|
2008-05-02 14:46:30 +00:00
|
|
|
animState->specialRefresh = 1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (animInit) {
|
|
|
|
_animList = addToAnimListSorted(_animList, animState);
|
|
|
|
} else {
|
|
|
|
_animList = initAnimList(_animList, animState);
|
|
|
|
animInit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
_animObjects[0].specialRefresh = 1;
|
2007-07-29 16:33:11 +00:00
|
|
|
_animObjects[0].needRefresh = 1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
for (int i = 1; i < 41; ++i) {
|
|
|
|
if (_animObjects[i].enabled) {
|
|
|
|
_animObjects[i].needRefresh = 1;
|
2008-05-02 14:46:30 +00:00
|
|
|
_animObjects[i].specialRefresh = 1;
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
restorePage3();
|
|
|
|
drawAnimObjects();
|
|
|
|
_screen->hideMouse();
|
|
|
|
initSceneScreen(unk1);
|
|
|
|
_screen->showMouse();
|
|
|
|
refreshAnimObjects(0);
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::initSceneScreen(int unk1) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::initSceneScreen(%d)", unk1);
|
2008-03-17 12:43:09 +00:00
|
|
|
if (_unkSceneScreenFlag1) {
|
2008-03-18 17:00:26 +00:00
|
|
|
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
|
2007-07-29 16:33:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_noScriptEnter) {
|
|
|
|
memset(_screen->getPalette(0), 0, 384);
|
|
|
|
_screen->setScreenPalette(_screen->getPalette(0));
|
|
|
|
}
|
|
|
|
|
2008-03-18 17:00:26 +00:00
|
|
|
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
|
2007-07-29 16:33:11 +00:00
|
|
|
|
2008-03-17 12:43:09 +00:00
|
|
|
if (_noScriptEnter) {
|
|
|
|
_screen->setScreenPalette(_screen->getPalette(1));
|
2007-07-29 16:33:11 +00:00
|
|
|
memcpy(_screen->getPalette(0), _screen->getPalette(1), 384);
|
2008-03-17 01:34:24 +00:00
|
|
|
}
|
2007-07-29 16:33:11 +00:00
|
|
|
|
|
|
|
updateCharPal(0);
|
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc->start(&_sceneScriptState, 3);
|
2007-07-29 16:33:11 +00:00
|
|
|
_sceneScriptState.regs[5] = unk1;
|
2008-04-29 15:12:09 +00:00
|
|
|
while (_emc->isValid(&_sceneScriptState))
|
|
|
|
_emc->run(&_sceneScriptState);
|
2007-07-29 16:33:11 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::freeSceneShapePtrs() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::freeSceneShapePtrs()");
|
2007-07-29 16:33:11 +00:00
|
|
|
for (int i = 0; i < ARRAYSIZE(_sceneShapeTable); ++i)
|
|
|
|
delete [] _sceneShapeTable[i];
|
|
|
|
memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable));
|
|
|
|
}
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
void KyraEngine_HoF::fadeScenePal(int srcIndex, int delayTime) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::fadeScenePal(%d, %d)", srcIndex, delayTime);
|
2008-03-18 19:27:21 +00:00
|
|
|
uint8 *dst = _screen->getPalette(0) + 336;
|
|
|
|
const uint8 *src = _scenePal + (srcIndex << 4)*3;
|
|
|
|
memcpy(dst, src, 48);
|
|
|
|
|
|
|
|
_screen->fadePalette(_screen->getPalette(0), delayTime, &_updateFunctor);
|
|
|
|
}
|
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
#pragma mark -
|
|
|
|
#pragma mark - Pathfinder
|
|
|
|
#pragma mark -
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
bool KyraEngine_HoF::lineIsPassable(int x, int y) {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_HoF::lineIsPassable(%d, %d)", x, y);
|
2007-07-29 16:33:11 +00:00
|
|
|
static int unkTable[] = { 1, 1, 1, 1, 1, 2, 4, 6, 8 };
|
|
|
|
|
|
|
|
if (_pathfinderFlag & 2) {
|
|
|
|
if (x >= 320)
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_pathfinderFlag & 4) {
|
|
|
|
if (y >= 144)
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (_pathfinderFlag & 8) {
|
|
|
|
if (x < 0)
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (y > 143)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
int unk1 = unkTable[getScale(x, y) >> 5];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
if (y < 0)
|
|
|
|
y = 0;
|
|
|
|
x -= unk1 >> 1;
|
|
|
|
if (x < 0)
|
|
|
|
x = 0;
|
|
|
|
int x2 = x + unk1;
|
|
|
|
if (x2 > 320)
|
|
|
|
x2 = 320;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
for (;x < x2; ++x)
|
|
|
|
if (!_screen->getShapeFlag1(x, y))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-02-17 02:08:30 +00:00
|
|
|
} // end of namespace Kyra
|
2008-05-02 14:46:30 +00:00
|
|
|
|