mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-22 01:57:16 +00:00
- started to add debugC calls to methods
- implemented some missing bits in itemDropDown svn-id: r31187
This commit is contained in:
parent
cbc4c789da
commit
f1b11fdff9
@ -31,6 +31,7 @@
|
||||
namespace Kyra {
|
||||
|
||||
void KyraEngine_v2::clearAnimObjects() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::clearAnimObjects()");
|
||||
memset(_animObjects, 0, sizeof(_animObjects));
|
||||
|
||||
_animObjects[0].index = 0;
|
||||
@ -57,11 +58,13 @@ void KyraEngine_v2::clearAnimObjects() {
|
||||
}
|
||||
|
||||
KyraEngine_v2::AnimObj *KyraEngine_v2::initAnimList(AnimObj *list, AnimObj *entry) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::initAnimList(%p, %p)", (const void*)list, (const void*)entry);
|
||||
entry->nextObject = list;
|
||||
return entry;
|
||||
}
|
||||
|
||||
KyraEngine_v2::AnimObj *KyraEngine_v2::addToAnimListSorted(AnimObj *list, AnimObj *add) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::addToAnimListSorted(%p, %p)", (const void*)list, (const void*)add);
|
||||
if (!list) {
|
||||
add->nextObject = 0;
|
||||
return add;
|
||||
@ -93,6 +96,7 @@ KyraEngine_v2::AnimObj *KyraEngine_v2::addToAnimListSorted(AnimObj *list, AnimOb
|
||||
}
|
||||
|
||||
KyraEngine_v2::AnimObj *KyraEngine_v2::deleteAnimListEntry(AnimObj *list, AnimObj *entry) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::addToAnimListSorted(%p, %p)", (const void*)list, (const void*)entry);
|
||||
if (!list)
|
||||
return 0;
|
||||
|
||||
@ -130,6 +134,7 @@ KyraEngine_v2::AnimObj *KyraEngine_v2::deleteAnimListEntry(AnimObj *list, AnimOb
|
||||
}
|
||||
|
||||
void KyraEngine_v2::drawAnimObjects() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::drawAnimObjects()");
|
||||
for (AnimObj *curObject = _animList; curObject; curObject = curObject->nextObject) {
|
||||
if (!curObject->enabled)
|
||||
continue;
|
||||
@ -154,6 +159,7 @@ void KyraEngine_v2::drawAnimObjects() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::refreshAnimObjects(int force) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::refreshAnimObjects(%d)", force);
|
||||
for (AnimObj *curObject = _animList; curObject; curObject = curObject->nextObject) {
|
||||
if (!curObject->enabled)
|
||||
continue;
|
||||
@ -187,6 +193,7 @@ void KyraEngine_v2::refreshAnimObjects(int force) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::refreshAnimObjectsIfNeed() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::refreshAnimObjectsIfNeed()");
|
||||
for (AnimObj *curEntry = _animList; curEntry; curEntry = curEntry->nextObject) {
|
||||
if (curEntry->enabled && curEntry->needRefresh) {
|
||||
restorePage3();
|
||||
@ -199,6 +206,7 @@ void KyraEngine_v2::refreshAnimObjectsIfNeed() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::updateItemAnimations() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::updateItemAnimations()");
|
||||
bool nextFrame = false;
|
||||
|
||||
if (_itemAnimData[0].itemIndex == -1 || _inventorySaved)
|
||||
@ -259,16 +267,19 @@ void KyraEngine_v2::updateItemAnimations() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::flagAnimObjsForRefresh() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::flagAnimObjsForRefresh()");
|
||||
for (AnimObj *curEntry = _animList; curEntry; curEntry = curEntry->nextObject)
|
||||
curEntry->needRefresh = 1;
|
||||
}
|
||||
|
||||
void KyraEngine_v2::flagAnimObjsUnk8() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::flagAnimObjsUnk8()");
|
||||
for (AnimObj *curEntry = _animList; curEntry; curEntry = curEntry->nextObject)
|
||||
curEntry->unk8 = 1;
|
||||
}
|
||||
|
||||
void KyraEngine_v2::updateCharFacing() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::updateCharFacing()");
|
||||
if (_mainCharacter.x1 > _mouseX)
|
||||
_mainCharacter.facing = 5;
|
||||
else
|
||||
@ -280,6 +291,7 @@ void KyraEngine_v2::updateCharFacing() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::updateCharacterAnim(int) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::updateCharacterAnim(-)");
|
||||
Character *c = &_mainCharacter;
|
||||
AnimObj *animState = _animObjects;
|
||||
|
||||
@ -316,6 +328,7 @@ void KyraEngine_v2::updateCharacterAnim(int) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::updateSceneAnim(int anim, int newFrame) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::updateSceneAnim(%d, %d)", anim, newFrame);
|
||||
AnimObj *animObject = &_animObjects[1+anim];
|
||||
if (!animObject->enabled)
|
||||
return;
|
||||
@ -360,6 +373,7 @@ void KyraEngine_v2::updateSceneAnim(int anim, int newFrame) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::drawSceneAnimObject(AnimObj *obj, int x, int y, int layer) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::drawSceneAnimObject(%p, %d, %d, layer)", (const void*)obj, x, y, layer);
|
||||
if (obj->type == 1) {
|
||||
if (obj->shapeIndex1 == 0xFFFF)
|
||||
return;
|
||||
@ -393,12 +407,14 @@ void KyraEngine_v2::drawSceneAnimObject(AnimObj *obj, int x, int y, int layer) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::drawCharacterAnimObject(AnimObj *obj, int x, int y, int layer) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::drawCharacterAnimObject(%p, %d, %d, layer)", (const void*)obj, x, y, layer);
|
||||
if (_drawNoShapeFlag || obj->shapeIndex1 == 0xFFFF)
|
||||
return;
|
||||
_screen->drawShape(2, getShapePtr(obj->shapeIndex1), x, y, 2, obj->flags | 4, layer, _charScaleX, _charScaleY);
|
||||
}
|
||||
|
||||
void KyraEngine_v2::addItemToAnimList(int item) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::addItemToAnimList(%d)", item);
|
||||
restorePage3();
|
||||
|
||||
AnimObj *animObj = &_animObjects[11+item];
|
||||
@ -430,6 +446,7 @@ void KyraEngine_v2::addItemToAnimList(int item) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::deleteItemAnimEntry(int item) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::deleteItemAnimEntry(%d)", item);
|
||||
AnimObj *animObj = &_animObjects[11+item];
|
||||
|
||||
restorePage3();
|
||||
@ -447,6 +464,7 @@ void KyraEngine_v2::deleteItemAnimEntry(int item) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::setCharacterAnimDim(int w, int h) {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::setCharacterAnimDim(%d, %d)", w, h);
|
||||
restorePage3();
|
||||
|
||||
_animObj0Width = _animObjects[0].width;
|
||||
@ -457,6 +475,7 @@ void KyraEngine_v2::setCharacterAnimDim(int w, int h) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::resetCharacterAnimDim() {
|
||||
debugC(9, kDebugLevelAnimator, "KyraEngine_v2::resetCharacterAnimDim()");
|
||||
restorePage3();
|
||||
|
||||
_animObjects[0].width = _animObj0Width;
|
||||
|
@ -28,6 +28,7 @@
|
||||
namespace Kyra {
|
||||
|
||||
int KyraEngine_v2::findFreeItem() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::findFreeItem()");
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
if (_itemList[i].id == 0xFFFF)
|
||||
return i;
|
||||
@ -36,6 +37,7 @@ int KyraEngine_v2::findFreeItem() {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::countAllItems() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::countAllItems()");
|
||||
int num = 0;
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
if (_itemList[i].id != 0xFFFF)
|
||||
@ -45,6 +47,7 @@ int KyraEngine_v2::countAllItems() {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::findItem(uint16 sceneId, uint16 id) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::findItem(%u, %u)", sceneId, id);
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
if (_itemList[i].id == id && _itemList[i].sceneId == sceneId)
|
||||
return i;
|
||||
@ -53,6 +56,7 @@ int KyraEngine_v2::findItem(uint16 sceneId, uint16 id) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::checkItemCollision(int x, int y) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::checkItemCollision(%d, %d)", x, y);
|
||||
int itemPos = -1, yPos = -1;
|
||||
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
@ -83,6 +87,7 @@ int KyraEngine_v2::checkItemCollision(int x, int y) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::resetItemList() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::resetItemList()");
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
_itemList[i].id = 0xFFFF;
|
||||
_itemList[i].sceneId = 0xFFFF;
|
||||
@ -93,6 +98,7 @@ void KyraEngine_v2::resetItemList() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::updateWaterFlasks() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::updateWaterFlasks()");
|
||||
for (int i = 22; i < 24; i++) {
|
||||
if (_itemInHand == i)
|
||||
setHandItem(i - 1);
|
||||
@ -115,6 +121,7 @@ void KyraEngine_v2::updateWaterFlasks() {
|
||||
}
|
||||
|
||||
bool KyraEngine_v2::dropItem(int unk1, uint16 item, int x, int y, int unk2) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::dropItem(%d, %u, %d, %d, %d)", unk1, item, x, y, unk2);
|
||||
if (_handItemSet <= -1)
|
||||
return false;
|
||||
|
||||
@ -129,6 +136,7 @@ bool KyraEngine_v2::dropItem(int unk1, uint16 item, int x, int y, int unk2) {
|
||||
}
|
||||
|
||||
bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, int unk1, int unk2) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::processItemDrop(%u, %u, %d, %d, %d, %d)", sceneId, item, x, y, unk1, unk2);
|
||||
int itemPos = checkItemCollision(x, y);
|
||||
|
||||
if (unk1)
|
||||
@ -154,10 +162,11 @@ bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i
|
||||
return false;
|
||||
|
||||
if (sceneId != _mainCharacter.sceneId) {
|
||||
//addToItemList(sceneId, item, freeItemSlot, x, y);
|
||||
//return true;
|
||||
//XXX
|
||||
return false;
|
||||
_itemList[freeItemSlot].x = x;
|
||||
_itemList[freeItemSlot].y = y;
|
||||
_itemList[freeItemSlot].unk7 = 1;
|
||||
_itemList[freeItemSlot].sceneId = sceneId;
|
||||
return true;
|
||||
}
|
||||
|
||||
int itemHeight = _itemHtDat[item];
|
||||
@ -235,6 +244,7 @@ bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i
|
||||
}
|
||||
|
||||
void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int itemSlot, uint16 item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::itemDropDown(%d, %d, %d, %d, %d, %u)", startX, startY, dstX, dstY, itemSlot, item);
|
||||
uint8 *itemShape = getShapePtr(item + 64);
|
||||
|
||||
if (startX == dstX && startY == dstY) {
|
||||
@ -242,7 +252,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
|
||||
updateCharFacing();
|
||||
snd_playSoundEffect(0x2d);
|
||||
removeHandItem();
|
||||
//XXX sub_277FA(getTableString(0xFF, _cCodeBuffer), 1, 0, 0x83, 0xFF);
|
||||
objectChat(getTableString(0xFF, _cCodeBuffer, 1), 0, 0x83, 0xFF);
|
||||
} else {
|
||||
_itemList[itemSlot].x = dstX;
|
||||
_itemList[itemSlot].y = dstY;
|
||||
@ -325,7 +335,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
|
||||
snd_playSoundEffect(0x2d);
|
||||
removeHandItem();
|
||||
_screen->showMouse();
|
||||
//XXX sub_277FA(getTableString(0xFF, _cCodeBuffer), 1, 0, 0x83, 0xFF);
|
||||
objectChat(getTableString(0xFF, _cCodeBuffer, 1), 0, 0x83, 0xFF);
|
||||
} else {
|
||||
_itemList[itemSlot].x = dstX;
|
||||
_itemList[itemSlot].y = dstY;
|
||||
@ -339,6 +349,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
|
||||
}
|
||||
|
||||
void KyraEngine_v2::exchangeMouseItem(int itemPos) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::exchangeMouseItem(%d)", itemPos);
|
||||
_screen->hideMouse();
|
||||
|
||||
deleteItemAnimEntry(itemPos);
|
||||
@ -362,6 +373,7 @@ void KyraEngine_v2::exchangeMouseItem(int itemPos) {
|
||||
}
|
||||
|
||||
bool KyraEngine_v2::pickUpItem(int x, int y) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::pickUpItem(%d, %d)", x, y);
|
||||
int itemPos = checkItemCollision(x, y);
|
||||
|
||||
if (itemPos <= -1)
|
||||
@ -392,6 +404,7 @@ bool KyraEngine_v2::pickUpItem(int x, int y) {
|
||||
}
|
||||
|
||||
bool KyraEngine_v2::isDropable(int x, int y) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::isDropable(%d, %d)", x, y);
|
||||
if (x < 14 || x > 304 || y < 14 || y > 136)
|
||||
return false;
|
||||
|
||||
@ -407,6 +420,7 @@ bool KyraEngine_v2::isDropable(int x, int y) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::getItemCommandStringDrop(uint16 item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::getItemCommandStringDrop(%u)", item);
|
||||
assert(item < _itemStringMapSize);
|
||||
int stringId = _itemStringMap[item];
|
||||
|
||||
@ -419,6 +433,7 @@ int KyraEngine_v2::getItemCommandStringDrop(uint16 item) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::getItemCommandStringPickUp(uint16 item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::getItemCommandStringPickUp(%u)", item);
|
||||
assert(item < _itemStringMapSize);
|
||||
int stringId = _itemStringMap[item];
|
||||
|
||||
@ -431,6 +446,7 @@ int KyraEngine_v2::getItemCommandStringPickUp(uint16 item) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::getItemCommandStringInv(uint16 item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::getItemCommandStringInv(%u)", item);
|
||||
assert(item < _itemStringMapSize);
|
||||
int stringId = _itemStringMap[item];
|
||||
|
||||
@ -443,6 +459,7 @@ int KyraEngine_v2::getItemCommandStringInv(uint16 item) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::setMouseCursor(uint16 item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::setMouseCursor(%u)", item);
|
||||
int shape = 0;
|
||||
int hotX = 1;
|
||||
int hotY = 1;
|
||||
@ -457,6 +474,7 @@ void KyraEngine_v2::setMouseCursor(uint16 item) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::setHandItem(uint16 item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::setHandItem(%u)", item);
|
||||
_screen->hideMouse();
|
||||
|
||||
if (item == 0xFFFF) {
|
||||
@ -470,6 +488,7 @@ void KyraEngine_v2::setHandItem(uint16 item) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::removeHandItem() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::removeHandItem()");
|
||||
_screen->hideMouse();
|
||||
_screen->setMouseCursor(0, 0, _defaultShapeTable[0]);
|
||||
_itemInHand = -1;
|
||||
@ -478,6 +497,7 @@ void KyraEngine_v2::removeHandItem() {
|
||||
}
|
||||
|
||||
bool KyraEngine_v2::itemIsFlask(int item) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::itemIsFlask(%d)", item);
|
||||
for (int i = 0; _flaskTable[i] != -1; ++i) {
|
||||
if (_flaskTable[i] == item)
|
||||
return true;
|
||||
|
@ -33,6 +33,7 @@
|
||||
namespace Kyra {
|
||||
|
||||
void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::enterNewScene(%d, %d, %d, %d, %d)", newScene, facing, unk1, unk2, unk3);
|
||||
if (_newChapterFile != _currentTalkFile) {
|
||||
_currentTalkFile = _newChapterFile;
|
||||
if (_flags.isTalkie) {
|
||||
@ -136,6 +137,7 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
|
||||
}
|
||||
|
||||
void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::enterNewSceneUnk1(%d, %d, %d)", facing, unk1, unk2);
|
||||
int x = 0, y = 0;
|
||||
int x2 = 0, y2 = 0;
|
||||
bool needProc = true;
|
||||
@ -231,6 +233,7 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::enterNewSceneUnk2(%d)", unk1);
|
||||
_unk3 = -1;
|
||||
|
||||
if (_flags.isTalkie) {
|
||||
@ -259,6 +262,7 @@ void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::trySceneChange(%p, %d, %d)", (const void*)moveTable, unk1, updateChar);
|
||||
bool running = true;
|
||||
bool unkFlag = false;
|
||||
int8 updateType = -1;
|
||||
@ -325,6 +329,7 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::checkSceneChange() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::checkSceneChange()");
|
||||
SceneDesc &curScene = _sceneList[_mainCharacter.sceneId];
|
||||
int charX = _mainCharacter.x1, charY = _mainCharacter.y1;
|
||||
int facing = 0;
|
||||
@ -378,12 +383,14 @@ int KyraEngine_v2::checkSceneChange() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::unloadScene() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::unloadScene()");
|
||||
_scriptInterpreter->unloadScript(&_sceneScriptData);
|
||||
freeSceneShapePtrs();
|
||||
freeSceneAnims();
|
||||
}
|
||||
|
||||
void KyraEngine_v2::loadScenePal() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::loadScenePal()");
|
||||
uint16 sceneId = _mainCharacter.sceneId;
|
||||
memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
|
||||
|
||||
@ -397,6 +404,7 @@ void KyraEngine_v2::loadScenePal() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::loadSceneMsc() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::loadSceneMsc()");
|
||||
uint16 sceneId = _mainCharacter.sceneId;
|
||||
char filename[14];
|
||||
strcpy(filename, _sceneList[sceneId].filename);
|
||||
@ -405,6 +413,7 @@ void KyraEngine_v2::loadSceneMsc() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::startSceneScript(int unk1) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::startSceneScript(%d)", unk1);
|
||||
uint16 sceneId = _mainCharacter.sceneId;
|
||||
char filename[14];
|
||||
|
||||
@ -465,6 +474,7 @@ void KyraEngine_v2::startSceneScript(int unk1) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::runSceneScript2() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript2()");
|
||||
_scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData);
|
||||
_sceneScriptState.regs[4] = _itemInHand;
|
||||
_scriptInterpreter->startScript(&_sceneScriptState, 2);
|
||||
@ -474,6 +484,7 @@ void KyraEngine_v2::runSceneScript2() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::runSceneScript4(int unk1) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript4(%d)", unk1);
|
||||
_sceneScriptState.regs[4] = _itemInHand;
|
||||
_sceneScriptState.regs[5] = unk1;
|
||||
|
||||
@ -483,6 +494,7 @@ void KyraEngine_v2::runSceneScript4(int unk1) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::runSceneScript6() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript6()");
|
||||
_scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData);
|
||||
|
||||
_sceneScriptState.regs[0] = _mainCharacter.sceneId;
|
||||
@ -496,6 +508,7 @@ void KyraEngine_v2::runSceneScript6() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::runSceneScript7() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript7()");
|
||||
int oldPage = _screen->_curPage;
|
||||
_screen->_curPage = 2;
|
||||
|
||||
@ -507,6 +520,7 @@ void KyraEngine_v2::runSceneScript7() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::initSceneAnims(int unk1) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::initSceneAnims(%d)", unk1);
|
||||
for (int i = 0; i < ARRAYSIZE(_animObjects); ++i)
|
||||
_animObjects[i].enabled = 0;
|
||||
|
||||
@ -665,6 +679,7 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::initSceneScreen(int unk1) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::initSceneScreen(%d)", unk1);
|
||||
if (_unkSceneScreenFlag1) {
|
||||
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
|
||||
return;
|
||||
@ -691,6 +706,7 @@ void KyraEngine_v2::initSceneScreen(int unk1) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::updateSpecialSceneScripts() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::updateSpecialSceneScripts()");
|
||||
uint32 nextTime = _system->getMillis() + _tickLength;
|
||||
const int startScript = _lastProcessedSceneScript;
|
||||
|
||||
@ -718,15 +734,26 @@ void KyraEngine_v2::updateSpecialSceneScripts() {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::freeSceneShapePtrs() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::freeSceneShapePtrs()");
|
||||
for (int i = 0; i < ARRAYSIZE(_sceneShapeTable); ++i)
|
||||
delete [] _sceneShapeTable[i];
|
||||
memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable));
|
||||
}
|
||||
|
||||
void KyraEngine_v2::freeSceneAnims() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::freeSceneAnims()");
|
||||
Common::for_each(_sceneAnimMovie, _sceneAnimMovie+ARRAYSIZE(_sceneAnimMovie), Common::mem_fun(&WSAMovieV2::close));
|
||||
}
|
||||
|
||||
void KyraEngine_v2::fadeScenePal(int srcIndex, int delayTime) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::fadeScenePal(%d, %d)", srcIndex, delayTime);
|
||||
uint8 *dst = _screen->getPalette(0) + 336;
|
||||
const uint8 *src = _scenePal + (srcIndex << 4)*3;
|
||||
memcpy(dst, src, 48);
|
||||
|
||||
_screen->fadePalette(_screen->getPalette(0), delayTime, &_updateFunctor);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark - Pathfinder
|
||||
#pragma mark -
|
||||
@ -788,6 +815,7 @@ bool KyraEngine_v2::lineIsPassable(int x, int y) {
|
||||
}
|
||||
|
||||
bool KyraEngine_v2::directLinePassable(int x, int y, int toX, int toY) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::directLinePassable(%d, %d, %d, %d)", x, y, toX, toY);
|
||||
while (x != toX && y != toY) {
|
||||
int facing = getFacingFromPointToPoint(x, y, toX, toY);
|
||||
x += _addXPosTable[facing];
|
||||
@ -799,6 +827,7 @@ bool KyraEngine_v2::directLinePassable(int x, int y, int toX, int toY) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::pathfinderInitPositionTable(int *moveTable) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::pathfinderInitPositionTable(%p)", (const void*)moveTable);
|
||||
bool breakLoop = false;
|
||||
int *moveTableCur = moveTable;
|
||||
int oldEntry = *moveTableCur, curEntry = *moveTableCur;
|
||||
@ -849,6 +878,7 @@ int KyraEngine_v2::pathfinderInitPositionTable(int *moveTable) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::pathfinderAddToPositionTable(int index, int v1, int v2) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::pathfinderAddToPositionTable(%d, %d, %d)", index, v1, v2);
|
||||
_pathfinderPositionTable[index<<1] = v1;
|
||||
_pathfinderPositionTable[(index<<1)+1] = v2;
|
||||
++index;
|
||||
@ -858,6 +888,7 @@ int KyraEngine_v2::pathfinderAddToPositionTable(int index, int v1, int v2) {
|
||||
}
|
||||
|
||||
int KyraEngine_v2::pathfinderInitPositionIndexTable(int tableLen, int x, int y) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::pathfinderInitPositionIndexTable(%d, %d, %d)", tableLen, x, y);
|
||||
int x1 = 0, y1 = 0;
|
||||
int x2 = 0, y2 = 0;
|
||||
int lastEntry = 0;
|
||||
@ -886,6 +917,7 @@ int KyraEngine_v2::pathfinderInitPositionIndexTable(int tableLen, int x, int y)
|
||||
}
|
||||
|
||||
int KyraEngine_v2::pathfinderAddToPositionIndexTable(int index, int v) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::pathfinderAddToPositionIndexTable(%d, %d)", index, v);
|
||||
_pathfinderPositionIndexTable[index] = v;
|
||||
++index;
|
||||
if (index >= 199)
|
||||
@ -894,6 +926,7 @@ int KyraEngine_v2::pathfinderAddToPositionIndexTable(int index, int v) {
|
||||
}
|
||||
|
||||
void KyraEngine_v2::pathfinderFinializePath(int *moveTable, int tableLen, int x, int y, int moveTableSize) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_v2::pathfinderFinializePath(%p, %d, %d, %d, %d)", moveTable, tableLen, x, y, moveTableSize);
|
||||
int x1 = 0, y1 = 0;
|
||||
int x2 = 0, y2 = 0;
|
||||
int index1 = 0, index2 = 0;
|
||||
@ -912,13 +945,4 @@ void KyraEngine_v2::pathfinderFinializePath(int *moveTable, int tableLen, int x,
|
||||
}
|
||||
}
|
||||
|
||||
void KyraEngine_v2::fadeScenePal(int srcIndex, int delayTime) {
|
||||
uint8 *dst = _screen->getPalette(0) + 336;
|
||||
const uint8 *src = _scenePal + (srcIndex << 4)*3;
|
||||
memcpy(dst, src, 48);
|
||||
|
||||
_screen->fadePalette(_screen->getPalette(0), delayTime, &_updateFunctor);
|
||||
}
|
||||
|
||||
} // end of namespace Kyra
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user