Cleanup(/formatting).

svn-id: r29983
This commit is contained in:
Johannes Schickel 2007-12-24 22:27:30 +00:00
parent 6b722c2f1c
commit 28a57c434a
11 changed files with 47 additions and 53 deletions

View file

@ -392,3 +392,4 @@ void KyraEngine_v2::resetCharacterAnimDim() {
}
} // end of namespace Kyra

View file

@ -444,3 +444,4 @@ void KyraEngine_v2::removeHandItem() {
}
} // end of namespace Kyra

View file

@ -895,11 +895,10 @@ void KyraEngine_v1::updateMousePointer(bool forceUpdate) {
if (mouse.y > 158 || (mouse.x >= 12 && mouse.x < 308 && mouse.y < 136 && mouse.y >= 12) || forceUpdate) {
_mouseState = _itemInHand;
_screen->hideMouse();
if (_itemInHand == -1) {
if (_itemInHand == -1)
_screen->setMouseCursor(1, 1, _shapes[0]);
} else {
else
_screen->setMouseCursor(8, 15, _shapes[216+_itemInHand]);
}
_screen->showMouse();
}
}
@ -966,11 +965,10 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) {
charLeft = currentChar->x1 - 12;
charRight = currentChar->x1 + 11;
charTop = currentChar->y1 - 48;
// if (!i) {
// if (!i)
// charBottom = currentChar->y2 - 16;
// } else {
// else
charBottom = currentChar->y1;
// }
if (xpos < charLeft || xpos > charRight || ypos < charTop || charBottom < ypos)
continue;

View file

@ -179,7 +179,8 @@ int KyraEngine_v2::go() {
if (_flags.platform == Common::kPlatformPC && (_flags.isTalkie || _flags.isDemo)) {
_res->loadFileList("FILEDATA.FDT");
} else if (_flags.platform == Common::kPlatformPC) {
//TODO
//TODO:
//What files are needed for floppy version?
} else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
char tmpfilename[13];
static const char * pakfiles [] = { "KYRA.DAT", "AUDIO.PAK", "CAULDRON.PAK",
@ -807,7 +808,8 @@ void KyraEngine_v2::loadChapterBuffer(int chapter) {
}
void KyraEngine_v2::changeFileExtension(char *buffer) {
while (*buffer != '.') ++buffer;
while (*buffer != '.')
++buffer;
++buffer;
strcpy(buffer, _languageExtension[_lang]);
@ -985,6 +987,7 @@ void KyraEngine_v2::loadZShapes(int shapes) {
for (int i = 9; i <= 32; ++i) {
delete [] _defaultShapeTable[i];
_defaultShapeTable[i] = _screen->makeShapeCopy(data, i-9);
assert(_defaultShapeTable[i]);
}
delete [] data;
@ -997,8 +1000,10 @@ void KyraEngine_v2::loadInventoryShapes() {
_screen->loadBitmap("_PLAYALL.CPS", 3, 3, 0);
for (int i = 0; i < 10; ++i)
for (int i = 0; i < 10; ++i) {
_defaultShapeTable[240+i] = _screen->encodeShape(_inventoryX[i], _inventoryY[i], 16, 16, 0);
assert(_defaultShapeTable[240+i]);
}
_screen->_curPage = curPageBackUp;
}
@ -1088,8 +1093,7 @@ void KyraEngine_v2::runTemporaryScript(const char *filename, int unk1, int unk2,
#pragma mark -
void KyraEngine_v2::resetScaleTable() {
for (int i = 0; i < ARRAYSIZE(_scaleTable); ++i)
_scaleTable[i] = 0x100;
Common::set_to(_scaleTable, _scaleTable + ARRAYSIZE(_scaleTable), 0x100);
}
void KyraEngine_v2::setScaleTableItem(int item, int data) {
@ -1308,6 +1312,7 @@ void KyraEngine_v2::updateCharAnimFrame(int charId, int *table) {
Character *character = &_mainCharacter;
++character->animFrame;
int facing = character->facing;
if (table) {

View file

@ -726,11 +726,9 @@ int KyraEngine_v2::findWay(int x, int y, int toX, int toY, int *moveTable, int m
y &= ~1; toY &= ~1;
int size = KyraEngine::findWay(x, y, toX, toY, moveTable, moveTableSize);
if (size) {
/*
int temp = pathfinderUnk1(moveTable);
temp = pathfinderUnk3(temp, x, y);
pathfinderUnk5(moveTable, temp, x, y, moveTableSize);
*/
//int temp = pathfinderUnk1(moveTable);
//temp = pathfinderUnk3(temp, x, y);
//pathfinderUnk5(moveTable, temp, x, y, moveTableSize);
}
return getMoveTableSize(moveTable);
}
@ -909,3 +907,4 @@ void KyraEngine_v2::fadeScenePal(int srcIndex, int delayTime) {
}
} // end of namespace Kyra

View file

@ -1113,7 +1113,6 @@ void Screen::setScreenDim(int dim) {
debugC(9, kDebugLevelScreen, "Screen::setScreenDim(%d)", dim);
assert(dim < _screenDimTableCount);
_curDim = &_screenDimTable[dim];
// XXX
}
void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {

View file

@ -748,3 +748,4 @@ void Screen_v2::setTextColorMap(const uint8 *cmap) {
}
} // end of namespace Kyra

View file

@ -408,6 +408,7 @@ int KyraEngine_v2::o2_drawSceneShapeOnPage(ScriptState *script) {
int y = stackPos(2);
int flag = stackPos(3);
int drawPage = stackPos(4);
_screen->drawShape(drawPage, _sceneShapeTable[shape], x, y, 2, flag ? 1 : 0);
return 0;
}
@ -416,13 +417,17 @@ int KyraEngine_v2::o2_restoreBackBuffer(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_restoreBackBuffer(%p) (%d)", (const void *)script, stackPos(0));
int disable = stackPos(0);
int oldState = 0;
if (disable) {
oldState = _animObjects[0].enabled;
_animObjects[0].enabled = 0;
}
restorePage3();
if (disable)
_animObjects[0].enabled = oldState;
return 0;
}
@ -567,7 +572,6 @@ int KyraEngine_v2::o2_runTemporaryScript(ScriptState *script) {
stackPos(2), stackPos(3));
runTemporaryScript(stackPosString(0), stackPos(3), stackPos(2) ? 1 : 0, stackPos(1), stackPos(2));
return 0;
}
@ -709,9 +713,7 @@ int KyraEngine_v2::o2_querySpecialSceneScriptState(ScriptState *script) {
int KyraEngine_v2::o2_setHiddenItemsEntry(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
int item = stackPos(1);
_hiddenItems[stackPos(0)] = item;
return item;
return (_hiddenItems[stackPos(0)] = stackPos(1));
}
int KyraEngine_v2::o2_getHiddenItemsEntry(ScriptState *script) {
@ -826,3 +828,4 @@ int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) {
}
} // end of namespace Kyra

View file

@ -60,17 +60,16 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
_screen->_charWidth = -2;
memset(_activeWSA, 0, sizeof(ActiveWSA) * 8);
for (int i = 0; i < 8; i++)
for (int i = 0; i < 8; ++i)
_activeWSA[i].flags = -1;
memset(_activeText, 0, sizeof(ActiveText) * 10);
seq_resetAllTextEntries();
_screen->hideMouse();
int oldPage = _screen->setCurPage(2);
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; ++i)
memset(_screen->getPalette(i), 0, 0x300);
_screen->clearPage(10);
@ -103,8 +102,7 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
(this->*_sequences[seqNum].callback)(0, 0, 0, -1);
if (_sequences[seqNum].flags & 1) {
if (_seqWsa->opened())
_seqWsa->close();
_seqWsa->close();
_seqWsa->open(_sequences[seqNum].wsaFile, 0, _screen->getPalette(0));
_seqWsa->setX(_sequences[seqNum].xPos);
_seqWsa->setY(_sequences[seqNum].yPos);
@ -207,7 +205,6 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
_screen->updateScreen();
}
uint32 now = _system->getMillis();
if (now >= _seqEndTime) {
loop2 = false;
@ -233,8 +230,6 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
}
}
_seqWsa->close();
} else {
_seqFrameDelay = _sequences[seqNum].frameDelay;
_seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength;
@ -316,8 +311,7 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
for (int i = 0; i < 8; i++)
seq_unloadWSA(i);
if (_seqWsa->opened())
_seqWsa->close();
_seqWsa->close();
_screen->_charWidth = 0;
@ -491,7 +485,6 @@ int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) {
seq_resetActiveWSA(0);
seq_loadNestedSequence(0, kSequenceDarm);
break;
case 104:
@ -577,7 +570,6 @@ int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) {
if (!((_seqFrameCounter == 260 && !_flags.isTalkie) || (_seqFrameCounter == 395 && _flags.isTalkie)))
break;
seq_waitForTextsTimeout();
seq_resetActiveWSA(0);
seq_loadNestedSequence(1, kSequenceHand3);
@ -599,7 +591,6 @@ int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) {
if (!((_seqFrameCounter == 405 && !_flags.isTalkie) || (_seqFrameCounter == 540 && _flags.isTalkie)))
break;
seq_playTalkText(10);
break;
@ -763,8 +754,8 @@ int KyraEngine_v2::seq_introForest(WSAMovieV2 *wsaObj, int x, int y, int frm) {
if (frm == 11) {
seq_waitForTextsTimeout();
} else if (frm == 12) {
if (_flags.lang == Common::FR_FRA)
{}//// TODO
//if (_flags.lang == Common::FR_FRA)
//XXX
seq_playTalkText(2);
}
return frm;
@ -904,7 +895,6 @@ int KyraEngine_v2::seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm)
seq_playWsaSyncDialogue(23, voiceIndex, 137, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y);
if (_flags.isTalkie)
_seqWsaCurrentFrame = 17;
break;
default:
@ -945,7 +935,6 @@ int KyraEngine_v2::seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm) {
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 255;
_screen->setTextColorMap(_seqTextColorMap);
break;
case 5:
@ -970,7 +959,6 @@ int KyraEngine_v2::seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm) {
case 11:
if (_flags.isTalkie)
seq_playWsaSyncDialogue(24, 22, 149, 116, 90, 60, wsaObj, 11, 14, x, y);
break;
case 16:
@ -1232,7 +1220,6 @@ int KyraEngine_v2::seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm) {
chatW = 100;
seq_playWsaSyncDialogue(29, voiceIndex, 150, chatX, chatY, chatW, wsaObj, 12, -21, x, y);
break;
default:
@ -1548,7 +1535,7 @@ void KyraEngine_v2::seq_finaleActorScreen() {
static const uint8 colormap[] = {0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
_screen->setTextColorMap(colormap);
// TODO
//XXX
snd_assignMusicData(kMusicFinale);
_sound->loadSoundFile(0);
@ -1667,7 +1654,7 @@ void KyraEngine_v2::seq_sequenceCommand(int command) {
case 1:
memset(pal, 0x3F, 0x300);
//////////TODO
//////////XXX
//////////Unused anyway (at least by fm-towns intro/outro)
_screen->fadePalette(pal, 16);
@ -1817,8 +1804,7 @@ void KyraEngine_v2::seq_loadNestedSequence(int wsaNum, int seqNum) {
assert(_activeWSA[wsaNum].movie);
}
if (_activeWSA[wsaNum].movie->opened())
_activeWSA[wsaNum].movie->close();
_activeWSA[wsaNum].movie->close();
_activeWSA[wsaNum].movie->open(s.wsaFile, 0, 0);
@ -1926,7 +1912,6 @@ void KyraEngine_v2::seq_nestedSequenceFrame(int command, int wsaNum) {
void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime, int steps,
int x, int y, int w, int h, int openClose, int directionFlags) {
if (openClose) {
for (int i = 1; i < steps; i++) {
uint32 endtime = _system->getMillis() + delaytime * _tickLength;
@ -2248,16 +2233,15 @@ void KyraEngine_v2::seq_makeBookOrCauldronAppear(int type) {
_screen->hideMouse();
showMessage(0, 0xCF);
if (type == 1) {
if (type == 1)
seq_makeBookAppear();
} else if (type == 2) {
else if (type == 2)
loadInvWsa("CAULDRON.WSA", 1, 6, 0, -2, -2, 1);
}
_screen->copyRegionToBuffer(2, 0, 0, 320, 200, _screenBuffer);
_screen->loadBitmap("_PLAYALL.CPS", 3, 3, 0);
static int16 bookCauldronRects[] = {
static const uint8 bookCauldronRects[] = {
0x46, 0x90, 0x7F, 0x2B, // unknown rect (maybe unused?)
0xCE, 0x90, 0x2C, 0x2C, // book rect
0xFA, 0x90, 0x46, 0x2C // cauldron rect
@ -2355,8 +2339,8 @@ const Sequence KyraEngine_v2::_sequences_PC[] = {
// flags, wsaFile, cpsFile, startupCommand, finalCommand, stringIndex1, stringIndex2,
// startFrame, numFrames, frameDelay, xPos, yPos, callback, duration
{ 2, 0, "virgin.cps", 4, 0, -1, -1, 0, 1, 100, 0, 0, 0, 30 },
{ 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 6, 0, 0, &KyraEngine_v2::seq_introWestwood, 160 },
{ 1, "title.wsa", 0, 4, 0, -1, -1, 0, 26, 6, 0, 0, &KyraEngine_v2::seq_introTitle, 10 },
{ 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 6, 0, 0, &KyraEngine_v2::seq_introWestwood, 160 },
{ 1, "title.wsa", 0, 4, 0, -1, -1, 0, 26, 6, 0, 0, &KyraEngine_v2::seq_introTitle, 10 },
{ 2, 0, "over.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introOverview, 30 },
{ 2, 0, "library.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introLibrary, 30 },
{ 2, 0, "hand.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introHand, 90 },

View file

@ -235,9 +235,8 @@ void SoundMidiPC::metaEvent(byte type, byte *data, uint16 length) {
case 0x2F: // End of Track
if (_eventFromMusic) {
// remap all channels
for (int i = 0; i < 16; ++i) {
for (int i = 0; i < 16; ++i)
_virChannel[i] = i;
}
} else {
_sfxIsPlaying = false;
}

View file

@ -49,16 +49,19 @@ void TextDisplayer_v2::restoreScreen() {
char *TextDisplayer_v2::preprocessString(const char *str) {
debugC(9, kDebugLevelMain, "TextDisplayer_v2::preprocessString('%s')", str);
if (str != _talkBuffer) {
assert(strlen(str) < sizeof(_talkBuffer) - 1);
strcpy(_talkBuffer, str);
}
char *p = _talkBuffer;
while (*p) {
if (*p == '\r')
return _talkBuffer;
++p;
}
p = _talkBuffer;
Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
_screen->_charWidth = -2;
@ -473,5 +476,6 @@ void KyraEngine_v2::freeTIM(byte *buffer) {
delete[] buffer;
}
}
} // end of namespace Kyra