aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJordi Vilalta Prat2008-01-27 19:47:41 +0000
committerJordi Vilalta Prat2008-01-27 19:47:41 +0000
commit66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985 (patch)
treee27aadabecd8dd910884280e6559ff9c94c3d73c /engines/kyra
parent278857698dc7b1623096fe1ad12511dc4c886c7e (diff)
downloadscummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.gz
scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.bz2
scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.zip
Removed trailing spaces.
svn-id: r30664
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/animator_v1.h4
-rw-r--r--engines/kyra/animator_v2.cpp30
-rw-r--r--engines/kyra/debugger.cpp2
-rw-r--r--engines/kyra/gui_v1.cpp86
-rw-r--r--engines/kyra/gui_v2.cpp40
-rw-r--r--engines/kyra/items_v1.cpp150
-rw-r--r--engines/kyra/items_v2.cpp22
-rw-r--r--engines/kyra/kyra.cpp2
-rw-r--r--engines/kyra/kyra.h38
-rw-r--r--engines/kyra/kyra_v1.cpp108
-rw-r--r--engines/kyra/kyra_v1.h88
-rw-r--r--engines/kyra/kyra_v2.cpp12
-rw-r--r--engines/kyra/kyra_v2.h2
-rw-r--r--engines/kyra/kyra_v3.cpp60
-rw-r--r--engines/kyra/kyra_v3.h6
-rw-r--r--engines/kyra/module.mk2
-rw-r--r--engines/kyra/resource.cpp6
-rw-r--r--engines/kyra/scene.cpp48
-rw-r--r--engines/kyra/scene_v1.cpp200
-rw-r--r--engines/kyra/scene_v2.cpp232
-rw-r--r--engines/kyra/screen.cpp4
-rw-r--r--engines/kyra/screen.h22
-rw-r--r--engines/kyra/screen_v1.h8
-rw-r--r--engines/kyra/screen_v2.cpp12
-rw-r--r--engines/kyra/screen_v2.h26
-rw-r--r--engines/kyra/script.h16
-rw-r--r--engines/kyra/script_v2.cpp48
-rw-r--r--engines/kyra/seqplayer.h2
-rw-r--r--engines/kyra/sequences_v1.cpp216
-rw-r--r--engines/kyra/sequences_v2.cpp12
-rw-r--r--engines/kyra/sound.cpp4
-rw-r--r--engines/kyra/sound_digital.cpp48
-rw-r--r--engines/kyra/sound_v1.cpp2
-rw-r--r--engines/kyra/sprites.h4
-rw-r--r--engines/kyra/staticres.cpp8
-rw-r--r--engines/kyra/text.h2
-rw-r--r--engines/kyra/text_v1.cpp24
-rw-r--r--engines/kyra/text_v2.cpp60
-rw-r--r--engines/kyra/timer.cpp24
-rw-r--r--engines/kyra/timer.h20
-rw-r--r--engines/kyra/timer_v1.cpp12
-rw-r--r--engines/kyra/timer_v2.cpp6
-rw-r--r--engines/kyra/util.h8
-rw-r--r--engines/kyra/wsamovie.h14
44 files changed, 870 insertions, 870 deletions
diff --git a/engines/kyra/animator_v1.h b/engines/kyra/animator_v1.h
index 04965875c0..7bfb872651 100644
--- a/engines/kyra/animator_v1.h
+++ b/engines/kyra/animator_v1.h
@@ -84,7 +84,7 @@ public:
void clearQueue() { _objectQueue = 0; }
void addObjectToQueue(AnimObject *object);
void refreshObject(AnimObject *object);
-
+
void makeBrandonFaceMouse();
void setBrandonAnimSeqSize(int width, int height);
void resetBrandonAnimSeqSize();
@@ -124,7 +124,7 @@ protected:
int _brandonAnimSeqSizeWidth;
int _brandonAnimSeqSizeHeight;
-
+
};
} // end of namespace Kyra
diff --git a/engines/kyra/animator_v2.cpp b/engines/kyra/animator_v2.cpp
index 1662534ab9..0d4bdf3328 100644
--- a/engines/kyra/animator_v2.cpp
+++ b/engines/kyra/animator_v2.cpp
@@ -30,7 +30,7 @@ namespace Kyra {
void KyraEngine_v2::clearAnimObjects() {
memset(_animObjects, 0, sizeof(_animObjects));
-
+
_animObjects[0].index = 0;
_animObjects[0].type = 0;
_animObjects[0].enabled = 1;
@@ -39,12 +39,12 @@ void KyraEngine_v2::clearAnimObjects() {
_animObjects[0].height = 49;
_animObjects[0].width2 = 4;
_animObjects[0].height2 = 10;
-
+
for (int i = 1; i < 11; ++i) {
_animObjects[i].index = i;
_animObjects[i].type = 2;
}
-
+
for (int i = 11; i <= 40; ++i) {
_animObjects[i].index = i;
_animObjects[i].type = 1;
@@ -74,7 +74,7 @@ KyraEngine_v2::AnimObj *KyraEngine_v2::addToAnimListSorted(AnimObj *list, AnimOb
prev = cur;
cur = temp;
}
-
+
if (add->yPos1 <= cur->yPos1) {
prev->nextObject = add;
add->nextObject = cur;
@@ -126,11 +126,11 @@ void KyraEngine_v2::drawAnimObjects() {
for (AnimObj *curObject = _animList; curObject; curObject = curObject->nextObject) {
if (!curObject->enabled)
continue;
-
+
int x = curObject->xPos2 - (_screen->getScreenDim(2)->sx << 3);
int y = curObject->yPos2 - _screen->getScreenDim(2)->sy;
int layer = 7;
-
+
if (curObject->flags & 0x800) {
if (curObject->animFlags)
layer = 0;
@@ -170,11 +170,11 @@ void KyraEngine_v2::refreshAnimObjects(int force) {
width -= width + x - 322;
if (height + y > 143)
height -= height + y - 144;
-
+
_screen->hideMouse();
_screen->copyRegion(x, y, x, y, width, height, 2, 0, Screen::CR_CLIPPED);
_screen->showMouse();
-
+
curObject->needRefresh = false;
}
}
@@ -247,37 +247,37 @@ void KyraEngine_v2::updateSceneAnim(int anim, int newFrame) {
AnimObj *animObject = &_animObjects[1+anim];
if (!animObject->enabled)
return;
-
+
animObject->needRefresh = 1;
animObject->unk8 = 1;
animObject->flags = 0;
-
+
if (_sceneAnims[anim].flags & 2)
animObject->flags |= 0x800;
else
animObject->flags &= ~0x800;
-
+
if (_sceneAnims[anim].flags & 4)
animObject->flags |= 1;
else
animObject->flags &= ~1;
-
+
if (_sceneAnims[anim].flags & 0x20) {
animObject->shapePtr = _sceneShapeTable[newFrame];
animObject->shapeIndex2 = 0xFFFF;
animObject->shapeIndex3 = 0xFFFF;
- animObject->animNum = 0xFFFF;
+ animObject->animNum = 0xFFFF;
} else {
animObject->shapePtr = 0;
animObject->shapeIndex3 = newFrame;
animObject->animNum = anim;
}
-
+
animObject->xPos1 = _sceneAnims[anim].x;
animObject->yPos1 = _sceneAnims[anim].y;
animObject->xPos2 = _sceneAnims[anim].x2;
animObject->yPos2 = _sceneAnims[anim].y2;
-
+
if (_sceneAnims[anim].flags & 2) {
_animList = deleteAnimListEntry(_animList, animObject);
if (!_animList)
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 463e66f253..d44fcb3b81 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -241,7 +241,7 @@ bool Debugger_v2::cmd_enterScene(int argc, const char **argv) {
if (argc > 1) {
int scene = atoi(argv[1]);
- // game will crash if entering a non-existent scene
+ // game will crash if entering a non-existent scene
if (scene >= _vm->_sceneListSize) {
DebugPrintf("scene number must be any value between (including) 0 and %d\n", _vm->_sceneListSize-1);
return true;
diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp
index 6c9b822955..e7161e8fcd 100644
--- a/engines/kyra/gui_v1.cpp
+++ b/engines/kyra/gui_v1.cpp
@@ -122,7 +122,7 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
}
if (queryGameFlag(0xF1)) {
assert(_waitForAmulet);
- characterSays(2001, _waitForAmulet[0], 0, -2);
+ characterSays(2001, _waitForAmulet[0], 0, -2);
return 1;
}
if (!queryGameFlag(0x55+jewel)) {
@@ -135,18 +135,18 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
drawJewelPress(jewel, 0);
drawJewelsFadeOutStart();
drawJewelsFadeOutEnd(jewel);
-
+
_scriptInterpreter->initScript(_scriptClick, _scriptClickData);
_scriptClick->regs[3] = 0;
_scriptClick->regs[6] = jewel;
_scriptInterpreter->startScript(_scriptClick, 4);
-
+
while (_scriptInterpreter->validScript(_scriptClick))
_scriptInterpreter->runScript(_scriptClick);
-
+
if (_scriptClick->regs[3])
return 1;
-
+
_unkAmuletVar = 1;
switch (jewel-1) {
case 0:
@@ -158,7 +158,7 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
characterSays(2003, _healingTip[0], 0, -2);
}
break;
-
+
case 1:
seq_makeBrandonInv();
break;
@@ -192,7 +192,7 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
assert(_magicJewelString);
characterSays(2007, _magicJewelString[0], 0, -2);
break;
-
+
default:
break;
}
@@ -213,7 +213,7 @@ void KyraEngine_v1::processButtonList(Button *list) {
list = list->nextButton;
continue;
}
-
+
int x = list->x;
int y = list->y;
assert(list->dimTableIndex < _screen->_screenDimTableCount);
@@ -221,12 +221,12 @@ void KyraEngine_v1::processButtonList(Button *list) {
x += _screen->_screenDimTable[list->dimTableIndex].w << 3;
}
x += _screen->_screenDimTable[list->dimTableIndex].sx << 3;
-
+
if (y < 0) {
y += _screen->_screenDimTable[list->dimTableIndex].h;
}
y += _screen->_screenDimTable[list->dimTableIndex].sy;
-
+
Common::Point mouse = getMousePos();
if (mouse.x >= x && mouse.y >= y && x + list->width >= mouse.x && y + list->height >= mouse.y) {
int processMouseClick = 0;
@@ -248,7 +248,7 @@ void KyraEngine_v1::processButtonList(Button *list) {
} else if (_mousePressFlag) {
processMouseClick = 1;
}
-
+
if (processMouseClick) {
if (list->buttonCallback) {
if ((this->*(list->buttonCallback))(list)) {
@@ -269,7 +269,7 @@ void KyraEngine_v1::processButtonList(Button *list) {
list = list->nextButton;
continue;
}
-
+
list = list->nextButton;
}
}
@@ -277,11 +277,11 @@ void KyraEngine_v1::processButtonList(Button *list) {
void KyraEngine_v1::processButton(Button *button) {
if (!button)
return;
-
+
int processType = 0;
uint8 *shape = 0;
Button::ButtonCallback callback = 0;
-
+
int flags = (button->flags2 & 5);
if (flags == 1) {
processType = button->process2;
@@ -302,16 +302,16 @@ void KyraEngine_v1::processButton(Button *button) {
else if (processType == 4)
callback = button->process0PtrCallback;
}
-
+
int x = button->x;
int y = button->y;
assert(button->dimTableIndex < _screen->_screenDimTableCount);
if (x < 0)
x += _screen->_screenDimTable[button->dimTableIndex].w << 3;
-
+
if (y < 0)
y += _screen->_screenDimTable[button->dimTableIndex].h;
-
+
if (processType == 1 && shape)
_screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10);
else if (processType == 4 && callback)
@@ -370,7 +370,7 @@ int KyraEngine_v1::drawBoxCallback(Button *button) {
int KyraEngine_v1::drawShadedBoxCallback(Button *button) {
if (!_displayMenu)
return 0;
-
+
_screen->hideMouse();
_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xf9, 0xfa);
_screen->showMouse();
@@ -386,7 +386,7 @@ void KyraEngine_v1::setGUILabels() {
int walkspeedGarbageOffset = 36;
int menuLabelGarbageOffset = 0;
-
+
if (_flags.isTalkie) {
if (_flags.lang == Common::EN_ANY)
offset = 52;
@@ -409,7 +409,7 @@ void KyraEngine_v1::setGUILabels() {
}
assert(offset + 27 < _guiStringsSize);
-
+
// The Legend of Kyrandia
_menu[0].menuName = _guiStrings[0];
// Load a Game
@@ -425,7 +425,7 @@ void KyraEngine_v1::setGUILabels() {
// Cancel
_menu[2].item[5].itemString = _guiStrings[10];
-
+
// Enter a description of your saved game:
_menu[3].menuName = _guiStrings[11];
// Save
@@ -439,14 +439,14 @@ void KyraEngine_v1::setGUILabels() {
_menu[4].item[0].itemString = _guiStrings[1];
// Quit playing
_menu[4].item[1].itemString = _guiStrings[4];
-
+
// Game Controls
_menu[5].menuName = _guiStrings[6];
// Yes
_menu[1].item[0].itemString = _guiStrings[22 + offset];
// No
_menu[1].item[1].itemString = _guiStrings[23 + offset];
-
+
// Music is
_menu[5].item[0].labelString = _guiStrings[26 + offsetOptions];
// Sounds are
@@ -457,7 +457,7 @@ void KyraEngine_v1::setGUILabels() {
_menu[5].item[4].labelString = _guiStrings[25 + offsetOptions];
// Main Menu
_menu[5].item[5].itemString = &_guiStrings[19 + offsetMainMenu][menuLabelGarbageOffset];
-
+
if (_flags.isTalkie)
// Text & Voice
_voiceTextString = _guiStrings[28 + offset];
@@ -473,7 +473,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) {
assert(_guiStrings);
assert(_configStrings);
-
+
/*
for (int i = 0; i < _guiStringsSize; i++)
debug("GUI string %i: %s", i, _guiStrings[i]);
@@ -481,7 +481,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) {
for (int i = 0; i < _configStringsSize; i++)
debug("Config string %i: %s", i, _configStrings[i]);
*/
-
+
setGUILabels();
if (_currentCharacter->sceneId == 210 && _deathHandler == 0xFF) {
snd_playSoundEffect(0x36);
@@ -505,7 +505,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) {
_menuRestoreScreen = true;
_keyPressed.reset();
_mousePressFlag = false;
-
+
_toplevelMenu = 0;
if (_menuDirectlyToLoad) {
gui_loadGameMenu(0);
@@ -558,7 +558,7 @@ void KyraEngine_v1::initMenu(Menu &menu) {
_text->printText(menu.menuName, textX - 1, textY + 1, 12, 248, 0);
_text->printText(menu.menuName, textX, textY, menu.textColor, 0, 0);
- int x1, y1, x2, y2;
+ int x1, y1, x2, y2;
for (int i = 0; i < menu.nrOfItems; i++) {
if (!menu.item[i].enabled)
continue;
@@ -618,7 +618,7 @@ void KyraEngine_v1::initMenu(Menu &menu) {
_scrollUpButton.nextButton = 0;
_menuButtonList = initButton(_menuButtonList, &_scrollUpButton);
processMenuButton(&_scrollUpButton);
-
+
_scrollDownButton.x = menu.scrollDownBtnX + menu.x;
_scrollDownButton.y = menu.scrollDownBtnY + menu.y;
_scrollDownButton.buttonCallback = &KyraEngine_v1::gui_scrollDown;
@@ -638,12 +638,12 @@ void KyraEngine_v1::calcCoords(Menu &menu) {
int widthBackup = _screen->_charWidth;
_screen->_charWidth = -2;
-
+
menu.x = (320 - menu.width)/2;
- int menu_x2 = menu.width + menu.x - 1;
+ int menu_x2 = menu.width + menu.x - 1;
int maxOffset = 0;
- int x1, x2, y1, y2;
+ int x1, x2, y1, y2;
for (int i = 0; i < menu.nrOfItems; i++) {
if (menu.item[i].x == -1)
@@ -665,18 +665,18 @@ void KyraEngine_v1::calcCoords(Menu &menu) {
maxOffset = offset;
}
}
-
+
if (menu.item[i].itemString) {
int textWidth = _screen->getTextWidth(menu.item[i].itemString) + 15;
if (menu.item[i].width < textWidth) {
menu.item[i].width = textWidth;
-
+
if ( menu.x + menu.item[i].x + menu.item[i].width > menu_x2)
menu.item[i].x -= (menu.x + menu.item[i].x + menu.item[i].width) - menu_x2 + 10;
}
- }
-
+ }
+
}
if (maxOffset > 0) {
@@ -687,7 +687,7 @@ void KyraEngine_v1::calcCoords(Menu &menu) {
}
menu.width += maxOffset;
}
-
+
if (menu.menuName != 0) {
int menuNameLength = _screen->getTextWidth(menu.menuName);
if (menuNameLength > menu.width)
@@ -698,10 +698,10 @@ void KyraEngine_v1::calcCoords(Menu &menu) {
menu.width = 310;
menu.x = (320 - menu.width)/2;
-
+
if (menu.y == -1)
menu.y = (200 - menu.height)/2;
-
+
_screen->_charWidth = widthBackup;
}
@@ -1030,7 +1030,7 @@ bool KyraEngine_v1::gui_quitConfirm(const char *str) {
_menu[1].menuName = str;
calcCoords(_menu[1]);
initMenu(_menu[1]);
-
+
_displaySubMenu = true;
_cancelSubMenu = true;
@@ -1162,7 +1162,7 @@ void KyraEngine_v1::gui_setupControls(Menu &menu) {
if (_flags.isTalkie) {
textControl = 4;
clickableOffset = 11;
-
+
if (_configVoice == 0)
_menu[5].item[4].enabled = 1;
else
@@ -1297,7 +1297,7 @@ void KyraEngine_v1::gui_processHighlights(Menu &menu) {
if (mouse.x > x1 && mouse.x < x2 &&
mouse.y > y1 && mouse.y < y2) {
-
+
if (menu.highlightedItem != i) {
if (menu.item[menu.highlightedItem].enabled )
gui_redrawText(menu);
@@ -1410,4 +1410,4 @@ void KyraEngine_v1::drawAmulet() {
}
} // end of namespace Kyra
-
+
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index 2e795dfb08..4c5fb8d840 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -53,16 +53,16 @@ bool KyraEngine_v2::gui_mainMenuGetInput() {
int KyraEngine_v2::gui_handleMainMenu() {
debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_handleMainMenu()");
int command = -1;
-
+
uint8 colorMap[16];
memset(colorMap, 0, sizeof(colorMap));
_screen->setTextColorMap(colorMap);
-
+
const char * const *strings;
-
+
Screen::FontId oldFont = _screen->setFont(Screen::FID_8_FNT);
int charWidthBackUp = _screen->_charWidth;
-
+
_screen->_charWidth = -2;
if (_flags.gameID == GI_KYRA2) {
@@ -91,9 +91,9 @@ int KyraEngine_v2::gui_handleMainMenu() {
gui_drawMainBox(x, y, width, height, 1);
gui_drawMainBox(x + 1, y + 1, width - 2, height - 2, 0);
-
+
int selected = 0;
-
+
gui_drawMainMenu(strings, selected);
_screen->showMouse();
@@ -102,7 +102,7 @@ int KyraEngine_v2::gui_handleMainMenu() {
int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3;
Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4);
-
+
while (!_quitFlag) {
gui_updateMainMenuAnimation();
bool mousePressed = gui_mainMenuGetInput();
@@ -133,14 +133,14 @@ int KyraEngine_v2::gui_handleMainMenu() {
}
_system->delayMillis(10);
}
-
+
if (_quitFlag)
command = -1;
-
+
_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0);
_screen->_charWidth = charWidthBackUp;
_screen->setFont(oldFont);
-
+
return command;
}
@@ -157,7 +157,7 @@ void KyraEngine_v2::gui_drawMainMenu(const char *const *strings, int select) {
int top = _screen->_curDim->sy;
top += menuTable[1];
-
+
for (int i = 0; i < menuTable[3]; ++i) {
int curY = top + i * _screen->getFontHeight();
int color = (i == select) ? menuTable[6] : menuTable[5];
@@ -175,17 +175,17 @@ void KyraEngine_v2::gui_drawMainBox(int x, int y, int w, int h, int fill) {
colorTable = kyra3ColorTable;
else
colorTable = kyra2ColorTable;
-
+
--w; --h;
if (fill)
_screen->fillRect(x, y, x+w, y+h, colorTable[0]);
-
+
_screen->drawClippedLine(x, y+h, x+w, y+h, colorTable[1]);
_screen->drawClippedLine(x+w, y, x+w, y+h, colorTable[1]);
_screen->drawClippedLine(x, y, x+w, y, colorTable[2]);
_screen->drawClippedLine(x, y, x, y+h, colorTable[2]);
-
+
_screen->setPagePixel(_screen->_curPage, x, y+h, colorTable[3]);
_screen->setPagePixel(_screen->_curPage, x+w, y, colorTable[3]);
}
@@ -194,29 +194,29 @@ void KyraEngine_v2::gui_printString(const char *format, int x, int y, int col1,
debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_printString('%s', %d, %d, %d, %d, %d, ...)", format, x, y, col1, col2, flags);
if (!format)
return;
-
+
char string[512];
va_list vaList;
va_start(vaList, flags);
vsprintf(string, format, vaList);
va_end(vaList);
-
+
if (flags & 1)
x -= _screen->getTextWidth(string) >> 1;
-
+
if (flags & 2)
x -= _screen->getTextWidth(string);
-
+
if (flags & 4) {
_screen->printText(string, x - 1, y, 240, col2);
_screen->printText(string, x, y + 1, 240, col2);
}
-
+
if (flags & 8) {
_screen->printText(string, x - 1, y, 227, col2);
_screen->printText(string, x, y + 1, 227, col2);
}
-
+
_screen->printText(string, x, y, col1, col2);
}
diff --git a/engines/kyra/items_v1.cpp b/engines/kyra/items_v1.cpp
index 026736077b..ae3ba2821a 100644
--- a/engines/kyra/items_v1.cpp
+++ b/engines/kyra/items_v1.cpp
@@ -90,10 +90,10 @@ byte KyraEngine_v1::findItemAtPos(int x, int y) {
const uint8 *itemsTable = _roomTable[_currentCharacter->sceneId].itemsTable;
const uint16 *xposOffset = _roomTable[_currentCharacter->sceneId].itemsXPos;
const uint8 *yposOffset = _roomTable[_currentCharacter->sceneId].itemsYPos;
-
+
int highestYPos = -1;
byte returnValue = 0xFF;
-
+
for (int i = 0; i < 12; ++i) {
if (*itemsTable != 0xFF) {
int xpos = *xposOffset - 11;
@@ -103,7 +103,7 @@ byte KyraEngine_v1::findItemAtPos(int x, int y) {
int itemHeight = _itemTable[*itemsTable].height;
int ypos = *yposOffset + 3;
int ypos2 = ypos - itemHeight - 3;
-
+
if (y > ypos2 && ypos > y) {
if (highestYPos <= ypos) {
returnValue = i;
@@ -116,7 +116,7 @@ byte KyraEngine_v1::findItemAtPos(int x, int y) {
++yposOffset;
++itemsTable;
}
-
+
return returnValue;
}
@@ -128,16 +128,16 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) {
static const uint16 itemMapSceneMaxTable[] = {
0x0010, 0x0024, 0x00C6, 0x006C, 0x00F5, 0x0000
};
-
+
int minValue = itemMapSceneMinTable[index];
int maxValue = itemMapSceneMaxTable[index];
-
+
while (true) {
int room = _rnd.getRandomNumberRng(minValue, maxValue);
assert(room < _roomTableSize);
int nameIndex = _roomTable[room].nameIndex;
bool placeItem = false;
-
+
switch (nameIndex) {
case 0: case 1: case 2: case 3:
case 4: case 5: case 6: case 11:
@@ -149,7 +149,7 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) {
case 85: case 104: case 105: case 106:
placeItem = true;
break;
-
+
case 51:
if (room != 46)
placeItem = true;
@@ -158,7 +158,7 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) {
default:
break;
}
-
+
if (placeItem) {
Room *roomPtr = &_roomTable[room];
if (roomPtr->northExit == 0xFFFF && roomPtr->eastExit == 0xFFFF && roomPtr->southExit == 0xFFFF && roomPtr->westExit == 0xFFFF)
@@ -166,7 +166,7 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) {
else if (_currentCharacter->sceneId == room)
placeItem = false;
}
-
+
if (placeItem) {
if (!processItemDrop(room, item, -1, -1, 2, 0))
continue;
@@ -209,7 +209,7 @@ void KyraEngine_v1::wipeDownMouseItem(int xpos, int ypos) {
backUpItemRect1(xpos, ypos);
int y = ypos;
int height = 16;
-
+
while (height >= 0) {
restoreItemRect1(xpos, ypos);
_screen->setNewShapeHeight(_shapes[216+_itemInHand], height);
@@ -219,7 +219,7 @@ void KyraEngine_v1::wipeDownMouseItem(int xpos, int ypos) {
y += 2;
height -= 2;
delayUntil(nextTime);
- }
+ }
restoreItemRect1(xpos, ypos);
_screen->resetShapeHeight(_shapes[216+_itemInHand]);
destroyMouseItem();
@@ -235,10 +235,10 @@ void KyraEngine_v1::setupSceneItems() {
uint8 item = currentRoom->itemsTable[i];
if (item == 0xFF || !currentRoom->needInit[i])
continue;
-
+
int xpos = 0;
int ypos = 0;
-
+
if (currentRoom->itemsXPos[i] == 0xFFFF) {
xpos = currentRoom->itemsXPos[i] = _rnd.getRandomNumberRng(24, 296);
ypos = currentRoom->itemsYPos[i] = _rnd.getRandomNumberRng(_northExitHeight & 0xFF, 130);
@@ -246,9 +246,9 @@ void KyraEngine_v1::setupSceneItems() {
xpos = currentRoom->itemsXPos[i];
ypos = currentRoom->itemsYPos[i];
}
-
+
_lastProcessedItem = i;
-
+
int stop = 0;
while (!stop) {
stop = processItemDrop(sceneId, item, xpos, ypos, 3, 0);
@@ -268,14 +268,14 @@ int KyraEngine_v1::countItemsInScene(uint16 sceneId) {
debugC(9, kDebugLevelMain, "KyraEngine_v1::countItemsInScene(%d)", sceneId);
assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId];
-
+
int items = 0;
-
+
for (int i = 0; i < 12; ++i) {
if (currentRoom->itemsTable[i] != 0xFF)
++items;
}
-
+
return items;
}
@@ -285,15 +285,15 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int
uint8 itemIndex = findItemAtPos(x, y);
if (unk1)
itemIndex = 0xFF;
-
+
if (itemIndex != 0xFF) {
exchangeItemWithMouseItem(sceneId, itemIndex);
return 0;
}
-
+
assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId];
-
+
if (unk1 != 3) {
for (int i = 0; i < 12; ++i) {
if (currentRoom->itemsTable[i] == 0xFF) {
@@ -307,20 +307,20 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int
if (freeItem == -1)
return 0;
-
+
if (sceneId != _currentCharacter->sceneId) {
addItemToRoom(sceneId, item, freeItem, x, y);
return 1;
}
-
+
int itemHeight = _itemTable[item].height;
_lastProcessedItemHeight = itemHeight;
-
+
if (x == -1 && x == -1) {
x = _rnd.getRandomNumberRng(16, 304);
y = _rnd.getRandomNumberRng(_northExitHeight & 0xFF, 135);
}
-
+
int xpos = x;
int ypos = y;
int destY = -1;
@@ -330,25 +330,25 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int
while (running) {
if ((_northExitHeight & 0xFF) <= ypos) {
bool running2 = true;
-
+
if (_screen->getDrawLayer(xpos, ypos) > 1) {
if (((_northExitHeight >> 8) & 0xFF) != ypos)
running2 = false;
}
-
+
if (_screen->getDrawLayer2(xpos, ypos, itemHeight) > 1) {
if (((_northExitHeight >> 8) & 0xFF) != ypos)
running2 = false;
}
-
+
if (!isDropable(xpos, ypos)) {
if (((_northExitHeight >> 8) & 0xFF) != ypos)
running2 = false;
}
-
+
int xpos2 = xpos;
int xpos3 = xpos;
-
+
while (running2) {
if (isDropable(xpos2, ypos)) {
if (_screen->getDrawLayer2(xpos2, ypos, itemHeight) < 7) {
@@ -360,7 +360,7 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int
}
}
}
-
+
if (isDropable(xpos3, ypos)) {
if (_screen->getDrawLayer2(xpos3, ypos, itemHeight) < 7) {
if (findItemAtPos(xpos3, ypos) == 0xFF) {
@@ -371,18 +371,18 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int
}
}
}
-
+
if (!running2)
continue;
-
+
xpos2 -= 2;
if (xpos2 < 16)
xpos2 = 16;
-
+
xpos3 += 2;
if (xpos3 > 304)
xpos3 = 304;
-
+
if (xpos2 > 16)
continue;
if (xpos3 < 304)
@@ -390,45 +390,45 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int
running2 = false;
}
}
-
+
if (((_northExitHeight >> 8) & 0xFF) == ypos) {
running = 0;
destY -= _rnd.getRandomNumberRng(0, 3);
-
+
if ((_northExitHeight & 0xFF) < destY)
continue;
-
+
destY = (_northExitHeight & 0xFF) + 1;
continue;
- }
+ }
ypos += 2;
if (((_northExitHeight >> 8) & 0xFF) >= ypos)
continue;
ypos = (_northExitHeight >> 8) & 0xFF;
}
-
+
if (destX == -1 || destY == -1)
return 0;
-
+
if (unk1 == 3) {
currentRoom->itemsXPos[freeItem] = destX;
currentRoom->itemsYPos[freeItem] = destY;
return 1;
}
-
+
if (unk1 == 2)
itemSpecialFX(x, y, item);
-
+
if (unk1 == 0)
destroyMouseItem();
-
+
itemDropDown(x, y, destX, destY, freeItem, item);
-
+
if (unk1 == 0 && unk2 != 0) {
assert(_itemList && _droppedList);
updateSentenceCommand(_itemList[item], _droppedList[0], 179);
}
-
+
return 1;
}
@@ -438,13 +438,13 @@ void KyraEngine_v1::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
_animator->animRemoveGameItem(itemIndex);
assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId];
-
+
int item = currentRoom->itemsTable[itemIndex];
currentRoom->itemsTable[itemIndex] = _itemInHand;
_itemInHand = item;
_animator->animAddGameItem(itemIndex, sceneId);
snd_playSoundEffect(53);
-
+
setMouseItem(_itemInHand);
assert(_itemList && _takenList);
updateSentenceCommand(_itemList[_itemInHand], _takenList[1], 179);
@@ -468,16 +468,16 @@ int KyraEngine_v1::checkNoDropRects(int x, int y) {
_lastProcessedItemHeight = 16;
if (_noDropRects[0].x == -1)
return 0;
-
+
for (int i = 0; i < 11; ++i) {
if (_noDropRects[i].x == -1)
break;
-
+
int xpos = _noDropRects[i].x;
int ypos = _noDropRects[i].y;
int xpos2 = _noDropRects[i].x2;
int ypos2 = _noDropRects[i].y2;
-
+
if (xpos > x + 16)
continue;
if (xpos2 < x)
@@ -488,7 +488,7 @@ int KyraEngine_v1::checkNoDropRects(int x, int y) {
continue;
return 1;
}
-
+
return 0;
}
@@ -496,14 +496,14 @@ int KyraEngine_v1::isDropable(int x, int y) {
debugC(9, kDebugLevelMain, "KyraEngine_v1::isDropable(%d, %d)", x, y);
x -= 8;
y -= 1;
-
+
if (checkNoDropRects(x, y))
return 0;
-
+
for (int xpos = x; xpos < x + 16; ++xpos) {
if (_screen->getShapeFlag1(xpos, y) == 0)
return 0;
- }
+ }
return 1;
}
@@ -525,9 +525,9 @@ void KyraEngine_v1::itemDropDown(int x, int y, int destX, int destY, byte freeIt
int addY = 2;
int drawX = x - 8;
int drawY = 0;
-
+
backUpItemRect0(drawX, y - 16);
-
+
while (tempY < destY) {
restoreItemRect0(drawX, tempY - 16);
tempY += addY;
@@ -541,18 +541,18 @@ void KyraEngine_v1::itemDropDown(int x, int y, int destX, int destY, byte freeIt
_screen->updateScreen();
delayUntil(nextTime);
}
-
+
bool skip = false;
if (x == destX) {
if (destY - y <= 16)
skip = true;
}
-
+
if (!skip) {
snd_playSoundEffect(0x47);
if (addY < 6)
addY = 6;
-
+
int xDiff = (destX - x) << 4;
xDiff /= addY;
int startAddY = addY;
@@ -640,7 +640,7 @@ void KyraEngine_v1::itemSpecialFX2(int x, int y, int item) {
backUpItemRect0(x, y);
if (item >= 80 && item <= 89)
snd_playSoundEffect(55);
-
+
for (int i = 201; i <= 205; ++i) {
restoreItemRect0(x, y);
uint32 nextTime = _system->getMillis() + 3 * _tickLength;
@@ -648,7 +648,7 @@ void KyraEngine_v1::itemSpecialFX2(int x, int y, int item) {
_screen->updateScreen();
delayUntil(nextTime);
}
-
+
for (int i = 204; i >= 201; --i) {
restoreItemRect0(x, y);
uint32 nextTime = _system->getMillis() + 3 * _tickLength;
@@ -673,10 +673,10 @@ void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) {
x = _itemPosX[itemPos] - 4;
y = _itemPosY[itemPos] - 3;
}
-
+
if (_itemInHand == -1 && itemPos == -1)
return;
-
+
int tableIndex = 0, loopStart = 0, maxLoops = 0;
if (animIndex == 0) {
tableIndex = _rnd.getRandomNumberRng(0, 5);
@@ -693,7 +693,7 @@ void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) {
} else {
tableIndex = -1;
}
-
+
if (animIndex == 2)
snd_playSoundEffect(0x5E);
else
@@ -712,13 +712,13 @@ void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) {
_screen->updateScreen();
delayUntil(nextTime);
}
-
+
if (itemPos != -1) {
restoreItemRect1(x, y);
_screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, 12, 0);
backUpItemRect1(x, y);
}
-
+
for (int shape = _magicMouseItemStartFrame2[animIndex]; shape <= _magicMouseItemEndFrame2[animIndex]; ++shape) {
restoreItemRect1(x, y);
uint32 nextTime = _system->getMillis() + 4 * _tickLength;
@@ -774,14 +774,14 @@ void KyraEngine_v1::magicInMouseItem(int animIndex, int item, int itemPos) {
loopStart = 124;
maxLoops = 4;
}
-
+
_screen->hideMouse();
backUpItemRect1(x, y);
if (animIndex == 2)
snd_playSoundEffect(0x5E);
else
snd_playSoundEffect(0x37);
-
+
for (int shape = _magicMouseItemStartFrame[animIndex]; shape <= _magicMouseItemEndFrame[animIndex]; ++shape) {
restoreItemRect1(x, y);
uint32 nextTime = _system->getMillis() + 4 * _tickLength;
@@ -792,7 +792,7 @@ void KyraEngine_v1::magicInMouseItem(int animIndex, int item, int itemPos) {
_screen->updateScreen();
delayUntil(nextTime);
}
-
+
for (int shape = _magicMouseItemStartFrame2[animIndex]; shape <= _magicMouseItemEndFrame2[animIndex]; ++shape) {
restoreItemRect1(x, y);
uint32 nextTime = _system->getMillis() + 4 * _tickLength;
@@ -869,7 +869,7 @@ void KyraEngine_v1::updatePlayerItemsForScene() {
_screen->setMouseCursor(8, 15, _shapes[216+_itemInHand]);
_screen->showMouse();
}
-
+
bool redraw = false;
for (int i = 0; i < 10; ++i) {
uint8 item = _currentCharacter->inventoryItems[i];
@@ -881,16 +881,16 @@ void KyraEngine_v1::updatePlayerItemsForScene() {
redraw = true;
}
}
-
+
if (redraw) {
_screen->hideMouse();
redrawInventory(0);
_screen->showMouse();
}
-
+
if (_itemInHand == 33)
magicOutMouseItem(2, -1);
-
+
_screen->hideMouse();
for (int i = 0; i < 10; ++i) {
uint8 item = _currentCharacter->inventoryItems[i];
diff --git a/engines/kyra/items_v2.cpp b/engines/kyra/items_v2.cpp
index bc90b32544..02aeb7912c 100644
--- a/engines/kyra/items_v2.cpp
+++ b/engines/kyra/items_v2.cpp
@@ -78,7 +78,7 @@ int KyraEngine_v2::checkItemCollision(int x, int y) {
yPos = curItem.y;
}
}
-
+
return itemPos;
}
@@ -139,7 +139,7 @@ bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i
}
int itemHeight = _itemHtDat[item];
-
+
// no idea why it's '&&' here and not single checks for x and y
if (x == -1 && y == -1) {
x = _rnd.getRandomNumberRng(0x10, 0x130);
@@ -188,7 +188,7 @@ bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i
if (itemX == -1 || itemY == -1)
return false;
-
+
if (unk1 == 3) {
_itemList[freeItemSlot].x = itemX;
_itemList[freeItemSlot].y = itemY;
@@ -286,7 +286,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
uint16 endDelay = _system->getMillis() + _tickLength;
_screen->drawShape(0, itemShape, x, y, 0, 0);
_screen->updateScreen();
-
+
// XXX: original doesn't update game state while delaying
// our implementation *could* do it, so maybe check this again
delayUntil(endDelay);
@@ -295,7 +295,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
restoreGfxRect24x24(x, y);
} else {
restoreGfxRect24x24(curX, curY-16);
- }
+ }
}
if (_layerFlagTable[_screen->getLayer(dstX, dstY)] && item != 13) {
@@ -329,10 +329,10 @@ void KyraEngine_v2::exchangeMouseItem(int itemPos) {
snd_playSoundEffect(0x0b);
setMouseCursor(_itemInHand);
int str2 = 7;
-
+
if (_lang == 1)
str2 = getItemCommandStringPickUp(itemId);
-
+
updateCommandLineEx(itemId + 54, str2, 0xD6);
_screen->showMouse();
@@ -341,7 +341,7 @@ void KyraEngine_v2::exchangeMouseItem(int itemPos) {
bool KyraEngine_v2::pickUpItem(int x, int y) {
int itemPos = checkItemCollision(x, y);
-
+
if (itemPos <= -1)
return false;
@@ -355,10 +355,10 @@ bool KyraEngine_v2::pickUpItem(int x, int y) {
snd_playSoundEffect(0x0b);
setMouseCursor(itemId);
int str2 = 7;
-
+
if (_lang == 1)
str2 = getItemCommandStringPickUp(itemId);
-
+
updateCommandLineEx(itemId + 54, str2, 0xD6);
_itemInHand = itemId;
_screen->showMouse();
@@ -375,7 +375,7 @@ bool KyraEngine_v2::isDropable(int x, int y) {
x -= 8;
y -= 1;
-
+
for (int xpos = x; xpos < x + 16; ++xpos) {
if (_screen->getShapeFlag1(xpos, y) == 0)
return false;
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index b0bc58ef49..b71e696df1 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -241,7 +241,7 @@ void KyraEngine::registerDefaultSettings() {
void KyraEngine::readSettings() {
_configWalkspeed = ConfMan.getInt("walkspeed");
- _configMusic = ConfMan.getBool("music_mute") ? 0 : ((ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)) ? 2 : 1);
+ _configMusic = ConfMan.getBool("music_mute") ? 0 : ((ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)) ? 2 : 1);
_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
_sound->enableMusic(_configMusic);
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index ea322f4d77..4614b6537d 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -58,7 +58,7 @@ enum {
struct AudioDataStruct {
const char * const *_fileList;
- const int _fileListLen;
+ const int _fileListLen;
const void * const _cdaTracks;
const int _cdaNumTracks;
};
@@ -92,12 +92,12 @@ class KyraEngine : public Engine {
public:
KyraEngine(OSystem *system, const GameFlags &flags);
virtual ~KyraEngine();
-
+
bool quit() const { return _quitFlag; }
-
+
uint8 game() const { return _flags.gameID; }
const GameFlags &gameFlags() const { return _flags; }
-
+
// access to Kyra specific functionallity
Resource *resource() { return _res; }
virtual Screen *screen() = 0;
@@ -105,17 +105,17 @@ public:
Sound *sound() { return _sound; }
StaticResource *staticres() { return _staticres; }
TimerManager *timer() { return _timer; }
-
+
uint32 tickLength() const { return _tickLength; }
-
+
virtual Movie *createWSAMovie() = 0;
-
+
Common::RandomSource _rnd;
-
+
// quit handling
virtual void quitGame();
- // game flag handling
+ // game flag handling
int setGameFlag(int flag);
int queryGameFlag(int flag) const;
int resetGameFlag(int flag);
@@ -127,7 +127,7 @@ public:
virtual void snd_playVoiceFile(int id) = 0;
virtual bool snd_voiceIsPlaying();
virtual void snd_stopVoice();
-
+
// delay functionallity
virtual void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false);
virtual void delay(uint32 millis, bool update = false, bool isMainLoop = false);
@@ -136,10 +136,10 @@ public:
protected:
virtual int go() = 0;
virtual int init();
-
+
// quit Handling
bool _quitFlag;
-
+
// intern
Resource *_res;
Sound *_sound;
@@ -161,7 +161,7 @@ protected:
bool speechEnabled();
bool textEnabled();
-
+
// game speed
bool _skipFlag;
uint16 _tickLength;
@@ -171,7 +171,7 @@ protected:
virtual void setupTimers() = 0;
virtual void setWalkspeed(uint8 speed) = 0;
-
+
// detection
GameFlags _flags;
int _lang;
@@ -179,7 +179,7 @@ protected:
// opcode
virtual void setupOpcodeTable() = 0;
Common::Array<const Opcode*> _opcodes;
-
+
// game flags
uint8 _flagsTable[100]; // TODO: check this value
@@ -190,10 +190,10 @@ protected:
const int8 *_trackMap;
int _trackMapSize;
-
- // input
+
+ // input
Common::Point getMousePos() const;
-
+
// pathfinder
virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end);
@@ -202,7 +202,7 @@ protected:
void changePosTowardsFacing(int &x, int &y, int facing);
int getMoveTableSize(int *moveTable);
virtual bool lineIsPassable(int x, int y) = 0;
-
+
static const int8 _addXPosTable[];
static const int8 _addYPosTable[];
};
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 8630fc9806..87c6d4f843 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -53,10 +53,10 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
_seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm =
_seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 =
_seq_Demo4 = 0;
-
+
_seq_WSATable = _seq_CPSTable = _seq_COLTable = _seq_textsTable = 0;
_seq_WSATable_Size = _seq_CPSTable_Size = _seq_COLTable_Size = _seq_textsTable_Size = 0;
-
+
_roomFilenameTable = _characterImageTable = 0;
_roomFilenameTableSize = _characterImageTableSize = 0;
_itemList = _takenList = _placedList = _droppedList = _noDropList = 0;
@@ -66,7 +66,7 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
_thePoison = _fluteString = _wispJewelStrings = _magicJewelString = _flaskFull = _fullFlask = 0;
_thePoison_Size = _fluteString_Size = _wispJewelStrings_Size = 0;
_magicJewelString_Size = _flaskFull_Size = _fullFlask_Size = 0;
-
+
_defaultShapeTable = 0;
_healingShapeTable = _healingShape2Table = 0;
_defaultShapeTableSize = _healingShapeTableSize = _healingShape2TableSize = 0;
@@ -122,15 +122,15 @@ KyraEngine_v1::~KyraEngine_v1() {
delete _sprites;
delete _animator;
delete _seq;
-
+
delete _npcScriptData;
delete _scriptMain;
-
+
delete _scriptClickData;
delete _scriptClick;
-
+
delete [] _characterList;
-
+
delete [] _movFacingTable;
delete [] _scrollUpButton.process0PtrShape;
@@ -141,7 +141,7 @@ KyraEngine_v1::~KyraEngine_v1() {
delete [] _scrollDownButton.process2PtrShape;
delete [] _itemBkgBackUp[0];
- delete [] _itemBkgBackUp[1];
+ delete [] _itemBkgBackUp[1];
for (int i = 0; i < ARRAYSIZE(_shapes); ++i) {
if (_shapes[i] != 0) {
@@ -179,12 +179,12 @@ int KyraEngine_v1::init() {
assert(_text);
initStaticResource();
-
+
_sound->setSoundList(&_soundData[kMusicIntro]);
_trackMap = _dosTrackMap;
_trackMapSize = _dosTrackMapSize;
-
+
if (!_sound->init())
error("Couldn't init sound");
@@ -207,27 +207,27 @@ int KyraEngine_v1::init() {
_characterList[0].height = 48;
_characterList[0].facing = 3;
_characterList[0].currentAnimFrame = 7;
-
+
_npcScriptData = new ScriptData;
memset(_npcScriptData, 0, sizeof(ScriptData));
assert(_npcScriptData);
_npcScript = new ScriptState;
assert(_npcScript);
memset(_npcScript, 0, sizeof(ScriptState));
-
+
_scriptMain = new ScriptState;
assert(_scriptMain);
memset(_scriptMain, 0, sizeof(ScriptState));
-
+
_scriptClickData = new ScriptData;
assert(_scriptClickData);
memset(_scriptClickData, 0, sizeof(ScriptData));
_scriptClick = new ScriptState;
assert(_scriptClick);
memset(_scriptClick, 0, sizeof(ScriptState));
-
+
_debugger = new Debugger_v1(this);
- assert(_debugger);
+ assert(_debugger);
memset(_shapes, 0, sizeof(_shapes));
for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i)
@@ -251,7 +251,7 @@ int KyraEngine_v1::init() {
_brandonPosX = _brandonPosY = -1;
_deathHandler = 0xFF;
_poisonDeathCounter = 0;
-
+
memset(_itemTable, 0, sizeof(_itemTable));
memset(_exitList, 0xFFFF, sizeof(_exitList));
_exitListPtr = 0;
@@ -269,17 +269,17 @@ int KyraEngine_v1::init() {
memset(_foyerItemTable, -1, sizeof(_foyerItemTable));
_mouseState = _itemInHand = -1;
_handleInput = false;
-
+
_currentRoom = 0xFFFF;
_scenePhasingFlag = 0;
_lastProcessedItem = 0;
_lastProcessedItemHeight = 16;
-
+
_unkScreenVar1 = 1;
_unkScreenVar2 = 0;
_unkScreenVar3 = 0;
_unkAmuletVar = 0;
-
+
_endSequenceNeedLoading = 1;
_malcolmFlag = 0;
_beadStateVar = 0;
@@ -291,16 +291,16 @@ int KyraEngine_v1::init() {
_lastDisplayedPanPage = 0;
memset(_panPagesTable, 0, sizeof(_panPagesTable));
_finalA = _finalB = _finalC = 0;
- memset(&_kyragemFadingState, 0, sizeof(_kyragemFadingState));
+ memset(&_kyragemFadingState, 0, sizeof(_kyragemFadingState));
_kyragemFadingState.gOffset = 0x13;
_kyragemFadingState.bOffset = 0x13;
_mousePressFlag = false;
-
+
_menuDirectlyToLoad = false;
_lastMusicCommand = 0;
-
+
return 0;
}
@@ -390,15 +390,15 @@ void KyraEngine_v1::startup() {
while (_scriptInterpreter->validScript(_scriptMain))
_scriptInterpreter->runScript(_scriptMain);
-
+
_scriptInterpreter->unloadScript(_npcScriptData);
if (!_scriptInterpreter->loadScript("_NPC.EMC", _npcScriptData, &_opcodes))
error("Could not load \"_NPC.EMC\" script");
-
+
snd_playTheme(1);
enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
-
+
if (_abortIntroFlag && _skipIntroFlag) {
_menuDirectlyToLoad = true;
_screen->setMouseCursor(1, 1, _shapes[0]);
@@ -421,7 +421,7 @@ void KyraEngine_v1::mainLoop() {
if (seq_playEnd() && _deathHandler != 8)
break;
}
-
+
if (_deathHandler != 0xFF) {
snd_playWanderScoreViaMap(0, 1);
snd_playSoundEffect(49);
@@ -432,7 +432,7 @@ void KyraEngine_v1::mainLoop() {
buttonMenuCallback(0);
_deathHandler = 0xFF;
}
-
+
if ((_brandonStatusBit & 2) && _brandonStatusBit0x02Flag)
_animator->animRefreshNPC(0);
@@ -440,7 +440,7 @@ void KyraEngine_v1::mainLoop() {
_animator->animRefreshNPC(0);
_brandonStatusBit0x20Flag = 0;
}
-
+
_screen->showMouse();
processButtonList(_buttonList);
@@ -474,7 +474,7 @@ void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' &&
+ if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' &&
(event.kbd.flags == Common::KBD_CTRL || event.kbd.flags == Common::KBD_ALT) && isMainLoop) {
const char *saveLoadSlot = getSavegameFilename(event.kbd.keycode - '0');
@@ -510,7 +510,7 @@ void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) {
case Common::EVENT_LBUTTONUP:
_mousePressFlag = false;
- if (_abortWalkFlag2)
+ if (_abortWalkFlag2)
_abortWalkFlag = true;
if (_handleInput) {
@@ -541,7 +541,7 @@ void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) {
if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE))
_skipFlag = false;
-
+
if (amount > 0 && !_skipFlag && !_quitFlag)
_system->delayMillis(10);
@@ -698,8 +698,8 @@ void KyraEngine_v1::processInput() {
int handled = clickEventHandler(xpos, ypos);
if (_changedScene || handled)
return;
- }
-
+ }
+
// XXX _deathHandler specific
if (ypos <= 158) {
uint16 exit = 0xFFFF;
@@ -712,7 +712,7 @@ void KyraEngine_v1::processInput() {
} else if (ypos < 12) {
exit = _walkBlockNorth;
}
-
+
if (exit != 0xFFFF) {
_abortWalkFlag2 = true;
handleSceneChange(xpos, ypos, 1, 1);
@@ -742,7 +742,7 @@ void KyraEngine_v1::processInput() {
}
}
}
- }
+ }
}
int KyraEngine_v1::processInputHelper(int xpos, int ypos) {
@@ -789,7 +789,7 @@ int KyraEngine_v1::clickEventHandler(int xpos, int ypos) {
void KyraEngine_v1::updateMousePointer(bool forceUpdate) {
int shape = 0;
-
+
int newMouseState = 0;
int newX = 0;
int newY = 0;
@@ -834,7 +834,7 @@ void KyraEngine_v1::updateMousePointer(bool forceUpdate) {
}
}
}
-
+
if (mouse.x >= _entranceMouseCursorTracks[0] && mouse.y >= _entranceMouseCursorTracks[1]
&& mouse.x <= _entranceMouseCursorTracks[2] && mouse.y <= _entranceMouseCursorTracks[3]) {
switch (_entranceMouseCursorTracks[4]) {
@@ -870,20 +870,20 @@ void KyraEngine_v1::updateMousePointer(bool forceUpdate) {
break;
}
}
-
+
if (newMouseState == -2) {
shape = 6;
newX = 4;
newY = 4;
}
-
+
if ((newMouseState && _mouseState != newMouseState) || (newMouseState && forceUpdate)) {
_mouseState = newMouseState;
_screen->hideMouse();
_screen->setMouseCursor(newX, newY, _shapes[shape]);
_screen->showMouse();
}
-
+
if (!newMouseState) {
if (_mouseState != _itemInHand || forceUpdate) {
if (mouse.y > 158 || (mouse.x >= 12 && mouse.x < 308 && mouse.y < 136 && mouse.y >= 12) || forceUpdate) {
@@ -924,7 +924,7 @@ void KyraEngine_v1::clickEventHandler2() {
_scriptClick->regs[2] = mouse.y;
_scriptClick->regs[4] = _itemInHand;
_scriptInterpreter->startScript(_scriptClick, 6);
-
+
while (_scriptInterpreter->validScript(_scriptClick))
_scriptInterpreter->runScript(_scriptClick);
}
@@ -934,28 +934,28 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) {
int returnValue = -1;
const Character *currentChar = _currentCharacter;
int charLeft = 0, charRight = 0, charTop = 0, charBottom = 0;
-
+
int scaleFactor = _scaleTable[currentChar->y1];
int addX = (((scaleFactor*8)*3)>>8)>>1;
int addY = ((scaleFactor*3)<<4)>>8;
-
+
charLeft = currentChar->x1 - addX;
charRight = currentChar->x1 + addX;
charTop = currentChar->y1 - addY;
charBottom = currentChar->y1;
-
+
if (xpos >= charLeft && charRight >= xpos && charTop <= ypos && charBottom >= ypos)
return 0;
-
+
if (xpos > 304 || xpos < 16)
return -1;
-
+
for (int i = 1; i < 5; ++i) {
currentChar = &_characterList[i];
-
+
if (currentChar->sceneId != _currentCharacter->sceneId)
continue;
-
+
charLeft = currentChar->x1 - 12;
charRight = currentChar->x1 + 11;
charTop = currentChar->y1 - 48;
@@ -963,10 +963,10 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) {
// charBottom = currentChar->y2 - 16;
// else
charBottom = currentChar->y1;
-
+
if (xpos < charLeft || xpos > charRight || ypos < charTop || charBottom < ypos)
continue;
-
+
if (returnValue != -1) {
if (currentChar->y1 >= _characterList[returnValue].y1)
returnValue = i;
@@ -974,7 +974,7 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) {
returnValue = i;
}
}
-
+
return returnValue;
}
@@ -985,7 +985,7 @@ void KyraEngine_v1::runNpcScript(int func) {
_npcScript->regs[0] = _currentCharacter->sceneId;
_npcScript->regs[4] = _itemInHand;
_npcScript->regs[5] = func;
-
+
while (_scriptInterpreter->validScript(_npcScript))
_scriptInterpreter->runScript(_npcScript);
}
@@ -1050,7 +1050,7 @@ void KyraEngine_v1::writeSettings() {
}
ConfMan.setInt("talkspeed", talkspeed);
-
+
KyraEngine::writeSettings();
}
@@ -1258,7 +1258,7 @@ void KyraEngine_v1::setupOpcodeTable() {
// 0x9c
Opcode(o1_dummy)
};
-
+
for (int i = 0; i < ARRAYSIZE(opcodeTable); ++i)
_opcodes.push_back(&opcodeTable[i]);
}
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index e9bba94b96..ac3f9960fe 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -209,7 +209,7 @@ public:
const char * const*seqCPSTable() { return _seq_CPSTable; }
const char * const*seqCOLTable() { return _seq_COLTable; }
const char * const*seqTextsTable() { return _seq_textsTable; }
-
+
const uint8 * const*palTable1() { return &_specialPalettes[0]; }
const uint8 * const*palTable2() { return &_specialPalettes[29]; }
@@ -279,7 +279,7 @@ public:
void snd_playWanderScoreViaMap(int command, int restart);
virtual void snd_playVoiceFile(int id);
void snd_voiceWaitForFinish(bool ingame = true);
-
+
void saveGame(const char *fileName, const char *saveName);
void loadGame(const char *fileName);
@@ -316,7 +316,7 @@ protected:
int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
bool lineIsPassable(int x, int y);
- // -> item handling
+ // -> item handling
// --> misc
void addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y);
@@ -417,10 +417,10 @@ protected:
// misc (TODO)
void startup();
void mainLoop();
-
+
int checkForNPCScriptRun(int xpos, int ypos);
void runNpcScript(int func);
-
+
void loadMouseShapes();
void loadCharacterShapes();
void loadSpecialEffectShapes();
@@ -431,7 +431,7 @@ protected:
void setupPanPages();
void freePanPages();
void closeFinalWsa();
-
+
//void setTimer19();
void setupTimers();
void timerUpdateHeadAnims(int timerNum);
@@ -457,7 +457,7 @@ protected:
void calcCoords(Menu &menu);
void initMenu(Menu &menu);
void setGUILabels();
-
+
Button *initButton(Button *list, Button *newButton);
void processButtonList(Button *list);
void processButton(Button *button);
@@ -515,7 +515,7 @@ protected:
int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3;
int _beadStateVar;
int _unkAmuletVar;
-
+
int _malcolmFlag;
int _endSequenceSkipFlag;
int _endSequenceNeedLoading;
@@ -526,7 +526,7 @@ protected:
int _lastDisplayedPanPage;
uint8 *_panPagesTable[20];
Movie *_finalA, *_finalB, *_finalC;
-
+
Movie *_movieObjects[10];
uint16 _entranceMouseCursorTracks[8];
@@ -534,18 +534,18 @@ protected:
uint16 _walkBlockEast;
uint16 _walkBlockSouth;
uint16 _walkBlockWest;
-
+
int32 _scaleMode;
int16 _scaleTable[145];
-
+
Rect _noDropRects[11];
-
+
int8 _birthstoneGemTable[4];
int8 _idolGemsTable[3];
-
+
int8 _marbleVaseItem;
int8 _foyerItemTable[3];
-
+
int8 _cauldronState;
int8 _crystalState[2];
@@ -561,27 +561,27 @@ protected:
uint16 _currentChatPartnerBackupFrame;
uint16 _currentCharAnimFrame;
-
+
int8 *_sceneAnimTable[50];
-
+
Item _itemTable[145];
int _lastProcessedItem;
int _lastProcessedItemHeight;
-
+
int16 *_exitListPtr;
int16 _exitList[11];
SceneExits _sceneExits;
uint16 _currentRoom;
int _scenePhasingFlag;
-
+
int _sceneChangeState;
int _loopFlag2;
-
+
int _pathfinderFlag;
int _pathfinderFlag2;
int _lastFindWayRet;
int *_movFacingTable;
-
+
int8 _talkingCharNum;
int8 _charSayUnk2;
int8 _charSayUnk3;
@@ -599,16 +599,16 @@ protected:
Debugger *_debugger;
ScriptState *_scriptMain;
-
+
ScriptState *_npcScript;
ScriptData *_npcScriptData;
-
+
ScriptState *_scriptClick;
ScriptData *_scriptClickData;
-
+
Character *_characterList;
Character *_currentCharacter;
-
+
Button *_buttonList;
Button *_menuButtonList;
bool _displayMenu;
@@ -648,17 +648,17 @@ protected:
const uint8 *_seq_Demo3;
const uint8 *_seq_Demo4;
const uint8 *_seq_Reunion;
-
+
const char * const*_seq_WSATable;
const char * const*_seq_CPSTable;
const char * const*_seq_COLTable;
const char * const*_seq_textsTable;
-
+
int _seq_WSATable_Size;
int _seq_CPSTable_Size;
int _seq_COLTable_Size;
int _seq_textsTable_Size;
-
+
const char * const*_itemList;
const char * const*_takenList;
const char * const*_placedList;
@@ -678,13 +678,13 @@ protected:
const char * const*_veryClever;
const char * const*_homeString;
const char * const*_newGameString;
-
+
const char *_voiceTextString;
const char *_textSpeedString;
const char *_onString;
const char *_offString;
const char *_onCDString;
-
+
int _itemList_Size;
int _takenList_Size;
int _placedList_Size;
@@ -704,7 +704,7 @@ protected:
int _veryClever_Size;
int _homeString_Size;
int _newGameString_Size;
-
+
const char * const*_characterImageTable;
int _characterImageTableSize;
@@ -713,47 +713,47 @@ protected:
const char * const*_configStrings;
int _configStringsSize;
-
+
Shape *_defaultShapeTable;
int _defaultShapeTableSize;
-
+
const Shape *_healingShapeTable;
int _healingShapeTableSize;
const Shape *_healingShape2Table;
int _healingShape2TableSize;
-
+
const Shape *_posionDeathShapeTable;
int _posionDeathShapeTableSize;
-
+
const Shape *_fluteAnimShapeTable;
int _fluteAnimShapeTableSize;
-
+
const Shape *_winterScrollTable;
int _winterScrollTableSize;
const Shape *_winterScroll1Table;
int _winterScroll1TableSize;
const Shape *_winterScroll2Table;
int _winterScroll2TableSize;
-
+
const Shape *_drinkAnimationTable;
int _drinkAnimationTableSize;
-
+
const Shape *_brandonToWispTable;
int _brandonToWispTableSize;
-
+
const Shape *_magicAnimationTable;
int _magicAnimationTableSize;
-
+
const Shape *_brandonStoneTable;
int _brandonStoneTableSize;
-
+
Room *_roomTable;
int _roomTableSize;
const char * const*_roomFilenameTable;
int _roomFilenameTableSize;
-
+
const uint8 *_amuleteAnim;
-
+
const uint8 * const*_specialPalettes;
const char *const *_soundFiles;
@@ -763,14 +763,14 @@ protected:
const int32 *_cdaTrackTable;
int _cdaTrackTableSize;
const AudioDataStruct * _soundData;
-
+
static const int8 _charXPosTable[];
static const int8 _charYPosTable[];
// positions of the inventory
static const uint16 _itemPosX[];
static const uint8 _itemPosY[];
-
+
void setupButtonData();
Button *_buttonData;
Button **_buttonDataListPtr;
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 529b4ffbd5..5f0d1a1e50 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -173,7 +173,7 @@ int KyraEngine_v2::go() {
// load just the pak files needed for ingame
_res->loadPakFile(StaticResource::staticDataFilename());
if (_flags.platform == Common::kPlatformPC && _flags.isTalkie)
- _res->loadFileList("FILEDATA.FDT");
+ _res->loadFileList("FILEDATA.FDT");
else
_res->loadFileList(_ingamePakList, _ingamePakListSize);
}
@@ -214,10 +214,10 @@ void KyraEngine_v2::startup() {
_screenBuffer = new uint8[64000];
_unkBuf200kByte = new uint8[200000];
- loadChapterBuffer(_newChapterFile);
+ loadChapterBuffer(_newChapterFile);
loadCCodeBuffer("C_CODE.XXX");
-
+
if (_flags.isTalkie) {
loadOptionsBuffer("OPTIONS.XXX");
@@ -928,7 +928,7 @@ void KyraEngine_v2::updateCommandLineEx(int str1, int str2, int16 palIndex) {
++src;
*src = toupper(*src);
}
-
+
strcpy((char*)_unkBuf500Bytes, src);
if (str2 > 0) {
@@ -1571,7 +1571,7 @@ void KyraEngine_v2::playVoice(int high, int low) {
void KyraEngine_v2::snd_playSoundEffect(int track) {
debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v2::snd_playSoundEffect(%d)", track);
-
+
if (track == 10)
track = _lastSfxTrack;
@@ -1583,7 +1583,7 @@ void KyraEngine_v2::snd_playSoundEffect(int track) {
int16 vocIndex = (int16) READ_LE_UINT16(&_ingameSoundIndex[track * 2]);
if (vocIndex != -1)
_sound->voicePlay(_ingameSoundList[vocIndex]);
- else if (_flags.platform == Common::kPlatformPC)
+ else if (_flags.platform == Common::kPlatformPC)
// TODO ?? Maybe there is a way to let users select whether they want
// voc, midi or adl sfx (even though it makes no sense to choose anything but voc).
// For now this is used as a fallback only (if no voc file exists).
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 6436cec92f..97ebb263dd 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -859,7 +859,7 @@ protected:
int _sequencePakListSize;
const char *const *_ingamePakList;
int _ingamePakListSize;
-
+
const char *const *_musicFileListIntro;
int _musicFileListIntroSize;
const char *const *_musicFileListFinale;
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index 6ee5eff11c..ce0f1a8cd2 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -61,7 +61,7 @@ KyraEngine_v3::KyraEngine_v3(OSystem *system, const GameFlags &flags) : KyraEngi
KyraEngine_v3::~KyraEngine_v3() {
delete _soundDigital;
-
+
delete [] _unkPage1;
delete [] _unkPage2;
delete [] _interfaceCPS1;
@@ -96,12 +96,12 @@ int KyraEngine_v3::init() {
KyraEngine::init();
gui_initMainMenu();
-
+
_soundDigital = new SoundDigital(this, _mixer);
assert(_soundDigital);
if (!_soundDigital->init())
error("_soundDigital->init() failed");
-
+
_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
_screen->loadFont(Screen::FID_BOOKFONT_FNT, "BOOKFONT.FNT");
@@ -134,24 +134,24 @@ int KyraEngine_v3::init() {
int KyraEngine_v3::go() {
uint8 *pal = _screen->getPalette(1);
assert(pal);
-
+
_mainMenuLogo = createWSAMovie();
assert(_mainMenuLogo);
_mainMenuLogo->open("REVENGE.WSA", 1, pal);
assert(_mainMenuLogo->opened());
-
+
bool running = true;
while (running && !_quitFlag) {
_screen->_curPage = 0;
_screen->clearPage(0);
pal[0] = pal[1] = pal[2] = 0;
-
+
_screen->setScreenPalette(pal);
-
+
// XXX
playMenuAudioFile();
-
+
_mainMenuLogo->setX(0); _mainMenuLogo->setY(0);
_mainMenuLogo->setDrawPage(0);
@@ -178,18 +178,18 @@ int KyraEngine_v3::go() {
// XXX
running = false;
break;
-
+
case 1:
playVQA("K3INTRO");
break;
-
+
case 2:
//delete _mainMenuLogo;
//_mainMenuLogo = 0;
//show load dialog
//running = false;
break;
-
+
case 3:
_soundDigital->beginFadeOut(_musicSoundChannel);
_screen->fadeToBlack();
@@ -197,7 +197,7 @@ int KyraEngine_v3::go() {
_musicSoundChannel = -1;
running = false;
break;
-
+
default:
break;
}
@@ -255,19 +255,19 @@ void KyraEngine_v3::playMenuAudioFile() {
void KyraEngine_v3::playMusicTrack(int track, int force) {
debugC(9, kDebugLevelMain, "KyraEngine::playMusicTrack(%d, %d)", track, force);
-
+
// XXX byte_2C87C compare
-
+
if (_musicSoundChannel != -1 && !_soundDigital->isPlaying(_musicSoundChannel))
force = 1;
else if (_musicSoundChannel == -1)
force = 1;
-
+
if (track == _curMusicTrack && !force)
return;
-
+
stopMusicTrack();
-
+
if (_musicSoundChannel == -1) {
assert(track < _soundListSize && track >= 0);
@@ -279,7 +279,7 @@ void KyraEngine_v3::playMusicTrack(int track, int force) {
else
delete handle;
}
-
+
_musicSoundChannel = track;
}
@@ -287,21 +287,21 @@ void KyraEngine_v3::stopMusicTrack() {
if (_musicSoundChannel != -1 && _soundDigital->isPlaying(_musicSoundChannel)) {
_soundDigital->stopSound(_musicSoundChannel);
}
-
+
_curMusicTrack = -1;
_musicSoundChannel = -1;
}
int KyraEngine_v3::musicUpdate(int forceRestart) {
debugC(9, kDebugLevelMain, "KyraEngine::unkUpdate(%d)", forceRestart);
-
+
static uint32 mTimer = 0;
static uint16 lock = 0;
if (ABS<int>(_system->getMillis() - mTimer) > (int)(0x0F * _tickLength)) {
mTimer = _system->getMillis();
}
-
+
if (_system->getMillis() < mTimer && !forceRestart) {
return 1;
}
@@ -318,7 +318,7 @@ int KyraEngine_v3::musicUpdate(int forceRestart) {
lock = 0;
mTimer = _system->getMillis() + 0x0F * _tickLength;
}
-
+
return 1;
}
@@ -332,17 +332,17 @@ void KyraEngine_v3::gui_initMainMenu() {
void KyraEngine_v3::gui_updateMainMenuAnimation() {
uint32 nextRun = 0;
-
+
uint32 now = _system->getMillis();
if (now < nextRun)
return;
// yes 2 * _tickLength here not 3 * like in the first draw
nextRun = now + 2 * _tickLength;
-
+
_mainMenuLogo->displayFrame(_mainMenuFrame);
_screen->updateScreen();
-
+
_mainMenuFrame += _mainMenuFrameAdd;
if (_mainMenuFrame < 29) {
_mainMenuFrame = 29;
@@ -351,7 +351,7 @@ void KyraEngine_v3::gui_updateMainMenuAnimation() {
_mainMenuFrame = 64;
_mainMenuFrameAdd = -1;
}
-
+
// XXX
}
@@ -367,17 +367,17 @@ void KyraEngine_v3::preinit() {
// XXX
setGameFlag(0x216);
-
+
_unkPage1 = new uint8[64000];
assert(_unkPage1);
-
+
musicUpdate(0);
musicUpdate(0);
-
+
_interfaceCPS1 = new uint8[17920];
_interfaceCPS2 = new uint8[3840];
assert(_interfaceCPS1 && _interfaceCPS2);
-
+
_screen->setFont(Screen::FID_6_FNT);
}
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index f0c3f3b2dd..78ce6382a4 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -53,14 +53,14 @@ private:
void setupOpcodeTable() {}
SoundDigital *_soundDigital;
-
+
// sound specific
private:
void playMenuAudioFile();
-
+
int _musicSoundChannel;
const char *_menuAudioFile;
-
+
static const char *_soundList[];
static const int _soundListSize;
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk
index b5bf5ab73b..e631ddf5dd 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -48,5 +48,5 @@ ifdef BUILD_PLUGINS
PLUGIN := 1
endif
-# Include common rules
+# Include common rules
include $(srcdir)/rules.mk
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 57094d8e68..b6d3bfe57a 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -63,7 +63,7 @@ bool Resource::reset() {
unloadAllPakFiles();
FilesystemNode dir(ConfMan.get("path"));
-
+
if (!dir.exists() || !dir.isDirectory())
error("invalid game path '%s'", dir.getPath().c_str());
@@ -179,7 +179,7 @@ bool Resource::loadPakFile(const Common::String &filename) {
bool Resource::loadFileList(const Common::String &filedata) {
Common::File f;
-
+
if (!f.open(filedata))
return false;
@@ -200,7 +200,7 @@ bool Resource::loadFileList(const Common::String &filedata) {
error("couldn't load file '%s'", filename.c_str());
return false;
}
- }
+ }
}
return true;
diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp
index 22cf2e0f2b..f3e41b2d39 100644
--- a/engines/kyra/scene.cpp
+++ b/engines/kyra/scene.cpp
@@ -33,12 +33,12 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
x &= 0xFFFC; toX &= 0xFFFC;
y &= 0xFFFE; toY &= 0xFFFE;
x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY;
-
+
if (x == toY && y == toY) {
moveTable[0] = 8;
return 0;
}
-
+
int curX = x;
int curY = y;
int tempValue = 0;
@@ -46,7 +46,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
int *pathTable1 = new int[0x7D0];
int *pathTable2 = new int[0x7D0];
assert(pathTable1 && pathTable2);
-
+
while (true) {
int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
changePosTowardsFacing(curX, curY, newFacing);
@@ -86,7 +86,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
screen()->updateScreen();
//waitTicks(5);
}*/
-
+
if (!lineIsPassable(curX, curY)) {
if (curX != toX || curY != toY)
continue;
@@ -99,7 +99,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
break;
}
}
-
+
temp = findSubPath(x, y, curX, curY, pathTable1, 1, 0x7D0);
tempValue = findSubPath(x, y, curX, curY, pathTable2, 0, 0x7D0);
if (curX == toX && curY == toY) {
@@ -109,11 +109,11 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
return 0x7D00;
}
}
-
+
if (temp != 0x7D00 || tempValue != 0x7D00)
break;
}
-
+
if (temp < tempValue) {
if (lastUsedEntry + temp > moveTableSize) {
delete [] pathTable1;
@@ -152,18 +152,18 @@ int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int
static const int8 facingTable3[] = { 2, 4, 4, 6, 6, 0, 0, 2, 6, 6, 0, 0, 2, 2, 4, 4 };
static const int8 addPosTableX[] = { -1, 0, -1, 4, -1, 0, -1, -4, -1, -4, -1, 0, -1, 4, -1, 0 };
static const int8 addPosTableY[] = { -1, 2, -1, 0, -1, -2, -1, 0, -1, 0, -1, 2, -1, 0, -1, -2 };
-
+
// debug specific
/*++unkTable[start];
while (screen()->getPalette(0)[unkTable[start]] != 0x0F) {
++unkTable[start];
}*/
-
+
int xpos1 = x, xpos2 = x;
int ypos1 = y, ypos2 = y;
int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
int position = 0;
-
+
while (position != end) {
int newFacing2 = newFacing;
while (true) {
@@ -202,7 +202,7 @@ int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int
if (x == toX && y == toY)
return position;
-
+
if (xpos1 == xpos2 && ypos1 == ypos2)
break;
@@ -217,21 +217,21 @@ int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) {
static const int facingTable[] = {
1, 0, 1, 2, 3, 4, 3, 2, 7, 0, 7, 6, 5, 4, 5, 6
};
-
+
int facingEntry = 0;
int ydiff = y - toY;
if (ydiff < 0) {
++facingEntry;
ydiff = -ydiff;
- }
+ }
facingEntry <<= 1;
-
+
int xdiff = toX - x;
if (xdiff < 0) {
++facingEntry;
xdiff = -xdiff;
}
-
+
if (xdiff >= ydiff) {
int temp = ydiff;
ydiff = xdiff;
@@ -243,7 +243,7 @@ int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) {
facingEntry += 1;
}
int temp = (ydiff + 1) >> 1;
-
+
if (xdiff < temp) {
facingEntry <<= 1;
facingEntry += 1;
@@ -290,7 +290,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) {
int retValue = 0;
if (moveTable[0] == 8)
return 0;
-
+
static const int facingTable[] = {
4, 5, 6, 7, 0, 1, 2, 3
};
@@ -304,7 +304,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) {
7, 0, -1, 4, 5, -1, -1, -1,
-1, -1, 0, -1, 6, -1, -1, -1
};
-
+
int *oldPosition = moveTable;
int *tempPosition = moveTable;
int *curPosition = moveTable + 1;
@@ -315,13 +315,13 @@ int KyraEngine::getMoveTableSize(int *moveTable) {
retValue -= 2;
*oldPosition = 9;
*curPosition = 9;
-
+
while (tempPosition != moveTable) {
--tempPosition;
if (*tempPosition != 9)
break;
}
-
+
if (tempPosition == moveTable && *tempPosition == 9) {
while (*tempPosition != 8 && *tempPosition == 9)
++tempPosition;
@@ -329,7 +329,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) {
if (*tempPosition == 8)
return 0;
}
-
+
oldPosition = tempPosition;
curPosition = oldPosition+1;
@@ -338,12 +338,12 @@ int KyraEngine::getMoveTableSize(int *moveTable) {
continue;
}
-
+
if (unkTable[*curPosition+((*oldPosition)*8)] != -1) {
--retValue;
*oldPosition = unkTable[*curPosition+((*oldPosition)*8)];
*curPosition = 9;
-
+
if (tempPosition != oldPosition) {
curPosition = oldPosition;
oldPosition = tempPosition;
@@ -365,7 +365,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) {
}
continue;
}
-
+
tempPosition = oldPosition;
oldPosition = curPosition;
++retValue;
diff --git a/engines/kyra/scene_v1.cpp b/engines/kyra/scene_v1.cpp
index d5726fa57b..ce64269ba1 100644
--- a/engines/kyra/scene_v1.cpp
+++ b/engines/kyra/scene_v1.cpp
@@ -64,13 +64,13 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i
newSfxFile = 2;
else if (_currentCharacter->sceneId == 24 && sceneId == 7)
newSfxFile = 1;
-
+
if (newSfxFile != -1) {
_curSfxFile = newSfxFile;
_sound->loadSoundFile(_curSfxFile);
}
}
-
+
switch (_currentCharacter->sceneId) {
case 1:
if (sceneId == 0) {
@@ -103,7 +103,7 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i
default:
break;
}
-
+
if (unkVar1 && unk1) {
int xpos = _currentCharacter->x1;
int ypos = _currentCharacter->y1;
@@ -127,32 +127,32 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i
default:
break;
}
-
+
moveCharacterToPos(0, facing, xpos, ypos);
}
-
+
for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i)
_movieObjects[i]->close();
-
+
if (!brandonAlive) {
_scriptInterpreter->initScript(_scriptClick, _scriptClickData);
_scriptInterpreter->startScript(_scriptClick, 5);
while (_scriptInterpreter->validScript(_scriptClick))
_scriptInterpreter->runScript(_scriptClick);
}
-
+
memset(_entranceMouseCursorTracks, 0xFFFF, sizeof(uint16)*4);
_currentCharacter->sceneId = sceneId;
-
+
assert(sceneId < _roomTableSize);
assert(_roomTable[sceneId].nameIndex < _roomFilenameTableSize);
Room *currentRoom = &_roomTable[sceneId];
-
+
setupSceneResource(sceneId);
-
+
_currentRoom = sceneId;
-
+
int tableId = _roomTable[sceneId].nameIndex;
char fileNameBuffer[32];
strcpy(fileNameBuffer, _roomFilenameTable[tableId]);
@@ -161,12 +161,12 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i
_sprites->setupSceneAnims();
_scriptInterpreter->unloadScript(_scriptClickData);
loadSceneMsc();
-
+
_walkBlockNorth = currentRoom->northExit;
_walkBlockEast = currentRoom->eastExit;
_walkBlockSouth = currentRoom->southExit;
_walkBlockWest = currentRoom->westExit;
-
+
if (_walkBlockNorth == 0xFFFF)
_screen->blockOutRegion(0, 0, 320, (_northExitHeight & 0xFF)+3);
if (_walkBlockEast == 0xFFFF)
@@ -175,15 +175,15 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i
_screen->blockOutRegion(0, 135, 320, 8);
if (_walkBlockWest == 0xFFFF)
_screen->blockOutRegion(0, 0, 8, 139);
-
+
if (!brandonAlive)
updatePlayerItemsForScene();
startSceneScript(brandonAlive);
setupSceneItems();
-
+
initSceneData(facing, unk2, brandonAlive);
-
+
_loopFlag2 = 0;
_screen->showMouse();
if (!brandonAlive)
@@ -244,15 +244,15 @@ void KyraEngine_v1::moveCharacterToPos(int character, int facing, int xpos, int
delayUntil(nextFrame, true);
}
break;
-
- case 2:
+
+ case 2:
while (ch->x1 < xpos) {
nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis();
setCharacterPositionWithUpdate(character);
delayUntil(nextFrame, true);
}
break;
-
+
case 4:
while (ypos > ch->y1) {
nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis();
@@ -260,7 +260,7 @@ void KyraEngine_v1::moveCharacterToPos(int character, int facing, int xpos, int
delayUntil(nextFrame, true);
}
break;
-
+
case 6:
while (ch->x1 > xpos) {
nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis();
@@ -268,7 +268,7 @@ void KyraEngine_v1::moveCharacterToPos(int character, int facing, int xpos, int
delayUntil(nextFrame, true);
}
break;
-
+
default:
break;
}
@@ -321,10 +321,10 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable)
}
}
}
-
+
static uint8 facingIsZero[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
static uint8 facingIsFour[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-
+
if (facing == 0) {
++facingIsZero[character];
} else {
@@ -350,13 +350,13 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable)
facing = 0;
resetTables = true;
}
-
+
if (resetTables) {
facingIsZero[character] = 0;
facingIsFour[character] = 0;
}
}
-
+
static const uint16 maxAnimationFrame[] = {
0x000F, 0x0031, 0x0055, 0x0000, 0x0000, 0x0000,
0x0008, 0x002A, 0x004E, 0x0000, 0x0000, 0x0000,
@@ -366,7 +366,7 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable)
0x0028, 0x004C, 0x0070, 0x0000, 0x0000, 0x0000,
0x0023, 0x0047, 0x006B, 0x0000, 0x0000, 0x0000
};
-
+
if (facing == 0) {
if (maxAnimationFrame[36+character] > ch->currentAnimFrame)
ch->currentAnimFrame = maxAnimationFrame[36+character];
@@ -385,10 +385,10 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable)
if (maxAnimationFrame[character] < ch->currentAnimFrame)
ch->currentAnimFrame = maxAnimationFrame[6+character]+2;
}
-
+
if (character == 0 && (_brandonStatusBit & 0x10))
ch->currentAnimFrame = 88;
-
+
_animator->animRefreshNPC(character);
}
@@ -416,11 +416,11 @@ void KyraEngine_v1::startSceneScript(int brandonAlive) {
_screen->loadBitmap(fileNameBuffer, 3, 3, (_flags.platform == Common::kPlatformAmiga ? _screen->getPalette(0) : 0));
_sprites->loadSceneShapes();
_exitListPtr = 0;
-
- _scaleMode = 1;
+
+ _scaleMode = 1;
for (int i = 0; i < 145; ++i)
_scaleTable[i] = 256;
-
+
clearNoDropRects();
_scriptInterpreter->initScript(_scriptClick, _scriptClickData);
strcpy(fileNameBuffer, _roomFilenameTable[tableId]);
@@ -430,19 +430,19 @@ void KyraEngine_v1::startSceneScript(int brandonAlive) {
_scriptInterpreter->startScript(_scriptClick, 0);
_scriptClick->regs[0] = _currentCharacter->sceneId;
_scriptClick->regs[7] = brandonAlive;
-
+
while (_scriptInterpreter->validScript(_scriptClick))
_scriptInterpreter->runScript(_scriptClick);
}
void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) {
debugC(9, kDebugLevelMain, "KyraEngine_v1::initSceneData(%d, %d, %d)", facing, unk1, brandonAlive);
-
+
int16 xpos2 = 0;
int setFacing = 1;
-
+
int16 xpos = 0, ypos = 0;
-
+
if (_brandonPosX == -1 && _brandonPosY == -1) {
switch (facing + 1) {
case 0:
@@ -472,7 +472,7 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) {
default:
break;
}
-
+
if ((uint8)(_northExitHeight & 0xFF) + 2 >= ypos)
ypos = (_northExitHeight & 0xFF) + 4;
if (xpos >= 308)
@@ -482,12 +482,12 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) {
if (xpos <= 12)
xpos = 16;
}
-
+
if (_brandonPosX > -1)
xpos = _brandonPosX;
if (_brandonPosY > -1)
ypos = _brandonPosY;
-
+
int16 ypos2 = 0;
if (_brandonPosX > -1 && _brandonPosY > -1) {
switch (_currentCharacter->sceneId) {
@@ -555,9 +555,9 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) {
break;
}
}
-
+
_brandonPosX = _brandonPosY = -1;
-
+
if (unk1 && setFacing) {
ypos2 = ypos;
xpos2 = xpos;
@@ -582,7 +582,7 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) {
break;
}
}
-
+
xpos2 = (int16)(xpos2 & 0xFFFC);
ypos2 = (int16)(ypos2 & 0xFFFE);
xpos = (int16)(xpos & 0xFFFC);
@@ -592,12 +592,12 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) {
_currentCharacter->x2 = xpos;
_currentCharacter->y1 = ypos;
_currentCharacter->y2 = ypos;
-
+
initSceneObjectList(brandonAlive);
-
+
if (unk1 && brandonAlive == 0)
moveCharacterToPos(0, facing, xpos2, ypos2);
-
+
_scriptClick->regs[4] = _itemInHand;
_scriptClick->regs[7] = brandonAlive;
_scriptInterpreter->startScript(_scriptClick, 3);
@@ -609,9 +609,9 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
debugC(9, kDebugLevelMain, "KyraEngine_v1::initSceneObjectList(%d)", brandonAlive);
for (int i = 0; i < 28; ++i)
_animator->actors()[i].active = 0;
-
+
int startAnimFrame = 0;
-
+
AnimObject *curAnimState = _animator->actors();
curAnimState->active = 1;
curAnimState->drawY = _currentCharacter->y1;
@@ -624,10 +624,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
if (_scaleMode) {
curAnimState->x1 = _currentCharacter->x1;
curAnimState->y1 = _currentCharacter->y1;
-
+
_animator->_brandonScaleX = _scaleTable[_currentCharacter->y1];
_animator->_brandonScaleY = _scaleTable[_currentCharacter->y1];
-
+
curAnimState->x1 += (_animator->_brandonScaleX * xOffset) >> 8;
curAnimState->y1 += (_animator->_brandonScaleY * yOffset) >> 8;
} else {
@@ -641,10 +641,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
curAnimState->bkgdChangeFlag = 1;
_animator->clearQueue();
_animator->addObjectToQueue(curAnimState);
-
+
int listAdded = 0;
int addedObjects = 1;
-
+
for (int i = 1; i < 5; ++i) {
Character *ch = &_characterList[i];
curAnimState = &_animator->actors()[addedObjects];
@@ -655,7 +655,7 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
++addedObjects;
continue;
}
-
+
curAnimState->drawY = ch->y1;
curAnimState->sceneAnimPtr = _shapes[ch->currentAnimFrame];
curAnimState->animFrameNumber = ch->currentAnimFrame;
@@ -665,10 +665,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
if (_scaleMode) {
curAnimState->x1 = ch->x1;
curAnimState->y1 = ch->y1;
-
+
_animator->_brandonScaleX = _scaleTable[ch->y1];
_animator->_brandonScaleY = _scaleTable[ch->y1];
-
+
curAnimState->x1 += (_animator->_brandonScaleX * xOffset) >> 8;
curAnimState->y1 += (_animator->_brandonScaleY * yOffset) >> 8;
} else {
@@ -680,20 +680,20 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
curAnimState->active = 1;
curAnimState->refreshFlag = 1;
curAnimState->bkgdChangeFlag = 1;
-
+
if (ch->facing >= 1 && ch->facing <= 3)
curAnimState->flags |= 1;
else if (ch->facing >= 5 && ch->facing <= 7)
curAnimState->flags &= 0xFFFFFFFE;
-
+
_animator->addObjectToQueue(curAnimState);
-
+
++addedObjects;
++listAdded;
if (listAdded < 2)
i = 5;
}
-
+
for (int i = 0; i < 11; ++i) {
curAnimState = &_animator->sprites()[i];
@@ -715,9 +715,9 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
curAnimState->y1 = curAnimState->y2 = _sprites->_anims[i].y;
curAnimState->background = _sprites->_anims[i].background;
curAnimState->sceneAnimPtr = _sprites->_sceneShapes[_sprites->_anims[i].sprite];
-
+
curAnimState->disable = _sprites->_anims[i].disable;
-
+
if (_sprites->_anims[i].unk2)
curAnimState->flags = 0x800;
else
@@ -725,10 +725,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
if (_sprites->_anims[i].flipX)
curAnimState->flags |= 0x1;
-
+
_animator->addObjectToQueue(curAnimState);
}
-
+
for (int i = 0; i < 12; ++i) {
curAnimState = &_animator->items()[i];
Room *curRoom = &_roomTable[_currentCharacter->sceneId];
@@ -739,17 +739,17 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
curAnimState->animFrameNumber = (int16)0xFFFF;
curAnimState->y1 = curRoom->itemsYPos[i];
curAnimState->x1 = curRoom->itemsXPos[i];
-
+
curAnimState->x1 -= (_animator->fetchAnimWidth(curAnimState->sceneAnimPtr, _scaleTable[curAnimState->drawY])) >> 1;
curAnimState->y1 -= _animator->fetchAnimHeight(curAnimState->sceneAnimPtr, _scaleTable[curAnimState->drawY]);
-
+
curAnimState->x2 = curAnimState->x1;
curAnimState->y2 = curAnimState->y1;
-
+
curAnimState->active = 1;
curAnimState->refreshFlag = 1;
curAnimState->bkgdChangeFlag = 1;
-
+
_animator->addObjectToQueue(curAnimState);
} else {
curAnimState->active = 0;
@@ -757,7 +757,7 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) {
curAnimState->bkgdChangeFlag = 0;
}
}
-
+
_animator->preserveAnyChangedBackgrounds();
curAnimState = _animator->actors();
curAnimState->bkgdChangeFlag = 1;
@@ -839,7 +839,7 @@ void KyraEngine_v1::initSceneScreen(int brandonAlive) {
if (_currentCharacter->sceneId == 210) {
if (_itemInHand != -1)
magicOutMouseItem(2, -1);
-
+
_screen->hideMouse();
for (int i = 0; i < 10; ++i) {
if (_currentCharacter->inventoryItems[i] != 0xFF)
@@ -870,7 +870,7 @@ int KyraEngine_v1::handleSceneChange(int xpos, int ypos, int unk1, int frameRese
_pathfinderFlag = 13;
}
}
-
+
if (ypos <= (_northExitHeight&0xFF)+2) {
if (_roomTable[sceneId].northExit != 0xFFFF) {
xpos = _sceneExits.northXPos;
@@ -884,19 +884,19 @@ int KyraEngine_v1::handleSceneChange(int xpos, int ypos, int unk1, int frameRese
_pathfinderFlag = 11;
}
}
-
+
int temp = xpos - _currentCharacter->x1;
if (ABS(temp) < 4) {
temp = ypos - _currentCharacter->y1;
if (ABS(temp) < 2)
return 0;
}
-
+
int x = (int16)(_currentCharacter->x1 & 0xFFFC);
int y = (int16)(_currentCharacter->y1 & 0xFFFE);
xpos = (int16)(xpos & 0xFFFC);
ypos = (int16)(ypos & 0xFFFE);
-
+
int ret = findWay(x, y, xpos, ypos, _movFacingTable, 150);
_pathfinderFlag = 0;
@@ -950,23 +950,23 @@ int KyraEngine_v1::processSceneChange(int *table, int unk1, int frameReset) {
forceContinue = true;
break;
}
-
+
returnValue = changeScene(_currentCharacter->facing);
if (returnValue) {
running = false;
_abortWalkFlag = false;
}
-
+
if (unk1) {
if (_mousePressFlag) {
running = false;
_sceneChangeState = 1;
}
}
-
+
if (forceContinue || !running)
continue;
-
+
int temp = 0;
if (table == tableStart || table[1] == 8)
temp = setCharacterPosition(0, 0);
@@ -975,7 +975,7 @@ int KyraEngine_v1::processSceneChange(int *table, int unk1, int frameReset) {
if (temp)
++table;
-
+
nextFrame = _timer->getDelay(5) * _tickLength + _system->getMillis();
while (_system->getMillis() < nextFrame) {
_timer->update();
@@ -993,7 +993,7 @@ int KyraEngine_v1::processSceneChange(int *table, int unk1, int frameReset) {
delay(10, true);
}
}
-
+
if (frameReset && !(_brandonStatusBit & 2))
_currentCharacter->currentAnimFrame = 7;
@@ -1008,22 +1008,22 @@ int KyraEngine_v1::changeScene(int facing) {
if (_currentCharacter->sceneId == 5)
return 0;
}
-
+
int xpos = _charXPosTable[facing] + _currentCharacter->x1;
int ypos = _charYPosTable[facing] + _currentCharacter->y1;
-
+
if (xpos >= 12 && xpos <= 308) {
if (!lineIsPassable(xpos, ypos))
return false;
}
-
+
if (_exitListPtr) {
int16 *ptr = _exitListPtr;
// this loop should be only entered one time, seems to be some hack in the original
while (true) {
if (*ptr == -1)
break;
-
+
if (*ptr > _currentCharacter->x1 || _currentCharacter->y1 < ptr[1] || _currentCharacter->x1 > ptr[2] || _currentCharacter->y1 > ptr[3]) {
ptr += 10;
break;
@@ -1058,7 +1058,7 @@ int KyraEngine_v1::changeScene(int facing) {
break;
}
}
-
+
_currentCharacter->facing = facing;
_animator->animRefreshNPC(0);
_animator->updateAllObjectShapes();
@@ -1067,33 +1067,33 @@ int KyraEngine_v1::changeScene(int facing) {
return 1;
}
}
-
+
int returnValue = 0;
facing = 0;
-
+
if ((_northExitHeight & 0xFF) + 2 >= ypos || (_northExitHeight & 0xFF) + 2 >= _currentCharacter->y1) {
facing = 0;
returnValue = 1;
}
-
+
if (xpos >= 308 || (_currentCharacter->x1 + 4) >= 308) {
facing = 2;
returnValue = 1;
}
-
+
if (((_northExitHeight >> 8) & 0xFF) - 2 < ypos || ((_northExitHeight >> 8) & 0xFF) - 2 < _currentCharacter->y1) {
facing = 4;
returnValue = 1;
}
-
+
if (xpos <= 12 || _currentCharacter->y1 <= 12) {
facing = 6;
returnValue = 1;
}
-
+
if (!returnValue)
return 0;
-
+
uint16 sceneId = 0xFFFF;
switch (facing) {
case 0:
@@ -1112,7 +1112,7 @@ int KyraEngine_v1::changeScene(int facing) {
sceneId = _roomTable[_currentCharacter->sceneId].westExit;
break;
}
-
+
if (sceneId == 0xFFFF)
return 0;
@@ -1127,7 +1127,7 @@ void KyraEngine_v1::setCharactersInDefaultScene() {
{ 0xFFFF, 0x001D, 0x0021, 0xFFFF },
{ 0xFFFF, 0x0000, 0x0000, 0xFFFF }
};
-
+
for (int i = 1; i < 5; ++i) {
Character *cur = &_characterList[i];
//cur->field_20 = 0;
@@ -1178,49 +1178,49 @@ bool KyraEngine_v1::lineIsPassable(int x, int y) {
if (_currentCharacter->sceneId == 5)
return true;
}
-
+
if (_pathfinderFlag & 2) {
if (x >= 312)
return false;
}
-
+
if (_pathfinderFlag & 4) {
if (y >= 136)
return false;
}
-
+
if (_pathfinderFlag & 8) {
if (x < 8)
return false;
}
-
+
if (_pathfinderFlag2) {
if (x <= 8 || x >= 312)
return true;
if (y < (_northExitHeight & 0xFF) || y > 135)
return true;
}
-
+
if (y > 137)
return false;
if (y < 0)
y = 0;
-
+
int ypos = 8;
if (_scaleMode) {
ypos = (_scaleTable[y] >> 5) + 1;
if (8 < ypos)
ypos = 8;
}
-
+
x -= (ypos >> 1);
-
+
int xpos = x;
int xtemp = xpos + ypos - 1;
if (x < 0)
xpos = 0;
-
+
if (xtemp > 319)
xtemp = 319;
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index b9ed041206..63664c91d8 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#include "kyra/kyra_v2.h"
#include "kyra/screen_v2.h"
#include "kyra/sound.h"
@@ -45,12 +45,12 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
}
_screen->hideMouse();
-
+
if (!unk3) {
//updateSpecialItems();
//displayInvWsaLastFrame();
}
-
+
if (unk1) {
int x = _mainCharacter.x1;
int y = _mainCharacter.y1;
@@ -71,60 +71,60 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
case 6:
x = -16;
break;
-
+
default:
break;
}
-
+
moveCharacter(facing, x, y);
}
-
+
bool newSoundFile = false;
if (_sceneList[newScene].sound != _lastMusicCommand) {
newSoundFile = true;
//XXX
_sound->beginFadeOut();
}
-
+
_unkFlag1 = false;
-
+
if (!unk3) {
_scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData);
_scriptInterpreter->startScript(&_sceneScriptState, 5);
while (_scriptInterpreter->validScript(&_sceneScriptState))
_scriptInterpreter->runScript(&_sceneScriptState);
}
-
+
Common::for_each(_wsaSlots, _wsaSlots+ARRAYSIZE(_wsaSlots), Common::mem_fun(&WSAMovieV2::close));
_specialExitCount = 0;
memset(_specialExitTable, -1, sizeof(_specialExitTable));
-
+
_mainCharacter.sceneId = newScene;
_sceneList[newScene].flags &= ~1;
loadScenePal();
unloadScene();
loadSceneMsc();
-
+
SceneDesc &scene = _sceneList[newScene];
_sceneExit1 = scene.exit1;
_sceneExit2 = scene.exit2;
_sceneExit3 = scene.exit3;
_sceneExit4 = scene.exit4;
-
+
if (newSoundFile) {
//XXX while (snd_isPlaying()) ;
snd_loadSoundFile(_sceneList[newScene].sound);
}
-
+
startSceneScript(unk3);
-
+
if (_overwriteSceneFacing) {
facing = _mainCharacter.facing;
_overwriteSceneFacing = false;
}
-
+
enterNewSceneUnk1(facing, unk2, unk3);
-
+
setTimer1DelaySecs(-1);
_sceneScriptState.regs[3] = 1;
enterNewSceneUnk2(unk3);
@@ -139,34 +139,34 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
int x = 0, y = 0;
int x2 = 0, y2 = 0;
bool needProc = true;
-
+
if (_mainCharX == -1 && _mainCharY == -1) {
switch (facing+1) {
case 1: case 2: case 8:
x2 = _sceneEnterX3;
y2 = _sceneEnterY3;
break;
-
+
case 3:
x2 = _sceneEnterX4;
y2 = _sceneEnterY4;
break;
-
+
case 4: case 5: case 6:
x2 = _sceneEnterX1;
y2 = _sceneEnterY1;
break;
-
+
case 7:
x2 = _sceneEnterX2;
y2 = _sceneEnterY2;
break;
-
+
default:
x2 = y2 = -1;
break;
}
-
+
if (x2 >= 316)
x2 = 312;
if (y2 >= 141)
@@ -174,45 +174,45 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
if (x2 <= 4)
x2 = 8;
}
-
+
if (_mainCharX >= 0) {
x = x2 = _mainCharX;
needProc = false;
}
-
+
if (_mainCharY >= 0) {
y = y2 = _mainCharY;
needProc = false;
}
-
+
_mainCharX = _mainCharY = -1;
-
+
if (unk1 && needProc) {
x = x2;
y = y2;
-
+
switch (facing) {
case 0:
y2 = 147;
break;
-
+
case 2:
x2 = -16;
break;
-
+
case 4:
y2 = y - 4;
break;
-
+
case 6:
x2 = 335;
break;
-
+
default:
break;
}
}
-
+
x2 &= ~3;
x &= ~3;
y2 &= ~1;
@@ -222,17 +222,17 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
_mainCharacter.x1 = _mainCharacter.x2 = x2;
_mainCharacter.y1 = _mainCharacter.y2 = y2;
initSceneAnims(unk2);
-
+
if (!unk2)
snd_playWanderScoreViaMap(_sceneList[_mainCharacter.sceneId].sound, 0);
-
+
if (unk1 && !unk2 && _mainCharacter.animFrame != 32)
moveCharacter(facing, x, y);
}
void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
_unk3 = -1;
-
+
if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 &&
!queryGameFlag(0x1F1) && !queryGameFlag(0x192) && !queryGameFlag(0x193) &&
_mainCharacter.sceneId != 70 && !queryGameFlag(0x159) && _mainCharacter.sceneId != 37) {
@@ -240,12 +240,12 @@ void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
updateCharacterAnim(0);
refreshAnimObjectsIfNeed();
}
-
+
if (!unk1) {
runSceneScript4(0);
//XXX sub_27158
}
-
+
_unk4 = 0;
_unk3 = -1;
}
@@ -269,12 +269,12 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) {
unkFlag = false;
}
}
-
+
if (checkSceneChange()) {
running = false;
changedScene = 1;
}
-
+
if (unk1) {
// TODO: check this again
int inputFlag = checkInput(0/*dword_324C5*/);
@@ -283,7 +283,7 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) {
_unk4 = 1;
}
}
-
+
if (!unkFlag || !running)
continue;
@@ -304,13 +304,13 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) {
updateType = -1;
}
}
-
+
if (updateChar)
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
-
+
updateCharacterAnim(0);
refreshAnimObjectsIfNeed();
-
+
if (!changedScene && !_unk4) {
//XXX
}
@@ -322,7 +322,7 @@ int KyraEngine_v2::checkSceneChange() {
int charX = _mainCharacter.x1, charY = _mainCharacter.y1;
int facing = 0;
int process = 0;
-
+
if (_screen->getLayer(charX, charY) == 1 && _unk3 == -6) {
facing = 0;
process = 1;
@@ -336,36 +336,36 @@ int KyraEngine_v2::checkSceneChange() {
facing = 6;
process = 1;
}
-
+
if (!process)
return 0;
-
+
uint16 newScene = 0xFFFF;
switch (facing) {
case 0:
newScene = curScene.exit1;
break;
-
+
case 2:
newScene = curScene.exit2;
break;
-
+
case 4:
newScene = curScene.exit3;
break;
-
+
case 6:
newScene = curScene.exit4;
break;
-
+
default:
newScene = _mainCharacter.sceneId;
break;
}
-
+
if (newScene == 0xFFFF)
return 0;
-
+
enterNewScene(newScene, facing, 1, 1, 0);
return 1;
}
@@ -379,7 +379,7 @@ void KyraEngine_v2::unloadScene() {
void KyraEngine_v2::loadScenePal() {
uint16 sceneId = _mainCharacter.sceneId;
memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
-
+
char filename[14];
strcpy(filename, _sceneList[sceneId].filename);
strcat(filename, ".COL");
@@ -400,10 +400,10 @@ void KyraEngine_v2::loadSceneMsc() {
void KyraEngine_v2::startSceneScript(int unk1) {
uint16 sceneId = _mainCharacter.sceneId;
char filename[14];
-
+
strcpy(filename, _sceneList[sceneId].filename);
if (sceneId == 68 && (queryGameFlag(0x1BC) || queryGameFlag(0x1DC)))
- strcpy(filename, "DOORX");
+ strcpy(filename, "DOORX");
strcat(filename, ".CPS");
_screen->loadBitmap(filename, 3, 3, 0);
@@ -421,18 +421,18 @@ void KyraEngine_v2::startSceneScript(int unk1) {
_sceneEnterY3 = 128;
_sceneEnterX4 = 24;
_sceneEnterY4 = 72;
-
+
_sceneCommentString = "Undefined scene comment string!";
_scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData);
-
+
strcpy(filename, _sceneList[sceneId].filename);
strcat(filename, ".");
strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]);
-
+
assert(_res->getFileSize(filename));
_scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes);
runSceneScript7();
-
+
_scriptInterpreter->startScript(&_sceneScriptState, 0);
_sceneScriptState.regs[0] = sceneId;
_sceneScriptState.regs[5] = unk1;
@@ -440,13 +440,13 @@ void KyraEngine_v2::startSceneScript(int unk1) {
_scriptInterpreter->runScript(&_sceneScriptState);
memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080);
-
+
for (int i = 0; i < 10; ++i) {
_scriptInterpreter->initScript(&_sceneSpecialScripts[i], &_sceneScriptData);
_scriptInterpreter->startScript(&_sceneSpecialScripts[i], i+8);
_sceneSpecialScriptsTimer[i] = 0;
}
-
+
_sceneEnterX1 &= ~3;
_sceneEnterX2 &= ~3;
_sceneEnterX3 &= ~3;
@@ -461,7 +461,7 @@ void KyraEngine_v2::runSceneScript2() {
_scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData);
_sceneScriptState.regs[4] = _itemInHand;
_scriptInterpreter->startScript(&_sceneScriptState, 2);
-
+
while (_scriptInterpreter->validScript(&_sceneScriptState))
_scriptInterpreter->runScript(&_sceneScriptState);
}
@@ -491,7 +491,7 @@ void KyraEngine_v2::runSceneScript6() {
void KyraEngine_v2::runSceneScript7() {
int oldPage = _screen->_curPage;
_screen->_curPage = 2;
-
+
_scriptInterpreter->startScript(&_sceneScriptState, 7);
while (_scriptInterpreter->validScript(&_sceneScriptState))
_scriptInterpreter->runScript(&_sceneScriptState);
@@ -502,32 +502,32 @@ void KyraEngine_v2::runSceneScript7() {
void KyraEngine_v2::initSceneAnims(int unk1) {
for (int i = 0; i < ARRAYSIZE(_animObjects); ++i)
_animObjects[i].enabled = 0;
-
+
bool animInit = false;
-
+
AnimObj *animState = &_animObjects[0];
-
+
if (_mainCharacter.animFrame != 32)
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
-
+
animState->enabled = 1;
animState->xPos1 = _mainCharacter.x1;
animState->yPos1 = _mainCharacter.y1;
animState->shapePtr = _defaultShapeTable[_mainCharacter.animFrame];
animState->shapeIndex1 = animState->shapeIndex2 = _mainCharacter.animFrame;
-
+
int frame = _mainCharacter.animFrame - 9;
int shapeX = _shapeDescTable[frame].xAdd;
int shapeY = _shapeDescTable[frame].yAdd;
-
+
animState->xPos2 = _mainCharacter.x1;
animState->yPos2 = _mainCharacter.y1;
-
+
_charScaleX = _charScaleY = getScale(_mainCharacter.x1, _mainCharacter.y1);
-
+
int shapeXScaled = (shapeX * _charScaleX) >> 8;
int shapeYScaled = (shapeY * _charScaleY) >> 8;
-
+
animState->xPos2 += shapeXScaled;
animState->yPos2 += shapeYScaled;
animState->xPos3 = animState->xPos2;
@@ -536,39 +536,39 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
animState->unk8 = 1;
_animList = 0;
-
+
AnimObj *charAnimState = animState;
-
+
for (int i = 0; i < 10; ++i) {
animState = &_animObjects[i+1];
animState->enabled = 0;
animState->needRefresh = 0;
animState->unk8 = 0;
-
+
if (_sceneAnims[i].flags & 1) {
animState->enabled = 1;
animState->needRefresh = 1;
animState->unk8 = 1;
}
-
+
animState->animFlags = _sceneAnims[i].flags & 8;
-
+
if (_sceneAnims[i].flags & 2)
animState->flags = 0x800;
else
animState->flags = 0;
-
+
if (_sceneAnims[i].flags & 4)
animState->flags |= 1;
-
+
animState->xPos1 = _sceneAnims[i].x;
animState->yPos1 = _sceneAnims[i].y;
-
+
if (_sceneAnims[i].flags & 0x20)
animState->shapePtr = _sceneShapeTable[_sceneAnims[i].shapeIndex];
else
animState->shapePtr = 0;
-
+
if (_sceneAnims[i].flags & 0x40) {
animState->shapeIndex3 = _sceneAnims[i].shapeIndex;
animState->animNum = i;
@@ -576,15 +576,15 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
animState->shapeIndex3 = 0xFFFF;
animState->animNum = 0xFFFF;
}
-
+
animState->shapeIndex2 = 0xFFFF;
-
+
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;
-
+
if (_sceneAnims[i].flags & 1) {
if (animInit) {
_animList = addToAnimListSorted(_animList, animState);
@@ -594,17 +594,17 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
}
}
}
-
+
if (animInit) {
_animList = addToAnimListSorted(_animList, charAnimState);
} else {
_animList = initAnimList(_animList, charAnimState);
animInit = true;
}
-
+
for (int i = 0; i < 30; ++i) {
animState = &_animObjects[i+11];
-
+
uint16 shapeIndex = _itemList[i].id;
if (shapeIndex == 0xFFFF || _itemList[i].sceneId != _mainCharacter.sceneId) {
animState->enabled = 0;
@@ -615,21 +615,21 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
animState->yPos1 = _itemList[i].y;
animState->shapePtr = _defaultShapeTable[64+shapeIndex];
animState->shapeIndex1 = animState->shapeIndex2 = shapeIndex+64;
-
+
animState->xPos2 = _itemList[i].x;
animState->yPos2 = _itemList[i].y;
int objectScale = getScale(animState->xPos2, animState->yPos2);
-
+
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;
-
+
animState->enabled = 1;
animState->needRefresh = 1;
animState->unk8 = 1;
-
+
if (animInit) {
_animList = addToAnimListSorted(_animList, animState);
} else {
@@ -638,17 +638,17 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
}
}
}
-
+
_animObjects[0].unk8 = 1;
_animObjects[0].needRefresh = 1;
-
+
for (int i = 1; i < 41; ++i) {
if (_animObjects[i].enabled) {
_animObjects[i].needRefresh = 1;
_animObjects[i].unk8 = 1;
}
}
-
+
restorePage3();
drawAnimObjects();
_screen->hideMouse();
@@ -686,23 +686,23 @@ void KyraEngine_v2::updateSpecialSceneScripts() {
const int startScript = _lastProcessedSceneScript;
while (_system->getMillis() <= nextTime) {
- if (_sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis() &&
+ if (_sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis() &&
!_specialSceneScriptState[_lastProcessedSceneScript]) {
_specialSceneScriptRunFlag = true;
-
+
while (_specialSceneScriptRunFlag && _sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis())
_specialSceneScriptRunFlag = _scriptInterpreter->runScript(&_sceneSpecialScripts[_lastProcessedSceneScript]) != 0;
}
-
+
if (!_scriptInterpreter->validScript(&_sceneSpecialScripts[_lastProcessedSceneScript])) {
_scriptInterpreter->startScript(&_sceneSpecialScripts[_lastProcessedSceneScript], 8+_lastProcessedSceneScript);
_specialSceneScriptRunFlag = false;
}
-
+
++_lastProcessedSceneScript;
if (_lastProcessedSceneScript >= 10)
_lastProcessedSceneScript = 0;
-
+
if (_lastProcessedSceneScript == startScript)
return;
}
@@ -743,22 +743,22 @@ bool KyraEngine_v2::lineIsPassable(int x, int y) {
if (x >= 320)
return false;
}
-
+
if (_pathfinderFlag & 4) {
if (y >= 144)
return false;
}
-
+
if (_pathfinderFlag & 8) {
if (x < 0)
return false;
}
-
+
if (y > 143)
return false;
int unk1 = unkTable[getScale(x, y) >> 5];
-
+
if (y < 0)
y = 0;
x -= unk1 >> 1;
@@ -767,7 +767,7 @@ bool KyraEngine_v2::lineIsPassable(int x, int y) {
int x2 = x + unk1;
if (x2 > 320)
x2 = 320;
-
+
for (;x < x2; ++x)
if (!_screen->getShapeFlag1(x, y))
return false;
@@ -793,15 +793,15 @@ int KyraEngine_v2::pathfinderUnk1(int *moveTable) {
int oldX = 0, newX = 0, oldY = 0, newY = 0;
int lastEntry = 0;
lastEntry = pathfinderUnk2(lastEntry, 0, 0);
-
+
while (*moveTableCur != 8) {
oldEntry = curEntry;
-
+
while (true) {
curEntry = *moveTableCur;
if (curEntry >= 0 && curEntry <= 7)
break;
-
+
if (curEntry == 8) {
breakLoop = true;
break;
@@ -809,27 +809,27 @@ int KyraEngine_v2::pathfinderUnk1(int *moveTable) {
++moveTableCur;
}
}
-
+
if (breakLoop)
break;
-
+
oldX = newX;
oldY = newY;
-
+
newX += _addXPosTable[curEntry];
newY += _addYPosTable[curEntry];
-
+
int temp = ABS(curEntry - oldEntry);
if (temp > 4) {
temp = 8 - temp;
}
-
+
if (temp > 1 || oldEntry != curEntry)
lastEntry = pathfinderUnk2(lastEntry, oldX, oldY);
-
+
++moveTableCur;
}
-
+
lastEntry = pathfinderUnk2(lastEntry, newX, newY);
_pathfinderUnkTable1[lastEntry*2+0] = -1;
_pathfinderUnkTable1[lastEntry*2+1] = -1;
@@ -855,7 +855,7 @@ int KyraEngine_v2::pathfinderUnk3(int tableLen, int x, int y) {
y1 = _pathfinderUnkTable1[index1*2+1] + y;
x2 = _pathfinderUnkTable1[index2*2+0] + x;
y2 = _pathfinderUnkTable1[index2*2+0] + x;
-
+
if (directLinePassable(x1, y1, x2, y2)) {
lastEntry = pathfinderUnk4(lastEntry, index2);
if (tableLen-1 == index2)
@@ -892,7 +892,7 @@ void KyraEngine_v2::pathfinderUnk5(int *moveTable, int tableLen, int x, int y, i
y1 = _pathfinderUnkTable1[index1*2+1] + y;
x2 = _pathfinderUnkTable1[index2*2+0] + x;
y2 = _pathfinderUnkTable1[index2*2+0] + x;
-
+
int wayLen = findWay(x1, y1, x2, y2, moveTable, sizeLeft);
moveTable += wayLen;
sizeLeft -= wayLen; // unlike the original we want to be sure that the size left is correct
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index c5cd09756f..546ab6f6a5 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -589,7 +589,7 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
if (x < 0) {
dest += -x;
- w += x;
+ w += x;
x = 0;
} else if (x + w > SCREEN_W) {
w = SCREEN_W - x;
@@ -627,7 +627,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
if (x < 0) {
src += -x;
- w += x;
+ w += x;
x = 0;
} else if (x + w > SCREEN_W) {
w = SCREEN_W - x;
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 3808087a4b..0c9bc98b1c 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -85,7 +85,7 @@ public:
DSF_WND_COORDS = 0x10,
DSF_CENTER = 0x20
};
-
+
enum FontId {
FID_6_FNT = 0,
FID_8_FNT,
@@ -95,7 +95,7 @@ public:
FID_GOLDFONT_FNT,
FID_NUM
};
-
+
Screen(KyraEngine *vm, OSystem *system);
virtual ~Screen();
@@ -181,7 +181,7 @@ public:
// mouse handling
void hideMouse();
void showMouse();
- void setMouseCursor(int x, int y, byte *shape);
+ void setMouseCursor(int x, int y, byte *shape);
// rect handling
virtual int getRectSize(int w, int h);
@@ -191,7 +191,7 @@ public:
void addBitBlitRect(int x, int y, int w, int h);
void bitBlitRects();
- // misc
+ // misc
void loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData);
void loadPalette(const char *filename, uint8 *palData);
@@ -200,10 +200,10 @@ public:
void setAnimBlockPtr(int size);
void setShapePages(int page1, int page2);
-
+
byte getShapeFlag1(int x, int y);
byte getShapeFlag2(int x, int y);
-
+
void savePageToDisk(const char *file, int page);
void loadPageFromDisk(const char *file, int page);
void deletePageFromDisk(int page);
@@ -227,7 +227,7 @@ public:
bool _disableScreen;
const ScreenDim *_curDim;
-
+
static const ScreenDim _screenDimTable[];
static const int _screenDimTableCount;
@@ -298,19 +298,19 @@ protected:
int _animBlockSize;
int _mouseLockCount;
-
+
Rect *_bitBlitRects;
int _bitBlitNum;
uint8 *_unkPtr1, *_unkPtr2;
-
+
enum {
kMaxDirtyRects = 50
};
-
+
bool _forceFullUpdate;
int _numDirtyRects;
Rect *_dirtyRects;
-
+
void addDirtyRect(int x, int y, int w, int h);
OSystem *_system;
diff --git a/engines/kyra/screen_v1.h b/engines/kyra/screen_v1.h
index f6133db49d..5354e870fa 100644
--- a/engines/kyra/screen_v1.h
+++ b/engines/kyra/screen_v1.h
@@ -22,10 +22,10 @@
* $Id$
*
*/
-
+
#ifndef KYRA_SCREEN_V1_H
#define KYRA_SCREEN_V1_H
-
+
#include "kyra/screen.h"
namespace Kyra {
@@ -36,9 +36,9 @@ class Screen_v1 : public Screen {
public:
Screen_v1(KyraEngine_v1 *vm, OSystem *system);
virtual ~Screen_v1();
-
+
void fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime);
-
+
protected:
KyraEngine_v1 *_vm;
};
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index 6060ac0498..a3a415c1d7 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -125,7 +125,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
cdm.w <<= 3;
int na = 0, nb = 0, nc = w2;
-
+
if (!calcBounds(cdm.w, cdm.h, x2, y2, w2, h2, na, nb, nc))
return;
@@ -140,7 +140,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
u = t;
uint8 * s = src + (x1 + t) * 320;
uint8 * dt = (uint8*) _wsaFrameAnimBuffer;
-
+
t = w2 - w1;
if (!t) {
memcpy(dt, s, w2);
@@ -158,7 +158,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
cnt++;
}
memset(dt, *s++, cnt);
- dt += cnt;
+ dt += cnt;
}
}
} else {
@@ -181,7 +181,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
}
memcpy(dst + x2 + cdm.sx, _wsaFrameAnimBuffer + na, w2);
dst += 320;
- } while (++nb < h2);
+ } while (++nb < h2);
}
void Screen_v2::cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage, int dstW,
@@ -212,7 +212,7 @@ void Screen_v2::cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int
uint8 * dst = getPagePtr(dstPage) + dstW * (Y2 + r2);
uint8 * cmp = getPagePtr(cmpPage);
- while (H2--) {
+ while (H2--) {
uint8 * s = src + r4 + X1;
uint8 * d = dst + r1 + X2;
@@ -230,7 +230,7 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i
x2 = 0;
y2 = 0;
w2 = w1;
-
+
int t = x1 + w1;
if (t < 1) {
w1 = h1 = -1;
diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h
index 654ee6f99f..6931f5e4d4 100644
--- a/engines/kyra/screen_v2.h
+++ b/engines/kyra/screen_v2.h
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#ifndef KYRA_SCREEN_V2_H
#define KYRA_SCREEN_V2_H
@@ -37,10 +37,10 @@ friend class Debugger_v2;
public:
Screen_v2(KyraEngine_v2 *vm, OSystem *system);
virtual ~Screen_v2();
-
+
virtual void setScreenDim(int dim);
const ScreenDim *getScreenDim(int dim);
-
+
// sequence player
void generateGrayOverlay(const uint8 *srcPal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool flag);
void applyGrayOverlay(int x, int y, int w, int h, int pageNum, const uint8 *grayOverlay);
@@ -50,30 +50,30 @@ public:
int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim);
void cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage,
int dstW, int dstH, int dstX, int dstY, int cmpW, int cmpH, int cmpPage);
-
+
// screen page handling
void copyWsaRect(int x, int y, int w, int h, int dimState, int plotFunc, const uint8 *src,
int unk1, const uint8 *unkPtr1, const uint8 *unkPtr2);
-
+
// shape handling
uint8 *getPtrToShape(uint8 *shpFile, int shape);
const uint8 *getPtrToShape(const uint8 *shpFile, int shape);
-
+
int getShapeScaledWidth(const uint8 *shpFile, int scale);
int getShapeScaledHeight(const uint8 *shpFile, int scale);
uint16 getShapeSize(const uint8 *shp);
-
+
uint8 *makeShapeCopy(const uint8 *src, int index);
-
+
void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...);
-
+
// rect handling
virtual int getRectSize(int w, int h);
-
+
// layer handling
int getLayer(int x, int y);
-
+
// mouse handling
bool isMouseVisible() const;
@@ -81,12 +81,12 @@ public:
void setTextColorMap(const uint8 *cmap);
private:
KyraEngine_v2 *_vm;
-
+
static const ScreenDim _screenDimTable[];
static const int _screenDimTableCount;
uint8 *_wsaFrameAnimBuffer;
-
+
// maybe subclass screen for kyra3
static const ScreenDim _screenDimTableK3[];
static const int _screenDimTableCountK3;
diff --git a/engines/kyra/script.h b/engines/kyra/script.h
index 244547b372..ce59d8ee29 100644
--- a/engines/kyra/script.h
+++ b/engines/kyra/script.h
@@ -64,12 +64,12 @@ struct ScriptState {
class ScriptFileParser {
public:
ScriptFileParser() : _scriptFile(), _startOffset(0), _endOffset(0) {}
- ScriptFileParser(const char *filename, Resource *res) : _scriptFile(), _startOffset(0), _endOffset(0) { setFile(filename, res); }
+ ScriptFileParser(const char *filename, Resource *res) : _scriptFile(), _startOffset(0), _endOffset(0) { setFile(filename, res); }
~ScriptFileParser() { destroy(); }
-
+
// 'script' must be allocated with new!
void setFile(const char *filename, Resource *res);
-
+
operator bool() const { return (_startOffset != _endOffset) && _scriptFile.isOpen(); }
uint32 getFORMBlockSize();
@@ -86,15 +86,15 @@ private:
class ScriptHelper {
public:
ScriptHelper(KyraEngine *vm);
-
+
bool loadScript(const char *filename, ScriptData *data, const Common::Array<const Opcode*> *opcodes);
void unloadScript(ScriptData *data);
-
+
void initScript(ScriptState *scriptState, const ScriptData *data);
bool startScript(ScriptState *script, int function);
-
+
bool validScript(ScriptState *script);
-
+
bool runScript(ScriptState *script);
protected:
KyraEngine *_vm;
@@ -106,7 +106,7 @@ protected:
CommandProc proc;
const char *desc;
};
-
+
const CommandEntry *_commands;
private:
void cmd_jmpTo(ScriptState*);
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 190177fcb1..9f3de9484a 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -110,7 +110,7 @@ int KyraEngine_v2::o2_setCharacterAnimFrame(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setCharacterAnimFrame(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2));
int animFrame = stackPos(1);
int updateAnim = stackPos(2);
-
+
_mainCharacter.animFrame = animFrame;
if (updateAnim)
updateCharacterAnim(0);
@@ -162,7 +162,7 @@ int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) {
int doUpdate = stackPos(6);
int dstPage = stackPos(7);
int backUp = stackPos(8);
-
+
_screen->hideMouse();
uint32 endTime = _system->getMillis() + waitTime * _tickLength;
_wsaSlots[slot]->setX(x);
@@ -170,18 +170,18 @@ int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) {
_wsaSlots[slot]->setDrawPage(dstPage);
_wsaSlots[slot]->displayFrame(frame, copyParam | 0xC000);
_screen->updateScreen();
-
+
if (backUp)
memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080);
while (_system->getMillis() < endTime) {
if (doUpdate)
update();
-
+
if (endTime - _system->getMillis() >= 10)
delay(10);
}
- _screen->showMouse();
+ _screen->showMouse();
return 0;
}
@@ -196,14 +196,14 @@ int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) {
int slot = stackPos(5);
int maxTimes = stackPos(6);
int copyFlags = stackPos(7);
-
+
if (maxTimes > 1)
maxTimes = 1;
-
+
_wsaSlots[slot]->setX(x);
_wsaSlots[slot]->setY(y);
_wsaSlots[slot]->setDrawPage(0);
-
+
_screen->hideMouse();
int curTime = 0;
while (curTime < maxTimes) {
@@ -212,7 +212,7 @@ int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) {
uint32 endTime = _system->getMillis() + waitTime * _tickLength;
_wsaSlots[slot]->displayFrame(i, 0xC000 | copyFlags);
_screen->updateScreen();
-
+
do {
update();
@@ -257,7 +257,7 @@ int KyraEngine_v2::o2_defineItem(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3));
int freeItem = findFreeItem();
-
+
if (freeItem >= 0) {
_itemList[freeItem].id = stackPos(0);
_itemList[freeItem].x = stackPos(1);
@@ -280,7 +280,7 @@ int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) {
if (_itemInHand == int16(item))
++count;
-
+
return count;
}
@@ -386,9 +386,9 @@ int KyraEngine_v2::o2_drawSceneShape(ScriptState *script) {
_screen->hideMouse();
restorePage3();
-
+
_screen->drawShape(2, _sceneShapeTable[shape], x, y, 2, flag);
-
+
memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080);
_screen->drawShape(0, _sceneShapeTable[shape], x, y, 2, flag);
@@ -442,7 +442,7 @@ int KyraEngine_v2::o2_update(ScriptState *script) {
update();
}
- return 0;
+ return 0;
}
int KyraEngine_v2::o2_fadeScenePal(ScriptState *script) {
@@ -461,7 +461,7 @@ int KyraEngine_v2::o2_enterNewSceneEx(ScriptState *script) {
runSceneScript4(0);
_unk5 = 1;
-
+
if (_mainCharX == -1 || _mainCharY == -1) {
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
@@ -545,22 +545,22 @@ int KyraEngine_v2::o2_defineRoomEntrance(ScriptState *script) {
_sceneEnterX1 = stackPos(1);
_sceneEnterY1 = stackPos(2);
break;
-
+
case 1:
_sceneEnterX2 = stackPos(1);
_sceneEnterY2 = stackPos(2);
break;
-
+
case 2:
_sceneEnterX3 = stackPos(1);
_sceneEnterY3 = stackPos(2);
break;
-
+
case 3:
_sceneEnterX4 = stackPos(1);
_sceneEnterY4 = stackPos(2);
break;
-
+
default:
break;
}
@@ -601,17 +601,17 @@ int KyraEngine_v2::o2_defineSceneAnim(ScriptState *script) {
anim.shapeIndex = stackPos(11);
if (stackPosString(12) != 0)
strcpy(anim.filename, stackPosString(12));
-
+
if (anim.flags & 0x40) {
if (!_sceneAnimMovie[animId]->open(anim.filename, 1, 0))
error("couldn't load '%s'", anim.filename);
-
+
if (_sceneAnimMovie[animId]->xAdd() || _sceneAnimMovie[animId]->yAdd())
anim.wsaFlag = 1;
else
anim.wsaFlag = 0;
}
-
+
return 0;
}
@@ -633,7 +633,7 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) {
scene->exit4 = stackPos(5);
scene->flags = stackPos(6);
scene->sound = stackPos(7);
-
+
if (_mainCharacter.sceneId == stackPos(0)) {
_sceneExit1 = scene->exit1;
_sceneExit2 = scene->exit2;
@@ -661,7 +661,7 @@ int KyraEngine_v2::o2_countItemInstances(ScriptState *script) {
if (_itemList[i].id == item)
++count;
}
-
+
if (_hiddenItems[0] == item && _newChapterFile == 1)
++count;
if (_hiddenItems[1] == item && _newChapterFile == 1)
diff --git a/engines/kyra/seqplayer.h b/engines/kyra/seqplayer.h
index 4636a956e9..ce7f4648df 100644
--- a/engines/kyra/seqplayer.h
+++ b/engines/kyra/seqplayer.h
@@ -43,7 +43,7 @@ public:
void freeHandShapes();
bool playSequence(const uint8 *seqData, bool skipSeq);
-
+
uint8 *setPanPages(int pageNum, int shape);
protected:
KyraEngine_v1 *_vm;
diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp
index 6b4516bbd8..785b0b3aed 100644
--- a/engines/kyra/sequences_v1.cpp
+++ b/engines/kyra/sequences_v1.cpp
@@ -59,7 +59,7 @@ void KyraEngine_v1::seq_demo() {
_screen->copyRegion(0, 0, 0, 111, 320, 64, 6, 0);
_screen->updateScreen();
_screen->fadeFromBlack();
-
+
_seq->playSequence(_seq_WestwoodLogo, true);
delay(60 * _tickLength);
_seq->playSequence(_seq_KyrandiaLogo, true);
@@ -95,7 +95,7 @@ void KyraEngine_v1::seq_intro() {
if (_flags.isTalkie)
_res->loadPakFile("INTRO.VRM");
-
+
static const IntroProc introProcTable[] = {
&KyraEngine_v1::seq_introLogos,
&KyraEngine_v1::seq_introStory,
@@ -145,7 +145,7 @@ void KyraEngine_v1::seq_introLogos() {
}
_screen->clearPage(0);
-
+
if (_flags.platform == Common::kPlatformAmiga) {
_screen->loadPalette("INTRO.PAL", _screen->_currentPalette);
_screen->loadBitmap("BOTTOM.CPS", 3, 5, 0);
@@ -163,7 +163,7 @@ void KyraEngine_v1::seq_introLogos() {
_screen->_curPage = 0;
_screen->updateScreen();
_screen->fadeFromBlack();
-
+
if (_seq->playSequence(_seq_WestwoodLogo, _skipFlag) || _quitFlag) {
_screen->fadeToBlack();
_screen->clearPage(0);
@@ -266,7 +266,7 @@ void KyraEngine_v1::seq_introStory() {
const int x2 = (Screen::SCREEN_W - _screen->getTextWidth(_seq_textsTable[19])) / 2;
const int y1 = 175;
const int y2 = 184;
-
+
uint8 colorMap[] = { 0, 15, 12, 12 };
_screen->setTextColor(colorMap, 0, 3);
@@ -327,26 +327,26 @@ void KyraEngine_v1::seq_createAmuletJewel(int jewel, int page, int noSound, int
_screen->updateScreen();
delayWithTicks(3);
}
-
+
const uint16 *opcodes = 0;
switch (jewel - 1) {
case 0:
opcodes = specialJewelTable1;
break;
-
+
case 1:
opcodes = specialJewelTable2;
break;
-
+
case 2:
opcodes = specialJewelTable3;
break;
-
+
case 3:
opcodes = specialJewelTable4;
break;
}
-
+
if (opcodes) {
for (int i = 0; opcodes[i] != 0xFFFF; ++i) {
_screen->drawShape(page, _shapes[opcodes[i]], _amuletX2[jewel], _amuletY2[jewel], 0, 0);
@@ -444,31 +444,31 @@ void KyraEngine_v1::seq_poisonDeathNowAnim() {
assert(_posionDeathShapeTable);
setupShapes123(_posionDeathShapeTable, 20, 0);
_animator->setBrandonAnimSeqSize(8, 48);
-
+
_currentCharacter->currentAnimFrame = 124;
_animator->animRefreshNPC(0);
delayWithTicks(30);
-
+
_currentCharacter->currentAnimFrame = 123;
_animator->animRefreshNPC(0);
delayWithTicks(30);
-
+
for (int i = 125; i <= 139; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
delayWithTicks(60);
-
+
for (int i = 140; i <= 142; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
delayWithTicks(60);
-
+
_animator->resetBrandonAnimSeqSize();
freeShapes123();
_animator->restoreAllObjectBackgrounds();
@@ -489,7 +489,7 @@ void KyraEngine_v1::seq_playFluteAnimation() {
_animator->animRefreshNPC(0);
delayWithTicks(2);
}
-
+
int delayTime = 0, soundType = 0;
if (queryGameFlag(0x85)) {
snd_playSoundEffect(0x63);
@@ -505,13 +505,13 @@ void KyraEngine_v1::seq_playFluteAnimation() {
delayTime = 2;
soundType = 2;
}
-
+
for (int i = 131; i <= 158; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(delayTime);
}
-
+
for (int i = 126; i >= 123; --i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
@@ -522,7 +522,7 @@ void KyraEngine_v1::seq_playFluteAnimation() {
_animator->animRefreshNPC(0);
freeShapes123();
_screen->showMouse();
-
+
if (soundType == 1) {
assert(_fluteString);
characterSays(1000, _fluteString[0], 0, -2);
@@ -541,13 +541,13 @@ void KyraEngine_v1::seq_winterScroll1() {
assert(_winterScroll2Table);
setupShapes123(_winterScrollTable, 7, 0);
_animator->setBrandonAnimSeqSize(5, 66);
-
+
for (int i = 123; i <= 129; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
freeShapes123();
snd_playSoundEffect(0x20);
@@ -565,7 +565,7 @@ void KyraEngine_v1::seq_winterScroll1() {
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
if (_currentCharacter->sceneId == 41 && !queryGameFlag(0xA2)) {
snd_playSoundEffect(0x20);
_sprites->_anims[0].play = false;
@@ -574,13 +574,13 @@ void KyraEngine_v1::seq_winterScroll1() {
_animator->sprites()[1].active = 1;
setGameFlag(0xA2);
}
-
+
for (int i = midpoint; i < 123 + numFrames; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
if (_currentCharacter->sceneId == 117 && !queryGameFlag(0xB3)) {
for (int i = 0; i <= 7; ++i) {
_sprites->_anims[i].play = false;
@@ -596,16 +596,16 @@ void KyraEngine_v1::seq_winterScroll1() {
} else {
delayWithTicks(120);
}
-
+
freeShapes123();
setupShapes123(_winterScroll2Table, 4, 0);
-
+
for (int i = 123; i <= 126; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
_animator->resetBrandonAnimSeqSize();
_currentCharacter->currentAnimFrame = 7;
_animator->animRefreshNPC(0);
@@ -614,27 +614,27 @@ void KyraEngine_v1::seq_winterScroll1() {
}
void KyraEngine_v1::seq_winterScroll2() {
- debugC(9, kDebugLevelMain, "seq_winterScroll2()");
+ debugC(9, kDebugLevelMain, "seq_winterScroll2()");
_screen->hideMouse();
checkAmuletAnimFlags();
assert(_winterScrollTable);
setupShapes123(_winterScrollTable, 7, 0);
_animator->setBrandonAnimSeqSize(5, 66);
-
+
for (int i = 123; i <= 128; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
delayWithTicks(120);
-
+
for (int i = 127; i >= 123; --i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
_animator->resetBrandonAnimSeqSize();
_currentCharacter->currentAnimFrame = 7;
_animator->animRefreshNPC(0);
@@ -651,7 +651,7 @@ void KyraEngine_v1::seq_makeBrandonInv() {
if (_beadStateVar == 4 || _beadStateVar == 6)
return;
}
-
+
_screen->hideMouse();
checkAmuletAnimFlags();
_brandonStatusBit |= 0x20;
@@ -714,11 +714,11 @@ void KyraEngine_v1::seq_makeBrandonWisp() {
debugC(9, kDebugLevelMain, "seq_makeBrandonWisp()");
if (_deathHandler == 8)
return;
-
+
if (_currentCharacter->sceneId == 210) {
if (_beadStateVar == 4 || _beadStateVar == 6)
return;
- }
+ }
_screen->hideMouse();
checkAmuletAnimFlags();
assert(_brandonToWispTable);
@@ -779,9 +779,9 @@ void KyraEngine_v1::seq_dispelMagicAnimation() {
_animator->animRefreshNPC(0);
delayWithTicks(8);
}
-
+
delayWithTicks(120);
-
+
for (int i = 127; i >= 123; --i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
@@ -799,7 +799,7 @@ void KyraEngine_v1::seq_fillFlaskWithWater(int item, int type) {
int newItem = -1;
static const uint8 flaskTable1[] = { 0x46, 0x48, 0x4A, 0x4C };
static const uint8 flaskTable2[] = { 0x47, 0x49, 0x4B, 0x4D };
-
+
if (item >= 60 && item <= 77) {
assert(_flaskFull);
characterSays(8006, _flaskFull[0], 0, -2);
@@ -810,10 +810,10 @@ void KyraEngine_v1::seq_fillFlaskWithWater(int item, int type) {
assert(type >= 0 && type < ARRAYSIZE(flaskTable2));
newItem = flaskTable2[type];
}
-
+
if (newItem == -1)
return;
-
+
_screen->hideMouse();
setMouseItem(newItem);
_screen->showMouse();
@@ -830,7 +830,7 @@ void KyraEngine_v1::seq_fillFlaskWithWater(int item, int type) {
void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) {
debugC(9, kDebugLevelMain, "KyraEngine_v1::seq_playDrinkPotionAnim(%d, %d, %d)", item, unk2, flags);
uint8 red, green, blue;
-
+
switch (item) {
case 60:
case 61:
@@ -875,9 +875,9 @@ void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) {
red = (uint8)((double)red * 0.63);
green = (uint8)((double)green * 0.63);
blue = (uint8)((double)blue * 0.63);
-
+
_screen->setPaletteIndex(0xFE, red, green, blue);
-
+
_screen->hideMouse();
checkAmuletAnimFlags();
_currentCharacter->facing = 5;
@@ -885,12 +885,12 @@ void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) {
assert(_drinkAnimationTable);
setupShapes123(_drinkAnimationTable, 9, flags);
_animator->setBrandonAnimSeqSize(5, 54);
-
+
for (int i = 123; i <= 131; ++i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(5);
- }
+ }
snd_playSoundEffect(0x34);
for (int i = 0; i < 2; ++i) {
_currentCharacter->currentAnimFrame = 130;
@@ -900,18 +900,18 @@ void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) {
_animator->animRefreshNPC(0);
delayWithTicks(7);
}
-
+
if (unk2) {
// XXX
}
-
+
for (int i = 131; i >= 123; --i) {
_currentCharacter->currentAnimFrame = i;
_animator->animRefreshNPC(0);
delayWithTicks(5);
}
-
- _animator->resetBrandonAnimSeqSize();
+
+ _animator->resetBrandonAnimSeqSize();
_currentCharacter->currentAnimFrame = 7;
_animator->animRefreshNPC(0);
freeShapes123();
@@ -947,7 +947,7 @@ int KyraEngine_v1::seq_playEnd() {
_unkEndSeqVar2 = _system->getMillis() + 600 * _tickLength;
_screen->copyRegion(312, 0, 312, 0, 8, 136, 0, 2);
}
-
+
// TODO: better handling. This timer shouldn't count when the menu is open or something.
if (_unkEndSeqVar2 != -1) {
if (_system->getMillis() > (uint32)_unkEndSeqVar2) {
@@ -956,7 +956,7 @@ int KyraEngine_v1::seq_playEnd() {
_malcolmFlag = 1;
}
}
-
+
if (handleMalcolmFlag()) {
_beadStateVar = 0;
_malcolmFlag = 12;
@@ -1057,7 +1057,7 @@ void KyraEngine_v1::seq_playCredits() {
static const uint8 colorMap[] = { 0, 0, 0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static const char stringTerms[] = { 0x5, 0xd, 0x0};
static const int numStrings = 250;
-
+
struct {
int16 x, y;
uint8 code;
@@ -1065,18 +1065,18 @@ void KyraEngine_v1::seq_playCredits() {
Screen::FontId font;
uint8 *str;
} strings[numStrings];
-
+
memset(strings, 0, sizeof(strings));
-
+
_screen->hideMouse();
if (!_flags.isTalkie) {
_screen->loadFont(Screen::FID_CRED6_FNT, "CREDIT6.FNT");
_screen->loadFont(Screen::FID_CRED8_FNT, "CREDIT8.FNT");
} else
_screen->setFont(Screen::FID_8_FNT);
-
+
_screen->loadBitmap("CHALET.CPS", 4, 4, _screen->_currentPalette);
-
+
_screen->setCurPage(0);
_screen->clearCurPage();
_screen->setTextColorMap(colorMap);
@@ -1088,7 +1088,7 @@ void KyraEngine_v1::seq_playCredits() {
uint8 *buffer = 0;
uint32 size = 0;
-
+
if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
int sizeTmp = 0;
const uint8 *bufferTmp = _staticres->loadRawData(kCreditsStrings, sizeTmp);
@@ -1105,26 +1105,26 @@ void KyraEngine_v1::seq_playCredits() {
uint8 *nextString = buffer;
uint8 *currentString = buffer;
int currentY = 200;
-
+
for (int i = 0; i < numStrings; i++) {
if (*nextString == 0)
break;
-
+
currentString = nextString;
nextString = (uint8 *)strpbrk((const char *)currentString, stringTerms);
if (!nextString)
nextString = (uint8 *)strchr((const char *)currentString, 0);
-
+
strings[i].code = nextString[0];
*nextString = 0;
if (strings[i].code != 0)
nextString++;
-
+
if (*currentString == 3 || *currentString == 4) {
strings[i].unk1 = *currentString;
currentString++;
}
-
+
if (*currentString == 1) {
currentString++;
if (!_flags.isTalkie)
@@ -1137,28 +1137,28 @@ void KyraEngine_v1::seq_playCredits() {
}
strings[i].font = _screen->_currentFont;
- if (strings[i].unk1 == 3)
+ if (strings[i].unk1 == 3)
strings[i].x = 157 - _screen->getTextWidth((const char *)currentString);
else if (strings[i].unk1 == 4)
strings[i].x = 161;
else
strings[i].x = (320 - _screen->getTextWidth((const char *)currentString)) / 2 + 1;
-
+
strings[i].y = currentY;
if (strings[i].code != 5)
currentY += 10;
-
+
strings[i].str = currentString;
}
_screen->setCurPage(2);
-
+
memset(_screen->getPalette(2), 0, sizeof(uint8)*768);
_screen->setScreenPalette(_screen->getPalette(2));
_screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK);
_screen->fadePalette(_screen->_currentPalette, 0x5A);
- Common::Event event;
+ Common::Event event;
bool finished = false;
int bottom = 201;
while (!finished) {
@@ -1166,7 +1166,7 @@ void KyraEngine_v1::seq_playCredits() {
if (bottom > 175) {
_screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 2, Screen::CR_NO_P_CHECK);
bottom = 0;
-
+
for (int i = 0; i < numStrings; i++) {
if (strings[i].y < 200 && strings[i].y > 0) {
if (strings[i].font != _screen->_currentFont)
@@ -1203,7 +1203,7 @@ void KyraEngine_v1::seq_playCredits() {
}
delete [] buffer;
-
+
_screen->fadeToBlack();
_screen->clearCurPage();
_screen->showMouse();
@@ -1219,7 +1219,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
static uint16 frame = 0;
static uint32 timer1 = 0;
static uint32 timer2 = 0;
-
+
switch (_malcolmFlag) {
case 1:
frame = 0;
@@ -1243,7 +1243,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
}
}
break;
-
+
case 3:
if (_system->getMillis() < timer1) {
if (_system->getMillis() >= timer2) {
@@ -1260,7 +1260,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
frame = 18;
}
break;
-
+
case 4:
if (_system->getMillis() >= timer2) {
_finalA->setX(8);
@@ -1277,7 +1277,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
}
}
break;
-
+
case 5:
if (_system->getMillis() >= timer2) {
_finalA->setX(8);
@@ -1293,7 +1293,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
}
}
break;
-
+
case 6:
if (_unkEndSeqVar4) {
if (frame <= 33 && _system->getMillis() >= timer2) {
@@ -1312,7 +1312,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
}
}
break;
-
+
case 7:
if (_unkEndSeqVar5 == 1) {
_malcolmFlag = 8;
@@ -1339,7 +1339,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
}
}
break;
-
+
case 9:
snd_playSoundEffect(12);
snd_playSoundEffect(12);
@@ -1356,7 +1356,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
delay(60 * _tickLength);
_malcolmFlag = 0;
return 1;
-
+
case 10:
if (!_beadStateVar) {
handleBeadState();
@@ -1367,7 +1367,7 @@ int KyraEngine_v1::handleMalcolmFlag() {
_malcolmFlag = 11;
}
break;
-
+
case 11:
if (_system->getMillis() >= timer2) {
_text->restoreTalkTextMessageBkgd(2, 0);
@@ -1375,11 +1375,11 @@ int KyraEngine_v1::handleMalcolmFlag() {
timer1 = _system->getMillis() + 180 * _tickLength;
}
break;
-
+
default:
break;
}
-
+
return 0;
}
@@ -1389,7 +1389,7 @@ int KyraEngine_v1::handleBeadState() {
static uint32 timer2 = 0;
static BeadState beadState1 = { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static BeadState beadState2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
+
static const int table1[] = {
-1, -2, -4, -5, -6, -7, -6, -5,
-4, -2, -1, 0, 1, 2, 4, 5,
@@ -1403,21 +1403,21 @@ int KyraEngine_v1::handleBeadState() {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
};
-
+
switch (_beadStateVar) {
case 0:
if (beadState1.x != -1 && _endSequenceBackUpRect) {
_screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
}
-
+
beadState1.x = -1;
beadState1.tableIndex = 0;
timer1 = 0;
timer2 = 0;
_lastDisplayedPanPage = 0;
return 1;
-
+
case 1:
if (beadState1.x != -1) {
if (_endSequenceBackUpRect) {
@@ -1429,7 +1429,7 @@ int KyraEngine_v1::handleBeadState() {
}
_beadStateVar = 2;
break;
-
+
case 2:
if (_system->getMillis() >= timer1) {
int x = 0, y = 0;
@@ -1472,7 +1472,7 @@ int KyraEngine_v1::handleBeadState() {
_screen->addBitBlitRect(x, y, beadState1.width2, beadState1.height);
}
break;
-
+
case 3:
if (_system->getMillis() >= timer1) {
timer1 = _system->getMillis() + 4 * _tickLength;
@@ -1505,7 +1505,7 @@ int KyraEngine_v1::handleBeadState() {
beadState1.unk8 = _currentCharacter->x1 - 4;
beadState1.unk9 = _currentCharacter->y1 - 30;
}
-
+
if (_text->printed())
_text->restoreTalkTextMessageBkgd(2, 0);
@@ -1514,7 +1514,7 @@ int KyraEngine_v1::handleBeadState() {
}
}
break;
-
+
case 4:
if (_system->getMillis() >= timer1) {
int x = 0, y = 0;
@@ -1543,7 +1543,7 @@ int KyraEngine_v1::handleBeadState() {
}
}
break;
-
+
case 5:
if (_system->getMillis() >= timer1) {
timer1 = _system->getMillis() + _tickLength;
@@ -1590,13 +1590,13 @@ int KyraEngine_v1::handleBeadState() {
}
}
break;
-
+
case 6:
_screen->drawShape(2, _panPagesTable[19], beadState1.x, beadState1.y, 0, 0);
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
_beadStateVar = 0;
break;
-
+
default:
break;
}
@@ -1615,18 +1615,18 @@ void KyraEngine_v1::initBeadState(int x, int y, int x2, int y2, int unk, BeadSta
unk1 = 0;
else
unk1 = -1;
-
-
+
+
if (yDiff > 0)
unk2 = 1;
else if (yDiff == 0)
unk2 = 0;
else
unk2 = -1;
-
+
xDiff = ABS(xDiff);
yDiff = ABS(yDiff);
-
+
ptr->y = 0;
ptr->x = 0;
ptr->width = xDiff;
@@ -1641,7 +1641,7 @@ int KyraEngine_v1::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) {
debugC(9, kDebugLevelMain, "KyraEngine_v1::processBead(%d, %d, %p, %p, %p)", x, y, (const void *)&x2, (const void *)&y2, (const void *)ptr);
if (x == ptr->dstX && y == ptr->dstY)
return 1;
-
+
int xPos = x, yPos = y;
if (ptr->width >= ptr->height) {
for (int i = 0; i < ptr->unk9; ++i) {
@@ -1662,7 +1662,7 @@ int KyraEngine_v1::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) {
yPos += ptr->unk8;
}
}
-
+
int temp = ABS(x - ptr->dstX);
if (ptr->unk9 > temp)
xPos = ptr->dstX;
@@ -1685,7 +1685,7 @@ void KyraEngine_v1::setupPanPages() {
delete [] _panPagesTable[19];
_panPagesTable[19] = _screen->encodeShape(0, 0, 16, 9, 0);
assert(_panPagesTable[19]);
-
+
int curX = 16;
for (int i = 0; i < 19; ++i) {
delete [] _panPagesTable[i];
@@ -1734,10 +1734,10 @@ void KyraEngine_v1::updateKyragemFading() {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-
+
if (_system->getMillis() < _kyragemFadingState.timerCount)
return;
-
+
_kyragemFadingState.timerCount = _system->getMillis() + 4 * _tickLength;
int palPos = 684;
for (int i = 0; i < 20; ++i) {
@@ -1768,32 +1768,32 @@ void KyraEngine_v1::updateKyragemFading() {
return;
_kyragemFadingState.nextOperation = 3;
break;
-
+
case 3:
++_kyragemFadingState.bOffset;
if (_kyragemFadingState.bOffset < 19)
return;
_kyragemFadingState.nextOperation = 4;
break;
-
+
case 4:
--_kyragemFadingState.rOffset;
if (_kyragemFadingState.rOffset >= 1)
return;
_kyragemFadingState.nextOperation = 5;
break;
-
+
case 5:
++_kyragemFadingState.gOffset;
if (_kyragemFadingState.gOffset < 19)
return;
_kyragemFadingState.nextOperation = 0;
break;
-
+
default:
break;
}
-
+
_kyragemFadingState.timerCount = _system->getMillis() + 120 * _tickLength;
}
@@ -1854,7 +1854,7 @@ void KyraEngine_v1::drawJewelsFadeOutEnd(int jewel) {
else
newDelay = 8100;
break;
-
+
default:
newDelay = 3600;
break;
diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp
index 5b4a7ababd..0de8522736 100644
--- a/engines/kyra/sequences_v2.cpp
+++ b/engines/kyra/sequences_v2.cpp
@@ -750,7 +750,7 @@ int KyraEngine_v2::seq_introForest(WSAMovieV2 *wsaObj, int x, int y, int frm) {
seq_waitForTextsTimeout();
} else if (frm == 12) {
//if (_flags.lang == Common::FR_FRA)
- //XXX
+ //XXX
seq_playTalkText(2);
}
return frm;
@@ -874,7 +874,7 @@ int KyraEngine_v2::seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm)
chatFirstFrame = 0;
chatLastFrame = 8;
voiceIndex = 35;
- } else {
+ } else {
chatFirstFrame = 9;
chatLastFrame = 15;
}
@@ -963,7 +963,7 @@ int KyraEngine_v2::seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm) {
chatX = 60;
if (_flags.isTalkie)
- voiceIndex = 36;
+ voiceIndex = 36;
seq_playWsaSyncDialogue(25, voiceIndex, 143, chatX, chatY, chatW, wsaObj, 16, 25, x, y);
_seqFrameDelay = 16;
@@ -1186,7 +1186,7 @@ int KyraEngine_v2::seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm) {
chatX = 90;
chatY = 30;
chatW = 100;
-
+
if (_flags.isTalkie) {
if (_flags.lang == Common::FR_FRA || _flags.lang == Common::DE_DEU) {
chatX = 75;
@@ -1363,7 +1363,7 @@ int KyraEngine_v2::seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm)
if (_flags.isTalkie)
voiceIndex = 43;
-
+
seq_playWsaSyncDialogue(32, voiceIndex, 137, chatX, chatY, chatW, wsaObj, 14, 16, x, y);
break;
@@ -1376,7 +1376,7 @@ int KyraEngine_v2::seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm)
break;
case 31:
- if (_flags.isTalkie)
+ if (_flags.isTalkie)
voiceIndex = 44;
chatX = 90;
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 4a62671df3..c2ec98c904 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -468,7 +468,7 @@ void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
//if (!_disableSound) {
// XXX
//}
-
+
if (_flags.platform == Common::kPlatformPC) {
assert(command*2+1 < _trackMapSize);
if (_curMusicTheme != _trackMap[command*2]) {
@@ -494,7 +494,7 @@ void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
_sound->playTrack(command);
}
}
- }
+ }
_lastMusicCommand = command;
}
diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp
index 8b31cf4684..89ebe50d02 100644
--- a/engines/kyra/sound_digital.cpp
+++ b/engines/kyra/sound_digital.cpp
@@ -38,12 +38,12 @@ class AUDStream : public Audio::AudioStream {
public:
AUDStream(Common::File *file, bool loop = false);
~AUDStream();
-
+
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return false; }
bool endOfData() const { return _endOfData; }
-
+
int getRate() const { return _rate; }
void beginFadeIn();
@@ -56,22 +56,22 @@ private:
int _rate;
uint _processedSize;
uint _totalSize;
-
+
int _bytesLeft;
-
+
byte *_outBuffer;
int _outBufferOffset;
uint _outBufferSize;
-
+
byte *_inBuffer;
uint _inBufferSize;
int32 _fadeSamples;
int32 _fadeCount;
int _fading;
-
+
int readChunk(int16 *buffer, const int maxSamples);
-
+
static const int8 WSTable2Bit[];
static const int8 WSTable4Bit[];
};
@@ -85,7 +85,7 @@ const int8 AUDStream::WSTable4Bit[] = {
AUDStream::AUDStream(Common::File *file, bool loop) : _file(file), _endOfData(true), _rate(0),
_processedSize(0), _totalSize(0), _bytesLeft(0), _outBuffer(0),
_outBufferOffset(0), _outBufferSize(0), _inBuffer(0), _inBufferSize(0) {
-
+
_rate = _file->readUint16LE();
_totalSize = _file->readUint32LE();
_loop = loop;
@@ -101,7 +101,7 @@ AUDStream::AUDStream(Common::File *file, bool loop) : _file(file), _endOfData(tr
int type = _file->readByte(); // type
_loopStart = file->pos();
-
+
if (type == 1 && !flags) {
_endOfData = false;
} else
@@ -128,7 +128,7 @@ void AUDStream::beginFadeOut() {
int AUDStream::readBuffer(int16 *buffer, const int numSamples) {
int samplesRead = 0, samplesLeft = numSamples;
-
+
while (samplesLeft > 0 && !_endOfData) {
int samples = readChunk(buffer, samplesLeft);
samplesRead += samples;
@@ -165,11 +165,11 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) {
uint16 size = _file->readUint16LE();
uint16 outSize = _file->readUint16LE();
uint32 id = _file->readUint32LE();
-
+
assert(id == 0x0000DEAF);
-
+
_processedSize += 8 + size;
-
+
_outBufferOffset = 0;
if (size == outSize) {
if (outSize > _outBufferSize) {
@@ -180,37 +180,37 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) {
}
_bytesLeft = size;
-
+
_file->read(_outBuffer, _bytesLeft);
} else {
_bytesLeft = outSize;
-
+
if (outSize > _outBufferSize) {
_outBufferSize = outSize;
delete [] _outBuffer;
_outBuffer = new uint8[_outBufferSize];
assert(_outBuffer);
}
-
+
if (size > _inBufferSize) {
_inBufferSize = size;
delete [] _inBuffer;
_inBuffer = new uint8[_inBufferSize];
assert(_inBuffer);
}
-
+
if (_file->read(_inBuffer, size) != size) {
_endOfData = true;
return 0;
}
-
+
int16 curSample = 0x80;
byte code = 0;
int8 count = 0;
uint16 input = 0;
int j = 0;
int i = 0;
-
+
while (outSize > 0) {
input = _inBuffer[i++] << 2;
code = (input >> 8) & 0xff;
@@ -279,7 +279,7 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) {
}
}
}
-
+
// copies the chunk data to the output buffer
if (_bytesLeft > 0) {
int samples = MIN(_bytesLeft, maxSamples);
@@ -340,14 +340,14 @@ int SoundDigital::playSound(Common::File *fileHandle, bool loop, bool fadeIn, in
break;
}
}
-
+
if (!use) {
warning("no free sound channel");
delete fileHandle;
return -1;
}
}
-
+
use->stream = new AUDStream(fileHandle, loop);
if (use->stream->endOfData()) {
delete use->stream;
@@ -358,10 +358,10 @@ int SoundDigital::playSound(Common::File *fileHandle, bool loop, bool fadeIn, in
if (fadeIn)
use->stream->beginFadeIn();
-
+
// TODO: set correct sound type from channel id
_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &use->handle, use->stream);
-
+
return use - _sounds;
}
diff --git a/engines/kyra/sound_v1.cpp b/engines/kyra/sound_v1.cpp
index ff345cf598..6c6d086882 100644
--- a/engines/kyra/sound_v1.cpp
+++ b/engines/kyra/sound_v1.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#include "kyra/sound.h"
#include "kyra/kyra_v1.h"
diff --git a/engines/kyra/sprites.h b/engines/kyra/sprites.h
index 255d878635..3304458fda 100644
--- a/engines/kyra/sprites.h
+++ b/engines/kyra/sprites.h
@@ -74,12 +74,12 @@ public:
void setupSceneAnims();
void loadDat(const char *filename, SceneExits &exits);
void loadSceneShapes();
-
+
Anim _anims[MAX_NUM_ANIMS];
uint8 *_sceneShapes[50];
void refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, uint16 y, bool flipX, bool unkFlag);
-
+
int getDrawLayer(int y);
int _sceneAnimatorBeaconFlag;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index ea73882d43..df5af4ab3e 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -233,14 +233,14 @@ bool StaticResource::init() {
{ k2SeqplayTlkFiles, kLanguageList, "S_TLKFILES." },
{ k2SeqplaySeqData, kRawData, "S_DATA.SEQ" },
{ k2SeqplayIntroTracks, kStringList, "S_INTRO.TRA" },
- { k2SeqplayFinaleTracks, kStringList, "S_FINALE.TRA" },
+ { k2SeqplayFinaleTracks, kStringList, "S_FINALE.TRA" },
{ k2SeqplayIntroCDA, kRawData, "S_INTRO.CDA" },
{ k2SeqplayFinaleCDA, kRawData, "S_FINALE.CDA" },
// Ingame
{ k2IngamePakFiles, kStringList, "I_PAKFILES.TXT" },
{ k2IngameSfxFiles, kStringList, "I_SFXFILES.TXT" },
- { k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" },
+ { k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" },
{ k2IngameTracks, kStringList, "I_TRACKS.TRA" },
{ k2IngameCDA, kRawData, "I_TRACKS.CDA" },
@@ -947,7 +947,7 @@ void KyraEngine_v2::initStaticResource() {
}
tlkfiles = 0;
_staticres->unloadId(k2SeqplayTlkFiles);
-
+
// assign music data
static const char *fmtMusicFileListIntro[] = { "intro" };
static const char *fmtMusicFileListFinale[] = { "finale" };
@@ -968,7 +968,7 @@ void KyraEngine_v2::initStaticResource() {
// setup sequence data
const uint8 *seqData = _staticres->loadRawData(k2SeqplaySeqData, tmp);
-
+
static const Seqproc hofSequenceCallbacks[] = { 0,
&KyraEngine_v2::seq_introWestwood,
&KyraEngine_v2::seq_introTitle, &KyraEngine_v2::seq_introOverview,
diff --git a/engines/kyra/text.h b/engines/kyra/text.h
index 594082187b..07bc0605dd 100644
--- a/engines/kyra/text.h
+++ b/engines/kyra/text.h
@@ -59,7 +59,7 @@ public:
virtual void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage);
void printIntroTextMessage(const char *text, int x, int y, uint8 col1, uint8 col2, uint8 col3,
- int dstPage, Screen::FontId font=Screen::FID_8_FNT);
+ int dstPage, Screen::FontId font=Screen::FID_8_FNT);
void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT);
void printCharacterText(const char *text, int8 charNum, int charX);
diff --git a/engines/kyra/text_v1.cpp b/engines/kyra/text_v1.cpp
index 4262ac5cb8..7f49c04766 100644
--- a/engines/kyra/text_v1.cpp
+++ b/engines/kyra/text_v1.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#include "kyra/kyra_v1.h"
#include "kyra/screen_v1.h"
#include "kyra/text.h"
@@ -33,7 +33,7 @@
namespace Kyra {
void KyraEngine_v1::waitForChatToFinish(int vocFile, int16 chatDuration, const char *chatStr, uint8 charNum) {
- debugC(9, kDebugLevelMain, "KyraEngine_v1::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum);
+ debugC(9, kDebugLevelMain, "KyraEngine_v1::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum);
bool hasUpdatedNPCs = false;
bool runLoop = true;
bool drawText = textEnabled();
@@ -113,8 +113,8 @@ void KyraEngine_v1::waitForChatToFinish(int vocFile, int16 chatDuration, const c
if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1 && (!drawText || !snd_voiceIsPlaying()))
break;
- uint32 nextTime = loopStart + _tickLength;
-
+ uint32 nextTime = loopStart + _tickLength;
+
while (_system->getMillis() < nextTime) {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
@@ -133,7 +133,7 @@ void KyraEngine_v1::waitForChatToFinish(int vocFile, int16 chatDuration, const c
break;
}
}
-
+
if (nextTime - _system->getMillis() >= 10) {
_system->delayMillis(10);
_system->updateScreen();
@@ -189,7 +189,7 @@ void KyraEngine_v1::restoreChatPartnerAnimFrame(int8 charNum) {
void KyraEngine_v1::backupChatPartnerAnimFrame(int8 charNum) {
_talkingCharNum = 0;
- if (charNum < 5 && charNum > 0)
+ if (charNum < 5 && charNum > 0)
_currentChatPartnerBackupFrame = _characterList[charNum].currentAnimFrame;
if (_currentCharacter->currentAnimFrame != 88) {
@@ -230,7 +230,7 @@ int KyraEngine_v1::initCharacterChat(int8 charNum) {
if (_talkingCharNum == -1) {
returnValue = 1;
_talkingCharNum = 0;
-
+
if (_currentCharacter->currentAnimFrame != 88) {
_currentCharacter->currentAnimFrame = 16;
if (_scaleMode != 0)
@@ -269,7 +269,7 @@ void KyraEngine_v1::characterSays(int vocFile, const char *chatStr, int8 charNum
if (_currentCharacter->sceneId == 210)
return;
- convoInitialized = initCharacterChat(charNum);
+ convoInitialized = initCharacterChat(charNum);
chatPartnerNum = getChatPartnerNum();
if (chatPartnerNum >= 0 && chatPartnerNum < 5)
@@ -298,7 +298,7 @@ void KyraEngine_v1::characterSays(int vocFile, const char *chatStr, int8 charNum
_text->_talkMessageY = yPos;
_text->_talkMessageH = lineNum * 10;
-
+
if (textEnabled()) {
_animator->restoreAllObjectBackgrounds();
@@ -347,7 +347,7 @@ void KyraEngine_v1::drawSentenceCommand(const char *sentence, int color) {
_currSentenceColor[0] = _screen->_currentPalette[765] = _screen->_currentPalette[color*3];
_currSentenceColor[1] = _screen->_currentPalette[766] = _screen->_currentPalette[color*3+1];
_currSentenceColor[2] = _screen->_currentPalette[767] = _screen->_currentPalette[color*3+2];
-
+
_screen->setScreenPalette(_screen->_currentPalette);
_startSentencePalIndex = 0;
}
@@ -373,7 +373,7 @@ void KyraEngine_v1::updateTextFade() {
debugC(9, kDebugLevelMain, "KyraEngine_v1::updateTextFade()");
if (!_fadeText)
return;
-
+
bool finished = false;
for (int i = 0; i < 3; i++) {
if (_currSentenceColor[i] > 4)
@@ -384,7 +384,7 @@ void KyraEngine_v1::updateTextFade() {
finished = true;
}
}
-
+
_screen->_currentPalette[765] = _currSentenceColor[0];
_screen->_currentPalette[766] = _currSentenceColor[1];
_screen->_currentPalette[767] = _currSentenceColor[2];
diff --git a/engines/kyra/text_v2.cpp b/engines/kyra/text_v2.cpp
index 24e146a990..345af34e71 100644
--- a/engines/kyra/text_v2.cpp
+++ b/engines/kyra/text_v2.cpp
@@ -95,7 +95,7 @@ void TextDisplayer_v2::calcWidestLineBounds(int &x1, int &x2, int w, int x) {
x1 = x;
x1 -= (w >> 1);
x2 = x1 + w + 1;
-
+
if (x1 + w >= 311)
x1 = 311 - w - 1;
@@ -113,13 +113,13 @@ int KyraEngine_v2::chatGetType(const char *str) {
switch (*str) {
case '!':
return 2;
-
+
case ')':
return -1;
-
+
case '?':
return 1;
-
+
default:
return 0;
}
@@ -133,7 +133,7 @@ void KyraEngine_v2::objectChat(const char *str, int object, int vocHigh, int voc
setNextIdleAnimTimer();
_chatVocHigh = _chatVocLow = -1;
-
+
objectChatInit(str, object, vocHigh, vocLow);
_chatText = str;
_chatObject = object;
@@ -175,7 +175,7 @@ void KyraEngine_v2::objectChat(const char *str, int object, int vocHigh, int voc
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
-
+
_chatText = 0;
_chatObject = -1;
@@ -187,7 +187,7 @@ void KyraEngine_v2::objectChatInit(const char *str, int object, int vocHigh, int
int lineNum = _text->buildMessageSubstrings(str);
int yPos = 0, xPos = 0;
-
+
if (!object) {
int scale = getScale(_mainCharacter.x1, _mainCharacter.y1);
yPos = _mainCharacter.y1 - ((_mainCharacter.height * scale) >> 8) - 8;
@@ -225,7 +225,7 @@ void KyraEngine_v2::objectChatInit(const char *str, int object, int vocHigh, int
} else {
_chatVocHigh = _chatVocLow = -1;
}
-
+
_screen->showMouse();
}
@@ -335,19 +335,19 @@ void KyraEngine_v2::objectChatWaitToFinish() {
void KyraEngine_v2::initTalkObject(int initObject) {
TalkObject &object = _talkObjectList[initObject];
-
+
char STAFilename[13];
char TLKFilename[13];
char ENDFilename[13];
-
+
strcpy(STAFilename, object.filename);
strcpy(TLKFilename, object.filename);
strcpy(ENDFilename, object.filename);
-
+
strcpy(STAFilename + 4, "_STA.TIM");
strcpy(TLKFilename + 4, "_TLK.TIM");
strcpy(ENDFilename + 4, "_END.TIM");
-
+
_currentTalkSections.STATim = loadTIMFile(STAFilename, NULL, 0);
_currentTalkSections.TLKTim = loadTIMFile(TLKFilename, NULL, 0);
_currentTalkSections.ENDTim = loadTIMFile(ENDFilename, NULL, 0);
@@ -356,7 +356,7 @@ void KyraEngine_v2::initTalkObject(int initObject) {
_specialSceneScriptStateBackup[object.scriptId] = _specialSceneScriptState[object.scriptId];
_specialSceneScriptState[object.scriptId] = 1;
}
-
+
/*if (_currentTalkObject.STATim) {
_objectChatFinished = false;
while (!_objectChatFinished) {
@@ -371,7 +371,7 @@ void KyraEngine_v2::initTalkObject(int initObject) {
void KyraEngine_v2::deinitTalkObject(int initObject) {
TalkObject &object = _talkObjectList[initObject];
-
+
/*if (_currentTalkObject.ENDTim) {
_objectChatFinished = false;
while (!_objectChatFinished) {
@@ -382,25 +382,25 @@ void KyraEngine_v2::deinitTalkObject(int initObject) {
update();
}
}*/
-
+
if (object.scriptId != -1) {
_specialSceneScriptState[object.scriptId] = _specialSceneScriptStateBackup[object.scriptId];
}
-
+
if (_currentTalkSections.STATim != NULL) {
freeTIM(_currentTalkSections.STATim);
_currentTalkSections.STATim = NULL;
}
-
+
if (_currentTalkSections.TLKTim != NULL) {
freeTIM(_currentTalkSections.TLKTim);
_currentTalkSections.TLKTim = NULL;
}
-
+
if (_currentTalkSections.ENDTim != NULL) {
freeTIM(_currentTalkSections.ENDTim);
_currentTalkSections.ENDTim = NULL;
- }
+ }
}
byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 bufferSize) {
@@ -415,13 +415,13 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe
error("No FORM chunk found in file: '%s'", filename);
return NULL;
}
-
+
if (formBlockSize < 20) {
return NULL;
}
formBlockSize += sizeof(TIMHeader) + 120 + sizeof(TIMStructUnk1) * 10;
-
+
TIMHeader *timHeader;
if (buffer == NULL || bufferSize < formBlockSize) {
buffer = new byte[formBlockSize];
@@ -429,9 +429,9 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe
timHeader->deleteBufferFlag = 0xBABE;
} else {
timHeader = (TIMHeader *)buffer;
- timHeader->deleteBufferFlag = 0x0;
+ timHeader->deleteBufferFlag = 0x0;
}
-
+
int32 chunkSize = file.getIFFBlockSize(AVTL_CHUNK);
timHeader->unkFlag = -1;
timHeader->unkFlag2 = 0;
@@ -439,17 +439,17 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe
timHeader->unkOffset2 = timHeader->unkOffset + sizeof(TIMStructUnk1) * 10;
timHeader->AVTLOffset = timHeader->unkOffset2 + 120;
timHeader->TEXTOffset = timHeader->AVTLOffset + chunkSize;
-
+
_TIMBuffers.AVTLChunk = (uint16 *)(buffer + timHeader->AVTLOffset);
_TIMBuffers.TEXTChunk = buffer + timHeader->TEXTOffset;
-
+
if (!file.loadIFFBlock(AVTL_CHUNK, _TIMBuffers.AVTLChunk, chunkSize)) {
error("Couldn't load AVTL chunk from file: '%s'", filename);
return NULL;
}
-
+
_TIMBuffers.UnkChunk = (TIMStructUnk1 *)(buffer + timHeader->unkOffset);
-
+
for (int i = 0; i < 10; i++) {
_TIMBuffers.UnkChunk[i].unk_0 = 0;
_TIMBuffers.UnkChunk[i].unk_2 = 0;
@@ -463,15 +463,15 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe
if (!file.loadIFFBlock(TEXT_CHUNK, _TIMBuffers.TEXTChunk, chunkSize)) {
error("Couldn't load TEXT chunk from file: '%s'", filename);
return NULL;
- }
+ }
}
-
+
return buffer;
}
void KyraEngine_v2::freeTIM(byte *buffer) {
TIMHeader *timHeader = (TIMHeader *)buffer;
-
+
if (timHeader->deleteBufferFlag == 0xBABE) {
delete[] buffer;
}
diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp
index 7c16d27d22..c0f47111c6 100644
--- a/engines/kyra/timer.cpp
+++ b/engines/kyra/timer.cpp
@@ -53,7 +53,7 @@ struct TimerResync : public Common::UnaryFunction<TimerEntry&, void> {
struct TimerEqual : public Common::UnaryFunction<const TimerEntry&, bool> {
uint8 _id;
-
+
TimerEqual(uint8 id) : _id(id) {}
bool operator()(const TimerEntry &entry) const {
@@ -80,13 +80,13 @@ void TimerManager::addTimer(uint8 id, TimerFunc *func, int countdown, bool enabl
}
TimerEntry newTimer;
-
+
newTimer.id = id;
newTimer.countdown = countdown;
newTimer.enabled = enabled ? 1 : 0;
newTimer.lastUpdate = newTimer.nextRun = 0;
newTimer.func = func;
-
+
_timers.push_back(newTimer);
}
@@ -95,7 +95,7 @@ void TimerManager::update() {
if (_system->getMillis() < _nextRun)
return;
-
+
_nextRun += 99999;
for (Iterator pos = _timers.begin(); pos != _timers.end(); ++pos) {
@@ -106,7 +106,7 @@ void TimerManager::update() {
uint32 curTime = _system->getMillis();
pos->lastUpdate = curTime;
pos->nextRun = curTime + pos->countdown * _vm->tickLength();
-
+
_nextRun = MIN(_nextRun, pos->nextRun);
}
}
@@ -116,7 +116,7 @@ void TimerManager::resync() {
debugC(9, kDebugLevelTimer, "TimerManager::resync()");
_nextRun = 0; // force rerun
- Common::for_each(_timers.begin(), _timers.end(), TimerResync(_vm, _system->getMillis()));
+ Common::for_each(_timers.begin(), _timers.end(), TimerResync(_vm, _system->getMillis()));
}
void TimerManager::resetNextRun() {
@@ -135,7 +135,7 @@ void TimerManager::setCountdown(uint8 id, int32 countdown) {
uint32 curTime = _system->getMillis();
timer->lastUpdate = curTime;
timer->nextRun = curTime + countdown * _vm->tickLength();
-
+
_nextRun = MIN(_nextRun, timer->nextRun);
}
} else {
@@ -197,14 +197,14 @@ void TimerManager::disable(uint8 id) {
void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) {
debugC(9, kDebugLevelTimer, "TimerManager::loadDataFromFile(%p, %d)", (const void*)file, version);
-
+
if (version <= 7) {
_nextRun = 0;
for (int i = 0; i < 32; ++i) {
uint8 enabled = file->readByte();
int32 countdown = file->readSint32BE();
uint32 nextRun = file->readUint32BE();
-
+
Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(i));
if (timer != _timers.end()) {
timer->enabled = enabled;
@@ -220,7 +220,7 @@ void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) {
}
} else {
warning("Loading timer data for non existing timer %d", i);
- }
+ }
}
} else {
int entries = file->readByte();
@@ -237,14 +237,14 @@ void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) {
file->seek(7, SEEK_CUR);
}
}
-
+
resync();
}
}
void TimerManager::saveDataToFile(Common::OutSaveFile *file) const {
debugC(9, kDebugLevelTimer, "TimerManager::saveDataToFile(%p)", (const void*)file);
-
+
file->writeByte(count());
for (CIterator pos = _timers.begin(); pos != _timers.end(); ++pos) {
file->writeByte(pos->id);
diff --git a/engines/kyra/timer.h b/engines/kyra/timer.h
index 1edeb92a42..2c0251ffb7 100644
--- a/engines/kyra/timer.h
+++ b/engines/kyra/timer.h
@@ -43,11 +43,11 @@ typedef Functor1<int, void> TimerFunc;
struct TimerEntry {
uint8 id;
int32 countdown;
- int8 enabled;
+ int8 enabled;
int32 lastUpdate;
uint32 nextRun;
-
+
TimerFunc *func;
};
@@ -55,27 +55,27 @@ class TimerManager {
public:
TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0) {}
~TimerManager() { reset(); }
-
+
void reset();
-
+
void addTimer(uint8 id, TimerFunc *func, int countdown, bool enabled);
int count() const { return _timers.size(); }
-
+
void update();
-
+
void resetNextRun();
-
+
void setCountdown(uint8 id, int32 countdown);
void setDelay(uint8 id, int32 countdown);
int32 getDelay(uint8 id) const;
-
+
bool isEnabled(uint8 id) const;
void enable(uint8 id);
void disable(uint8 id);
void resync();
-
+
void loadDataFromFile(Common::InSaveFile *file, int version);
void saveDataToFile(Common::OutSaveFile *file) const;
private:
@@ -83,7 +83,7 @@ private:
OSystem *_system;
Common::List<TimerEntry> _timers;
uint32 _nextRun;
-
+
typedef Common::List<TimerEntry>::iterator Iterator;
typedef Common::List<TimerEntry>::const_iterator CIterator;
};
diff --git a/engines/kyra/timer_v1.cpp b/engines/kyra/timer_v1.cpp
index 55dab4413f..c02042f1cc 100644
--- a/engines/kyra/timer_v1.cpp
+++ b/engines/kyra/timer_v1.cpp
@@ -46,28 +46,28 @@ void KyraEngine_v1::setupTimers() {
_timer->addTimer(7, 0, 8, 1);
_timer->addTimer(8, 0, 9, 1);
_timer->addTimer(9, 0, 7, 1);
-
+
for (int i = 10; i <= 13; ++i)
_timer->addTimer(i, 0, 420, 1);
_timer->addTimer(14, TimerV1(timerCheckAnimFlag2), 600, 1);
_timer->addTimer(15, TimerV1(timerUpdateHeadAnims), 11, 1);
_timer->addTimer(16, TimerV1(timerSetFlags1), 7200, 1);
- _timer->addTimer(17, 0 /*sub_15120*/, 7200, 1);
+ _timer->addTimer(17, 0 /*sub_15120*/, 7200, 1);
_timer->addTimer(18, TimerV1(timerCheckAnimFlag1), 600, 1);
_timer->addTimer(19, TimerV1(timerRedrawAmulet), 600, 1);
-
+
_timer->addTimer(20, 0, 7200, 1);
_timer->addTimer(21, 0/*sub_1517C*/, 18000, 1);
_timer->addTimer(22, 0, 7200, 1);
-
+
for (int i = 23; i <= 27; ++i)
_timer->addTimer(i, 0, 10800, 1);
_timer->addTimer(28, 0, 21600, 1);
_timer->addTimer(29, 0, 7200, 1);
_timer->addTimer(30, 0, 10800, 1);
-
+
_timer->addTimer(31, TimerV1(timerFadeText), -1, 1);
_timer->addTimer(32, TimerV1(updateAnimFlag1), 9, 1);
_timer->addTimer(33, TimerV1(updateAnimFlag2), 3, 1);
@@ -141,7 +141,7 @@ void KyraEngine_v1::setTextFadeTimerCountdown(int16 countdown) {
void KyraEngine_v1::timerSetFlags2(int timerNum) {
debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v1::timerSetFlags2(%i)", timerNum);
if (!((uint32*)(_flagsTable+0x2D))[timerNum])
- ((uint32*)(_flagsTable+0x2D))[timerNum] = 1;
+ ((uint32*)(_flagsTable+0x2D))[timerNum] = 1;
}
void KyraEngine_v1::timerCheckAnimFlag1(int timerNum) {
diff --git a/engines/kyra/timer_v2.cpp b/engines/kyra/timer_v2.cpp
index 1b12db4e9f..7a0fe5b03f 100644
--- a/engines/kyra/timer_v2.cpp
+++ b/engines/kyra/timer_v2.cpp
@@ -22,7 +22,7 @@
* $Id$
*
*/
-
+
#include "kyra/kyra_v2.h"
#include "kyra/timer.h"
@@ -32,7 +32,7 @@ namespace Kyra {
void KyraEngine_v2::setupTimers() {
debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::setupTimers()");
-
+
_timer->addTimer(0, 0, 5, 1);
_timer->addTimer(1, TimerV2(timerFunc2), -1, 1);
_timer->addTimer(2, TimerV2(timerCauldronAnimation), 1, 1);
@@ -96,7 +96,7 @@ void KyraEngine_v2::setTimer1DelaySecs(int secs) {
if (secs == -1)
secs = 32000;
-
+
_timer->setCountdown(1, secs * 60);
}
diff --git a/engines/kyra/util.h b/engines/kyra/util.h
index 072f4996f1..1c4b8462cc 100644
--- a/engines/kyra/util.h
+++ b/engines/kyra/util.h
@@ -42,9 +42,9 @@ template<class Res, class T>
class Functor0Mem : public Functor0<Res> {
public:
typedef Res (T::*FuncType)();
-
+
Functor0Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
-
+
bool isValid() const { return _func != 0; }
Res operator()() const {
return (_t->*_func)();
@@ -66,9 +66,9 @@ template<class Arg, class Res, class T>
class Functor1Mem : public Functor1<Arg, Res> {
public:
typedef Res (T::*FuncType)(Arg);
-
+
Functor1Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
-
+
bool isValid() const { return _func != 0; }
Res operator()(Arg v1) const {
return (_t->*_func)(v1);
diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h
index 53f1819b30..5e97e1a5fb 100644
--- a/engines/kyra/wsamovie.h
+++ b/engines/kyra/wsamovie.h
@@ -57,7 +57,7 @@ public:
protected:
KyraEngine *_vm;
bool _opened;
-
+
int _x, _y;
int _drawPage;
};
@@ -103,7 +103,7 @@ public:
void close();
void displayFrame(int frameNum, ...);
-private:
+private:
void processFrame(int frameNum, uint8 *dst);
uint8 *_buffer;
@@ -112,23 +112,23 @@ private:
class WSAMovieV2 : public WSAMovieV1 {
public:
WSAMovieV2(KyraEngine_v2 *vm);
-
+
int open(const char *filename, int unk1, uint8 *palette);
-
+
virtual void displayFrame(int frameNum, ...);
void setX(int x) { _x = x + _xAdd; }
void setY(int y) { _y = y + _yAdd; }
-
+
int xAdd() const { return _xAdd; }
int yAdd() const { return _yAdd; }
-
+
int width() const { return _width; }
int height() const { return _height; }
void setWidth(int w) { _width = w; }
void setHeight(int h) { _height = h; }
-
+
// HACK for our intro code
void flagOldOff(bool enabled) { _oldOff = enabled; }
protected: