Remove trailing tabs/whitespaces.

svn-id: r40760
This commit is contained in:
Johannes Schickel 2009-05-21 13:13:09 +00:00
parent b7f8990ba8
commit e51481d69b
20 changed files with 182 additions and 182 deletions

View file

@ -1180,7 +1180,7 @@ int LoLEngine::clickedPortraitEtcRight(Button *button) {
if (flg & 1) { if (flg & 1) {
if (!(_characters[c].flags & 8) || (flg & 0x20)) { if (!(_characters[c].flags & 8) || (flg & 0x20)) {
runItemScript(c, _itemInHand, 0x400, 0, 0); runItemScript(c, _itemInHand, 0x400, 0, 0);
runLevelScriptCustom(_currentBlock, 0x400, c, _itemInHand, 0, 0); runLevelScriptCustom(_currentBlock, 0x400, c, _itemInHand, 0, 0);
} else { } else {
_txt->printMessage(2, getLangString(0x402c), _characters[c].name); _txt->printMessage(2, getLangString(0x402c), _characters[c].name);
} }
@ -1466,7 +1466,7 @@ int LoLEngine::clickedScroll(Button *button) {
int LoLEngine::clickedSpellTargetCharacter(Button *button) { int LoLEngine::clickedSpellTargetCharacter(Button *button) {
int t = button->arg; int t = button->arg;
_txt->printMessage(0, "%s.\r", _characters[t].name); _txt->printMessage(0, "%s.\r", _characters[t].name);
if ((_spellProperties[_activeSpell.spell].flags & 0xff) == 1) { if ((_spellProperties[_activeSpell.spell].flags & 0xff) == 1) {
_activeSpell.target = t; _activeSpell.target = t;
castHealOnSingleCharacter(&_activeSpell); castHealOnSingleCharacter(&_activeSpell);
@ -1525,7 +1525,7 @@ int LoLEngine::clickedOptions(Button *button) {
int LoLEngine::clickedRestParty(Button *button) { int LoLEngine::clickedRestParty(Button *button) {
gui_toggleButtonDisplayMode(77, 1); gui_toggleButtonDisplayMode(77, 1);
Button b; Button b;
memset(&b, 0, sizeof(Button)); memset(&b, 0, sizeof(Button));
b.data0Val2 = b.data1Val2 = b.data2Val2 = 0xfe; b.data0Val2 = b.data1Val2 = b.data2Val2 = 0xfe;
@ -1539,7 +1539,7 @@ int LoLEngine::clickedRestParty(Button *button) {
int tHa = -1; int tHa = -1;
int needPoisoningFlags = 0; int needPoisoningFlags = 0;
int needHealingFlags = 0; int needHealingFlags = 0;
int needMagicGainFlags = 0; int needMagicGainFlags = 0;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
LoLCharacter *c = &_characters[i]; LoLCharacter *c = &_characters[i];
@ -1553,7 +1553,7 @@ int LoLEngine::clickedRestParty(Button *button) {
tMp = c->magicPointsMax; tMp = c->magicPointsMax;
if (c->flags & 0x80) { if (c->flags & 0x80) {
needPoisoningFlags |= (1 << i); needPoisoningFlags |= (1 << i);
if (c->hitPointsCur > tHa) if (c->hitPointsCur > tHa)
tHa = c->hitPointsCur; tHa = c->hitPointsCur;
} else { } else {
@ -1572,7 +1572,7 @@ int LoLEngine::clickedRestParty(Button *button) {
if (needHealingFlags || needMagicGainFlags) { if (needHealingFlags || needMagicGainFlags) {
_screen->fillRect(112, 0, 288, 120, 1); _screen->fillRect(112, 0, 288, 120, 1);
gui_drawAllCharPortraitsWithStats(); gui_drawAllCharPortraitsWithStats();
_txt->printMessage(0x8000, getLangString(0x4057)); _txt->printMessage(0x8000, getLangString(0x4057));
gui_toggleButtonDisplayMode(77, 0); gui_toggleButtonDisplayMode(77, 0);
@ -1626,11 +1626,11 @@ int LoLEngine::clickedRestParty(Button *button) {
} else if (f) { } else if (f) {
gui_triggerEvent(f); gui_triggerEvent(f);
break; break;
} }
if (!_partyAwake) { if (!_partyAwake) {
if (_system->getMillis() > delay3) { if (_system->getMillis() > delay3) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (!(needPoisoningFlags & (1 << i))) if (!(needPoisoningFlags & (1 << i)))
continue; continue;
inflictDamage(i, 1, 0x8000, 1, 0x80); inflictDamage(i, 1, 0x8000, 1, 0x80);
@ -1639,42 +1639,42 @@ int LoLEngine::clickedRestParty(Button *button) {
} }
delay3 = _system->getMillis() + a * _tickLength; delay3 = _system->getMillis() + a * _tickLength;
} }
if (_system->getMillis() > delay1) { if (_system->getMillis() > delay1) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (!(needHealingFlags & (1 << i))) if (!(needHealingFlags & (1 << i)))
continue; continue;
increaseCharacterHitpoints(i, 1, false); increaseCharacterHitpoints(i, 1, false);
gui_drawCharPortraitWithStats(i); gui_drawCharPortraitWithStats(i);
if (_characters[i].hitPointsCur == _characters[i].hitPointsMax) if (_characters[i].hitPointsCur == _characters[i].hitPointsMax)
needHealingFlags &= ~(1 << i); needHealingFlags &= ~(1 << i);
} }
delay1 = _system->getMillis() + h * _tickLength; delay1 = _system->getMillis() + h * _tickLength;
} }
if (_system->getMillis() > delay2) { if (_system->getMillis() > delay2) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (!(needMagicGainFlags & (1 << i))) if (!(needMagicGainFlags & (1 << i)))
continue; continue;
_characters[i].magicPointsCur++; _characters[i].magicPointsCur++;
gui_drawCharPortraitWithStats(i); gui_drawCharPortraitWithStats(i);
if (_characters[i].magicPointsCur == _characters[i].magicPointsMax) if (_characters[i].magicPointsCur == _characters[i].magicPointsMax)
needMagicGainFlags &= ~(1 << i); needMagicGainFlags &= ~(1 << i);
} }
delay2 = _system->getMillis() + m * _tickLength; delay2 = _system->getMillis() + m * _tickLength;
} }
_screen->updateScreen(); _screen->updateScreen();
} }
} while (!_partyAwake && (needHealingFlags || needMagicGainFlags)); } while (!_partyAwake && (needHealingFlags || needMagicGainFlags));
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
int frm = 0; int frm = 0;
int upd = 0; int upd = 0;
bool setframe = true; bool setframe = true;
if (_characters[i].flags & 0x1000) { if (_characters[i].flags & 0x1000) {
_characters[i].flags &= 0xefff; _characters[i].flags &= 0xefff;
if (_partyAwake) { if (_partyAwake) {
if (_characters[i].damageSuffered) { if (_characters[i].damageSuffered) {

View file

@ -324,10 +324,10 @@ void LoLEngine::setItemPosition(int item, uint16 x, uint16 y, int flyingHeight,
else else
_itemsInPlay[item].shpCurFrame_flg &= 0xbfff; _itemsInPlay[item].shpCurFrame_flg &= 0xbfff;
assignItemToBlock(&_levelBlockProperties[block].assignedObjects, item); assignItemToBlock(&_levelBlockProperties[block].assignedObjects, item);
reassignDrawObjects(_currentDirection, item, &_levelBlockProperties[block], false); reassignDrawObjects(_currentDirection, item, &_levelBlockProperties[block], false);
if (b) if (b)
runLevelScriptCustom(block, 0x80, -1, item, 0, 0); runLevelScriptCustom(block, 0x80, -1, item, 0, 0);
@ -383,7 +383,7 @@ bool LoLEngine::launchObject(int objectType, int item, int startX, int startY, i
t->attackerId = attackerId; t->attackerId = attackerId;
t->flags = 7; t->flags = 7;
t->wallFlags = 2; t->wallFlags = 2;
t->c = c; t->c = c;
if (attackerId != -1) { if (attackerId != -1) {
if (attackerId & 0x8000) { if (attackerId & 0x8000) {
@ -456,13 +456,13 @@ void LoLEngine::objectFlightProcessHits(FlyingObject *t, int x, int y, int objec
} else if (objectOnNextBlock == 2) { } else if (objectOnNextBlock == 2) {
if (_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000) { if (_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000) {
int o = _levelBlockProperties[_itemsInPlay[t->item].block].assignedObjects; int o = _levelBlockProperties[_itemsInPlay[t->item].block].assignedObjects;
while (o & 0x8000) { while (o & 0x8000) {
ItemInPlay *i = findObject(o); ItemInPlay *i = findObject(o);
o = i->nextAssignedObject; o = i->nextAssignedObject;
runItemScript(t->attackerId, t->item, 0x8000, o, 0); runItemScript(t->attackerId, t->item, 0x8000, o, 0);
} }
return; return;
} else { } else {

View file

@ -642,7 +642,7 @@ int LoLEngine::checkInput(Button *buttonList, bool mainLoop) {
if (!inputFlag) { if (!inputFlag) {
// This fixes a bug with some interactive sequences (like the inn where you mee Timothy). // This fixes a bug with some interactive sequences (like the inn where you mee Timothy).
// In the original code Mouse position variables are only updated when mouse button // In the original code Mouse position variables are only updated when mouse button
// or keyboard events get triggered. // or keyboard events get triggered.
// TODO/FIXME: Check whether this is the correct way to do it in KYRA, too. In this case a // TODO/FIXME: Check whether this is the correct way to do it in KYRA, too. In this case a
// fix could be added to KyraEngine_v1::checkInput() and the virtual stuff would not be // fix could be added to KyraEngine_v1::checkInput() and the virtual stuff would not be
@ -973,7 +973,7 @@ void LoLEngine::decodeSjis(const char *src, char *dst) {
*dst++ = *src++; *dst++ = *src++;
} }
cmd = *src++; cmd = *src++;
} else { } else {
s[0] = *src++; s[0] = *src++;
Util::decodeString1(s, d); Util::decodeString1(s, d);
@ -1259,7 +1259,7 @@ void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points,
} else { } else {
c->hitPointsCur = newVal; c->hitPointsCur = newVal;
if (c->hitPointsCur < 1) if (c->hitPointsCur < 1)
c->flags |= 8; c->flags |= 8;
} }
if (_updateFlags & 2) if (_updateFlags & 2)
@ -1268,7 +1268,7 @@ void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points,
Screen::FontId cf = _screen->setFont(Screen::FID_6_FNT); Screen::FontId cf = _screen->setFont(Screen::FID_6_FNT);
int cp = _screen->setCurPage(0); int cp = _screen->setCurPage(0);
int s = 8192 / pointsMax; int s = 8192 / pointsMax;
pointsMax = (s * pointsMax) >> 8; pointsMax = (s * pointsMax) >> 8;
pointsCur = (s * pointsCur) >> 8; pointsCur = (s * pointsCur) >> 8;
newVal = (s * newVal) >> 8; newVal = (s * newVal) >> 8;
@ -1279,7 +1279,7 @@ void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points,
if (newVal != pointsCur) { if (newVal != pointsCur) {
step = (newVal >= pointsCur) ? 2 : -2; step = (newVal >= pointsCur) ? 2 : -2;
for (int i = pointsCur; i != newVal || newVal != newValScl;) { for (int i = pointsCur; i != newVal || newVal != newValScl;) {
if (ABS(i - newVal) < ABS(step)) if (ABS(i - newVal) < ABS(step))
step >>= 1; step >>= 1;
@ -1295,7 +1295,7 @@ void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points,
if (i == newVal) { if (i == newVal) {
newVal = newValScl; newVal = newValScl;
step = -step; step = -step;
} }
delayUntil(_smoothScrollTimer); delayUntil(_smoothScrollTimer);
} }
@ -1559,7 +1559,7 @@ void LoLEngine::fadeText() {
void LoLEngine::transformRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage) { void LoLEngine::transformRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage) {
uint16 *p1 = (uint16*) _tempBuffer5120; uint16 *p1 = (uint16*) _tempBuffer5120;
uint16 *p2 = (uint16*) (_tempBuffer5120 + 640); uint16 *p2 = (uint16*) (_tempBuffer5120 + 640);
for (int i = 0; i < w; i++) for (int i = 0; i < w; i++)
p1[i] = i; p1[i] = i;
@ -2126,7 +2126,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
_txt->printMessage(2, getLangString(0x4257)); _txt->printMessage(2, getLangString(0x4257));
return 0; return 0;
} }
if (charNum < 0) { if (charNum < 0) {
_activeSpell.charNum = (charNum * -1) - 1; _activeSpell.charNum = (charNum * -1) - 1;
if (_spellProcs[spellType]->isValid()) if (_spellProcs[spellType]->isValid())
@ -2145,7 +2145,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
if (_spellProcs[spellType]->isValid()) if (_spellProcs[spellType]->isValid())
(*_spellProcs[spellType])(&_activeSpell); (*_spellProcs[spellType])(&_activeSpell);
} }
return 1; return 1;
} }
@ -2247,7 +2247,7 @@ void LoLEngine::processMagicSpark(int charNum, int spellLevel) {
uint16 wFrames[6]; uint16 wFrames[6];
const uint16 width = mov->width(); const uint16 width = mov->width();
const uint16 height = mov->height(); const uint16 height = mov->height();
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
wX[i] = (_rnd.getRandomNumber(0x7fff) % 64) + ((176 - width) >> 1) + 80; wX[i] = (_rnd.getRandomNumber(0x7fff) % 64) + ((176 - width) >> 1) + 80;
wY[i] = (_rnd.getRandomNumber(0x7fff) % 32) + ((120 - height) >> 1) - 16; wY[i] = (_rnd.getRandomNumber(0x7fff) % 32) + ((120 - height) >> 1) - 16;
@ -2261,7 +2261,7 @@ void LoLEngine::processMagicSpark(int charNum, int spellLevel) {
for (int ii = 0; ii <= spellLevel; ii++) { for (int ii = 0; ii <= spellLevel; ii++) {
if (wFrames[ii] >= i || wFrames[ii] + 13 <= i) if (wFrames[ii] >= i || wFrames[ii] + 13 <= i)
continue; continue;
if ((i - wFrames[ii]) == 1) if ((i - wFrames[ii]) == 1)
snd_playSoundEffect(162, -1); snd_playSoundEffect(162, -1);
@ -2405,9 +2405,9 @@ void LoLEngine::processMagicHeal(int charNum, int spellLevel) {
void LoLEngine::processMagicIce(int charNum, int spellLevel) { void LoLEngine::processMagicIce(int charNum, int spellLevel) {
int cp = _screen->setCurPage(2); int cp = _screen->setCurPage(2);
disableSysTimer(2); disableSysTimer(2);
gui_drawScene(0); gui_drawScene(0);
_screen->copyPage(0, 12); _screen->copyPage(0, 12);
@ -2428,7 +2428,7 @@ void LoLEngine::processMagicIce(int charNum, int spellLevel) {
////////// TODO ////////// TODO
generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampEffect); generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampEffect);
////////// TODO ////////// TODO
_screen->setCurPage(cp); _screen->setCurPage(cp);
@ -2456,7 +2456,7 @@ void LoLEngine::processMagicFog() {
error("Fog: Unable to load fog.wsa"); error("Fog: Unable to load fog.wsa");
snd_playSoundEffect(145, -1); snd_playSoundEffect(145, -1);
for (int curFrame = 0; curFrame < numFrames; curFrame++) { for (int curFrame = 0; curFrame < numFrames; curFrame++) {
_smoothScrollTimer = _system->getMillis() + 3 * _tickLength; _smoothScrollTimer = _system->getMillis() + 3 * _tickLength;
_screen->copyPage(12, 2); _screen->copyPage(12, 2);
@ -2465,7 +2465,7 @@ void LoLEngine::processMagicFog() {
_screen->updateScreen(); _screen->updateScreen();
delayUntil(_smoothScrollTimer); delayUntil(_smoothScrollTimer);
} }
mov->close(); mov->close();
delete mov; delete mov;
@ -2486,7 +2486,7 @@ void LoLEngine::processMagicSwarm(int charNum, int damage) {
int cp = _screen->setCurPage(2); int cp = _screen->setCurPage(2);
_screen->copyPage(0, 12); _screen->copyPage(0, 12);
snd_playSoundEffect(74, -1); snd_playSoundEffect(74, -1);
uint16 destIds[6]; uint16 destIds[6];
uint8 destModes[6]; uint8 destModes[6];
int8 destTicks[6]; int8 destTicks[6];
@ -2501,7 +2501,7 @@ void LoLEngine::processMagicSwarm(int charNum, int damage) {
o &= 0x7fff; o &= 0x7fff;
if (_monsters[o].mode != 13) { if (_monsters[o].mode != 13) {
destIds[t++] = o; destIds[t++] = o;
if (!(_monsters[o].flags & 0x2000)) { if (!(_monsters[o].flags & 0x2000)) {
_envSfxUseQueue = true; _envSfxUseQueue = true;
inflictMagicalDamage(o | 0x8000, charNum, damage, 0, 0); inflictMagicalDamage(o | 0x8000, charNum, damage, 0, 0);
@ -2562,7 +2562,7 @@ void LoLEngine::addSpellToScroll(int spell, int charNum) {
assigned = true; assigned = true;
slot = i; slot = i;
} }
if (_availableSpells[i] == spell) { if (_availableSpells[i] == spell) {
_txt->printMessage(2, getLangString(0x42d0)); _txt->printMessage(2, getLangString(0x42d0));
return; return;
@ -2617,7 +2617,7 @@ void LoLEngine::transferSpellToScollAnimation(int charNum, int spell, int slot)
_screen->copyPage(0, 12); _screen->copyPage(0, 12);
int vX = _updateSpellBookCoords[slot << 1] + 32; int vX = _updateSpellBookCoords[slot << 1] + 32;
int vY = _updateSpellBookCoords[(slot << 1) + 1] + 5; int vY = _updateSpellBookCoords[(slot << 1) + 1] + 5;
char wsaFile[13]; char wsaFile[13];
snprintf(wsaFile, 13, "write%0d%c.wsa", spell, (_lang == 1) ? 'f' : (_lang == 0 ? 'e' : 'g')); snprintf(wsaFile, 13, "write%0d%c.wsa", spell, (_lang == 1) ? 'f' : (_lang == 0 ? 'e' : 'g'));
snd_playSoundEffect(_updateSpellBookAnimData[(spell << 2) + 3], -1); snd_playSoundEffect(_updateSpellBookAnimData[(spell << 2) + 3], -1);
@ -2681,7 +2681,7 @@ void LoLEngine::transferSpellToScollAnimation(int charNum, int spell, int slot)
void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFrame, int frameDelay, int x, int y, SpellProcCallback callback, uint8 *pal1, uint8 *pal2, int fadeDelay, bool restoreScreen) { void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFrame, int frameDelay, int x, int y, SpellProcCallback callback, uint8 *pal1, uint8 *pal2, int fadeDelay, bool restoreScreen) {
int w = 0; int w = 0;
int h = 0; int h = 0;
if (mov) { if (mov) {
w = mov->width(); w = mov->width();
h = mov->height(); h = mov->height();
@ -2720,7 +2720,7 @@ void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFra
int del = _smoothScrollTimer - _system->getMillis(); int del = _smoothScrollTimer - _system->getMillis();
do { do {
int step = del > _tickLength ? _tickLength : del; int step = del > _tickLength ? _tickLength : del;
if (!pal1 || !pal2) { if (!pal1 || !pal2) {
@ -2877,7 +2877,7 @@ int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int ski
snd_queueEnvironmentalSoundEffect(m->properties->sounds[2], m->block); snd_queueEnvironmentalSoundEffect(m->properties->sounds[2], m->block);
checkSceneUpdateNeed(m->block); checkSceneUpdateNeed(m->block);
if (m->hitPoints <= 0) { if (m->hitPoints <= 0) {
m->hitPoints = 0; m->hitPoints = 0;
if (!(attacker & 0x8000)) if (!(attacker & 0x8000))
@ -2985,7 +2985,7 @@ int LoLEngine::calcInflictableDamagePerItem(int16 attacker, int16 target, uint16
return 0; return 0;
if (!(attacker & 0x8000)) { if (!(attacker & 0x8000)) {
dmg = (dmg * _characters[attacker].totalMightModifier) >> 8; dmg = (dmg * _characters[attacker].totalMightModifier) >> 8;
if (!dmg) if (!dmg)
return 0; return 0;
} }
@ -3134,7 +3134,7 @@ void LoLEngine::applyMonsterDefenseSkill(MonsterInPlay *monster, int16 attacker,
case 4: case 4:
if (!(deathFlag & 0x80)) if (!(deathFlag & 0x80))
return; return;
monster->hitPoints += damage; monster->hitPoints += damage;
if (monster->hitPoints > monster->properties->hitPoints) if (monster->hitPoints > monster->properties->hitPoints)
monster->hitPoints = monster->properties->hitPoints; monster->hitPoints = monster->properties->hitPoints;
@ -3173,7 +3173,7 @@ int LoLEngine::paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFl
return 0; return 0;
int r = 0; int r = 0;
if (typeFlag == 0x40) { if (typeFlag == 0x40) {
_characters[charNum].flags |= 0x40; _characters[charNum].flags |= 0x40;
setCharacterUpdateEvent(charNum, 3, 3600, 1); setCharacterUpdateEvent(charNum, 3, 3600, 1);
@ -3189,7 +3189,7 @@ int LoLEngine::paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFl
} else if (typeFlag == 0x1000) { } else if (typeFlag == 0x1000) {
_characters[charNum].flags |= 0x1000; _characters[charNum].flags |= 0x1000;
setCharacterUpdateEvent(charNum, 7, 120, 1); setCharacterUpdateEvent(charNum, 7, 120, 1);
r = 1; r = 1;
} }

View file

@ -339,7 +339,7 @@ private:
int getCharSelection(); int getCharSelection();
int selectionCharAccept(); int selectionCharAccept();
void showStarcraftLogo(); void showStarcraftLogo();
int _charSelection; int _charSelection;
@ -615,7 +615,7 @@ private:
int olol_getGlobalVar(EMCState *script); int olol_getGlobalVar(EMCState *script);
int olol_setGlobalVar(EMCState *script); int olol_setGlobalVar(EMCState *script);
int olol_triggerDoorSwitch(EMCState *script); int olol_triggerDoorSwitch(EMCState *script);
int olol_checkEquippedItemScriptFlags(EMCState *script); int olol_checkEquippedItemScriptFlags(EMCState *script);
int olol_setDoorState(EMCState *script); int olol_setDoorState(EMCState *script);
int olol_updateBlockAnimations(EMCState *script); int olol_updateBlockAnimations(EMCState *script);
int olol_mapShapeToBlock(EMCState *script); int olol_mapShapeToBlock(EMCState *script);
@ -701,7 +701,7 @@ private:
int olol_prepareSpecialScene(EMCState *script); int olol_prepareSpecialScene(EMCState *script);
int olol_restoreAfterSpecialScene(EMCState *script); int olol_restoreAfterSpecialScene(EMCState *script);
int olol_assignCustomSfx(EMCState *script); int olol_assignCustomSfx(EMCState *script);
int olol_checkBlockForMonster(EMCState *script); int olol_checkBlockForMonster(EMCState *script);
int olol_transformRegion(EMCState *script); int olol_transformRegion(EMCState *script);
int olol_calcCoordinatesAddDirectionOffset(EMCState *script); int olol_calcCoordinatesAddDirectionOffset(EMCState *script);
int olol_resetPortraitsAndDisableSysTimer(EMCState *script); int olol_resetPortraitsAndDisableSysTimer(EMCState *script);

View file

@ -53,7 +53,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
_screen->updateScreen(); _screen->updateScreen();
Common::SeekableSubReadStreamEndian in(saveFile, saveFile->pos(), saveFile->size(), !header.originalSave, true); Common::SeekableSubReadStreamEndian in(saveFile, saveFile->pos(), saveFile->size(), !header.originalSave, true);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
LoLCharacter *c = &_characters[i]; LoLCharacter *c = &_characters[i];
c->flags = in.readUint16BE(); c->flags = in.readUint16BE();
@ -148,7 +148,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
t->destDirection = in.readByte(); t->destDirection = in.readByte();
t->hitOffsX = in.readSByte(); t->hitOffsX = in.readSByte();
t->hitOffsY = in.readSByte(); t->hitOffsY = in.readSByte();
t->currentSubFrame = in.readByte(); t->currentSubFrame = in.readByte();
} }
for (int i = 0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
@ -228,7 +228,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
m->flags = in.readByte(); m->flags = in.readByte();
m->wallFlags = in.readByte(); m->wallFlags = in.readByte();
} }
l->monsterDifficulty = in.readByte(); l->monsterDifficulty = in.readByte();
} }
calcCharPortraitXpos(); calcCharPortraitXpos();
@ -345,7 +345,7 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra
out->writeUint16BE(t->y); out->writeUint16BE(t->y);
out->writeSByte(t->level); out->writeSByte(t->level);
out->writeUint16BE(t->itemPropertyIndex); out->writeUint16BE(t->itemPropertyIndex);
out->writeUint16BE(t->shpCurFrame_flg); out->writeUint16BE(t->shpCurFrame_flg);
out->writeByte(t->destDirection); out->writeByte(t->destDirection);
out->writeSByte(t->hitOffsX); out->writeSByte(t->hitOffsX);
out->writeSByte(t->hitOffsY); out->writeSByte(t->hitOffsY);
@ -363,7 +363,7 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra
out->write(l->flags, 1024); out->write(l->flags, 1024);
for (int ii = 0; ii < 30; ii++) { for (int ii = 0; ii < 30; ii++) {
MonsterInPlay *m = &l->monsters[ii]; MonsterInPlay *m = &l->monsters[ii];
out->writeUint16BE(m->nextAssignedObject); out->writeUint16BE(m->nextAssignedObject);
out->writeUint16BE(m->nextDrawObject); out->writeUint16BE(m->nextDrawObject);
out->writeByte(m->flyingHeight); out->writeByte(m->flyingHeight);
@ -372,7 +372,7 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra
out->writeUint16BE(m->y); out->writeUint16BE(m->y);
out->writeSByte(m->shiftStep); out->writeSByte(m->shiftStep);
out->writeUint16BE(m->destX); out->writeUint16BE(m->destX);
out->writeUint16BE(m->destY); out->writeUint16BE(m->destY);
out->writeByte(m->destDirection); out->writeByte(m->destDirection);
out->writeSByte(m->hitOffsX); out->writeSByte(m->hitOffsX);
out->writeSByte(m->hitOffsY); out->writeSByte(m->hitOffsY);
@ -403,13 +403,13 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra
out->writeUint16BE(m->x); out->writeUint16BE(m->x);
out->writeUint16BE(m->y); out->writeUint16BE(m->y);
out->writeByte(m->flyingHeight); out->writeByte(m->flyingHeight);
out->writeByte(m->direction); out->writeByte(m->direction);
out->writeByte(m->distance); out->writeByte(m->distance);
out->writeSByte(m->field_D); out->writeSByte(m->field_D);
out->writeByte(m->c); out->writeByte(m->c);
out->writeByte(m->flags); out->writeByte(m->flags);
out->writeByte(m->wallFlags); out->writeByte(m->wallFlags);
} }
out->writeByte(l->monsterDifficulty); out->writeByte(l->monsterDifficulty);
} }

View file

@ -1243,7 +1243,7 @@ void LoLEngine::pitDropScroll(int numSteps) {
del = _tickLength - (_system->getMillis() - ctime); del = _tickLength - (_system->getMillis() - ctime);
if (del > 0) if (del > 0)
delay(del, false, true); delay(del, false, true);
} }
_screen->copyRegionSpecial(2, 320, 200, 112, 0, 0, 320, 200, 112, 0, 176, 120, 0); _screen->copyRegionSpecial(2, 320, 200, 112, 0, 0, 320, 200, 112, 0, 176, 120, 0);
_screen->updateScreen(); _screen->updateScreen();
@ -1257,7 +1257,7 @@ void LoLEngine::pitDropScroll(int numSteps) {
void LoLEngine::shakeScene(int duration, int width, int height, int restore) { void LoLEngine::shakeScene(int duration, int width, int height, int restore) {
_screen->copyRegion(112, 0, 112, 0, 176, 120, 0, 6, Screen::CR_NO_P_CHECK); _screen->copyRegion(112, 0, 112, 0, 176, 120, 0, 6, Screen::CR_NO_P_CHECK);
uint32 endTime = _system->getMillis() + duration * _tickLength; uint32 endTime = _system->getMillis() + duration * _tickLength;
while (endTime > _system->getMillis()) { while (endTime > _system->getMillis()) {
_smoothScrollTimer = _system->getMillis() + 2 * _tickLength; _smoothScrollTimer = _system->getMillis() + 2 * _tickLength;
@ -1287,7 +1287,7 @@ void LoLEngine::shakeScene(int duration, int width, int height, int restore) {
_screen->copyRegion(x1, y1, x2, y2, w, h, 6, 0, Screen::CR_NO_P_CHECK); _screen->copyRegion(x1, y1, x2, y2, w, h, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen(); _screen->updateScreen();
delayUntil(_smoothScrollTimer); delayUntil(_smoothScrollTimer);
} }

View file

@ -73,7 +73,7 @@ bool Screen::init() {
_useOverlays = false; _useOverlays = false;
_useSJIS = false; _useSJIS = false;
_use16ColorMode = _vm->gameFlags().use16ColorMode; _use16ColorMode = _vm->gameFlags().use16ColorMode;
_sjisTempPage = _sjisFontData = 0; _sjisTempPage = _sjisFontData = 0;
if (_vm->gameFlags().useHiResOverlay) { if (_vm->gameFlags().useHiResOverlay) {
@ -419,12 +419,12 @@ void Screen::getFadeParams(const uint8 *palette, int delay, int &delayInc, int &
int Screen::fadePalStep(const uint8 *palette, int diff) { int Screen::fadePalStep(const uint8 *palette, int diff) {
const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : (_use16ColorMode ? 16 : 256)) * 3; const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : (_use16ColorMode ? 16 : 256)) * 3;
uint8 fadePal[768]; uint8 fadePal[768];
memcpy(fadePal, _screenPalette, colors); memcpy(fadePal, _screenPalette, colors);
bool needRefresh = false; bool needRefresh = false;
for (int i = 0; i < colors; ++i) { for (int i = 0; i < colors; ++i) {
int c1 = palette[i]; int c1 = palette[i];
int c2 = fadePal[i]; int c2 = fadePal[i];
@ -1227,7 +1227,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
&Screen::drawShapePlotType37, // used by LoL (monsters) &Screen::drawShapePlotType37, // used by LoL (monsters)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
&Screen::drawShapePlotType48, // used by LoL (slime spots on the floor) &Screen::drawShapePlotType48, // used by LoL (slime spots on the floor)
0, 0, 0, 0, 0, 0,
&Screen::drawShapePlotType52, // used by LoL (projectiles) &Screen::drawShapePlotType52, // used by LoL (projectiles)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 0
@ -1823,7 +1823,7 @@ void Screen::drawShapePlotType33(uint8 *dst, uint8 cmd) {
void Screen::drawShapePlotType37(uint8 *dst, uint8 cmd) { void Screen::drawShapePlotType37(uint8 *dst, uint8 cmd) {
cmd = _dsTable2[cmd]; cmd = _dsTable2[cmd];
if (cmd == 255) { if (cmd == 255) {
cmd = _dsTable5[*dst]; cmd = _dsTable5[*dst];
} else { } else {

View file

@ -41,7 +41,7 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system),
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
_levelOverlays[i] = new uint8[256]; _levelOverlays[i] = new uint8[256];
_fadeFlag = 2; _fadeFlag = 2;
_curDimIndex = 0; _curDimIndex = 0;
@ -207,7 +207,7 @@ uint8 *Screen_LoL::generateLevelOverlay(const uint8 *srcPal, uint8 *ovl, int opC
if (c <= m) { if (c <= m) {
m = c; m = c;
l = x; l = x;
} }
} }
x++; x++;
} while (--ii); } while (--ii);
@ -215,7 +215,7 @@ uint8 *Screen_LoL::generateLevelOverlay(const uint8 *srcPal, uint8 *ovl, int opC
*d++ = l & 0xff; *d++ = l & 0xff;
} }
return ovl; return ovl;
} }
void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) { void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) {
@ -227,7 +227,7 @@ void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) {
if (x <= 0) if (x <= 0)
return; return;
w = x; w = x;
x = 0; x = 0;
} }
int tmp = x + w; int tmp = x + w;
@ -242,7 +242,7 @@ void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) {
if (y <= 0) if (y <= 0)
return; return;
h = y; h = y;
y = 0; y = 0;
} }
tmp = y + h; tmp = y + h;
@ -256,7 +256,7 @@ void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) {
w >>= 1; w >>= 1;
int w2 = w; int w2 = w;
while (h--) { while (h--) {
if (w) { if (w) {
while (w--) { while (w--) {
@ -281,7 +281,7 @@ void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) {
void Screen_LoL::fadeClearSceneWindow(int delay) { void Screen_LoL::fadeClearSceneWindow(int delay) {
if (_fadeFlag == 1) if (_fadeFlag == 1)
return; return;
uint8 *tpal = new uint8[768]; uint8 *tpal = new uint8[768];
memcpy(tpal, _currentPalette, 768); memcpy(tpal, _currentPalette, 768);
@ -423,7 +423,7 @@ void Screen_LoL::smoothScrollHorizontalStep(int pageNum, int srcX, int dstX, int
for (int i = 0; i < w; i++) for (int i = 0; i < w; i++)
*s++ = *d++; *s++ = *d++;
s += pitchS; s += pitchS;
d += pitchD; d += pitchD;
} }
@ -527,7 +527,7 @@ void Screen_LoL::smoothScrollTurnStep3(int srcPage1Num, int srcPage2Num, int dst
void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, int page2, int w2, int h2, int x2, int y2, int w3, int h3, int mode, ...) { void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, int page2, int w2, int h2, int x2, int y2, int w3, int h3, int mode, ...) {
if (!w3 || !h3) if (!w3 || !h3)
return; return;
uint8 *table1 = 0; uint8 *table1 = 0;
uint8 *table2 = 0; uint8 *table2 = 0;
@ -552,7 +552,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
int ibh_1 = _internBlockHeight; int ibh_1 = _internBlockHeight;
int dx_1 = _internDimDstX; int dx_1 = _internDimDstX;
int dy_1 = _internDimDstY; int dy_1 = _internDimDstY;
_internDimX = _internDimY = 0; _internDimX = _internDimY = 0;
_internDimW = w2; _internDimW = w2;
_internDimH = h2; _internDimH = h2;
@ -560,7 +560,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
calcBoundariesIntern(x2, y2, ibw_1, ibh_1); calcBoundariesIntern(x2, y2, ibw_1, ibh_1);
if (_internBlockWidth == -1) if (_internBlockWidth == -1)
return; return;
int iu5_2 = _internDimU5; int iu5_2 = _internDimU5;
int iu6_2 = _internDimU6; int iu6_2 = _internDimU6;
int ibw_2 = _internBlockWidth; int ibw_2 = _internBlockWidth;
@ -583,7 +583,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
s++; s++;
d++; d++;
} }
for (int ii = (i & 1) ^ 1; ii < ibw_2; ii += 2 ) { for (int ii = (i & 1) ^ 1; ii < ibw_2; ii += 2 ) {
*d = *s; *d = *s;
d += 2; d += 2;
@ -598,7 +598,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
cmd = table2[(offs << 8) | *d]; cmd = table2[(offs << 8) | *d];
*d++ = cmd; *d++ = cmd;
} }
} else if (mode == 3) { } else if (mode == 3) {
s = s - iu5_2 + ibw_1; s = s - iu5_2 + ibw_1;
s = s - iu5_2 - 1; s = s - iu5_2 - 1;
@ -753,7 +753,7 @@ void Screen_LoL::fadeToPalette1(int delay) {
} }
void Screen_LoL::loadSpecialColors(uint8 *destPalette) { void Screen_LoL::loadSpecialColors(uint8 *destPalette) {
memcpy(destPalette + 0x240, _screenPalette + 0x240, 12); memcpy(destPalette + 0x240, _screenPalette + 0x240, 12);
} }
void Screen_LoL::copyColor(int dstColorIndex, int srcColorIndex) { void Screen_LoL::copyColor(int dstColorIndex, int srcColorIndex) {
@ -817,7 +817,7 @@ bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedT
bool Screen_LoL::fadePalSpecial(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime) { bool Screen_LoL::fadePalSpecial(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime) {
uint8 tpal[768]; uint8 tpal[768];
uint8 *p1 = _palettes[1]; uint8 *p1 = _palettes[1];
bool res = false; bool res = false;
for (int i = 0; i < 768; i++) { for (int i = 0; i < 768; i++) {

View file

@ -136,12 +136,12 @@ int LoLEngine::olol_moveParty(EMCState *script) {
int mode = stackPos(0); int mode = stackPos(0);
if (mode > 5 && mode < 10) if (mode > 5 && mode < 10)
mode = (mode - 6 - _currentDirection) & 3; mode = (mode - 6 - _currentDirection) & 3;
Button b; Button b;
memset(&b, 0, sizeof(Button)); memset(&b, 0, sizeof(Button));
b.data0Val2 = b.data1Val2 = b.data2Val2 = 0xfe; b.data0Val2 = b.data1Val2 = b.data2Val2 = 0xfe;
b.data0Val3 = b.data1Val3 = b.data2Val3 = 0x01; b.data0Val3 = b.data1Val3 = b.data2Val3 = 0x01;
switch (mode) { switch (mode) {
case 0: case 0:
clickedUpArrow(&b); clickedUpArrow(&b);
@ -1058,7 +1058,7 @@ int LoLEngine::olol_createHandItem(EMCState *script) {
int LoLEngine::olol_playAttackSound(EMCState *script) { int LoLEngine::olol_playAttackSound(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playAttackSound(%p) (%d)", (const void *)script, stackPos(0)); debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playAttackSound(%p) (%d)", (const void *)script, stackPos(0));
static const uint8 sounds[] = { 12, 62, 63 }; static const uint8 sounds[] = { 12, 62, 63 };
int d = stackPos(0); int d = stackPos(0);
@ -1369,7 +1369,7 @@ int LoLEngine::olol_countAllMonsters(EMCState *script){
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
if (_monsters[i].hitPoints > 0 && _monsters[i].mode != 13) if (_monsters[i].hitPoints > 0 && _monsters[i].mode != 13)
res++; res++;
} }
return res; return res;
@ -1398,7 +1398,7 @@ int LoLEngine::olol_calcInflictableDamage(EMCState *script) {
int LoLEngine::olol_getInflictedDamage(EMCState *script) { int LoLEngine::olol_getInflictedDamage(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getInflictedDamage(%p) (%d)", (const void *)script, stackPos(0)); debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getInflictedDamage(%p) (%d)", (const void *)script, stackPos(0));
int mx = stackPos(0); int mx = stackPos(0);
return mx ? _rnd.getRandomNumberRng(2, mx) : 0; return mx ? _rnd.getRandomNumberRng(2, mx) : 0;
} }
@ -1439,13 +1439,13 @@ int LoLEngine::olol_calcInflictableDamagePerItem(EMCState *script) {
int LoLEngine::olol_distanceAttack(EMCState *script) { int LoLEngine::olol_distanceAttack(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_distanceAttack(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8)); debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_distanceAttack(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8));
uint16 fX = stackPos(3); uint16 fX = stackPos(3);
uint16 fY = stackPos(4); uint16 fY = stackPos(4);
if (!(stackPos(8) & 0x8000)) if (!(stackPos(8) & 0x8000))
fX = fY = 0x80; fX = fY = 0x80;
uint16 x = 0; uint16 x = 0;
uint16 y = 0; uint16 y = 0;
calcCoordinates(x, y, stackPos(2), fX, fY); calcCoordinates(x, y, stackPos(2), fX, fY);
@ -1580,7 +1580,7 @@ int LoLEngine::olol_triggerEventOnMouseButtonClick(EMCState *script) {
removeInputTop(); removeInputTop();
if (f == 0 || (f & 0x800)) if (f == 0 || (f & 0x800))
return 0; return 0;
int evt = stackPos(0); int evt = stackPos(0);
if (evt) { if (evt) {
gui_triggerEvent(evt); gui_triggerEvent(evt);
@ -1588,7 +1588,7 @@ int LoLEngine::olol_triggerEventOnMouseButtonClick(EMCState *script) {
} else { } else {
removeInputTop(); removeInputTop();
} }
return 1; return 1;
} }
@ -1616,7 +1616,7 @@ int LoLEngine::olol_countSpecificMonsters(EMCState *script) {
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
if (((1 << _monsters[i].type) & types) && _monsters[i].mode < 14) if (((1 << _monsters[i].type) & types) && _monsters[i].mode < 14)
res++; res++;
} }
return res; return res;
@ -1704,7 +1704,7 @@ int LoLEngine::olol_getItemOnPos(EMCState *script) {
return _emcLastItem; return _emcLastItem;
} }
return 0; return 0;
} }
@ -1786,7 +1786,7 @@ int LoLEngine::olol_checkBlockForMonster(EMCState *script) {
uint16 o = _levelBlockProperties[block].assignedObjects; uint16 o = _levelBlockProperties[block].assignedObjects;
while (o & 0x8000) { while (o & 0x8000) {
if (id == 0xffff || id == o) if (id == 0xffff || id == o)
return o & 0x7fff; return o & 0x7fff;
o = findObject(o)->nextAssignedObject; o = findObject(o)->nextAssignedObject;
} }
return -1; return -1;
@ -1830,7 +1830,7 @@ int LoLEngine::olol_getNextActiveCharacter(EMCState *script) {
_scriptCharacterCycle = 0; _scriptCharacterCycle = 0;
else else
_scriptCharacterCycle++; _scriptCharacterCycle++;
while (_scriptCharacterCycle < 4) { while (_scriptCharacterCycle < 4) {
if (_characters[_scriptCharacterCycle].flags & 1) if (_characters[_scriptCharacterCycle].flags & 1)
return _scriptCharacterCycle; return _scriptCharacterCycle;
@ -1850,7 +1850,7 @@ int LoLEngine::olol_drawCharPortrait(EMCState *script) {
if (charNum == -1) if (charNum == -1)
gui_drawAllCharPortraitsWithStats(); gui_drawAllCharPortraitsWithStats();
else else
gui_drawCharPortraitWithStats(charNum); gui_drawCharPortraitWithStats(charNum);
return 1; return 1;
} }

View file

@ -83,7 +83,7 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys
COMMAND(cmd_return(1)), COMMAND(cmd_return(1)),
COMMAND(cmd_return(1)), COMMAND(cmd_return(1)),
COMMAND(cmd_return(n1)) COMMAND(cmd_return(n1))
}; };
#undef cmd_return #undef cmd_return
#undef COMMAND_UNIMPL #undef COMMAND_UNIMPL
#undef COMMAND #undef COMMAND
@ -113,7 +113,7 @@ TIMInterpreter::~TIMInterpreter() {
delete[] _animations[i].parts; delete[] _animations[i].parts;
} }
delete[] _animations; delete[] _animations;
} }
TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpcode *> *opcodes) { TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpcode *> *opcodes) {
@ -126,7 +126,7 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpc
IFFParser iff(*stream); IFFParser iff(*stream);
Common::IFFChunk *chunk = 0; Common::IFFChunk *chunk = 0;
TIM *tim = new TIM; TIM *tim = new TIM;
assert(tim); assert(tim);
memset(tim, 0, sizeof(TIM)); memset(tim, 0, sizeof(TIM));
@ -217,7 +217,7 @@ int TIMInterpreter::exec(TIM *tim, bool loop) {
update(); update();
checkSpeechProgress(); checkSpeechProgress();
bool running = true; bool running = true;
int cnt = 0; int cnt = 0;
while (cur.ip && cur.nextTime <= _system->getMillis() && running) { while (cur.ip && cur.nextTime <= _system->getMillis() && running) {
if (cnt++ > 0) { if (cnt++ > 0) {
@ -460,7 +460,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
screen()->checkedPageUpdate(8, 4); screen()->checkedPageUpdate(8, 4);
screen()->updateScreen(); screen()->updateScreen();
} }
if (wsaFlags & 4) { if (wsaFlags & 4) {
snprintf(file, 32, "%s.CPS", filename); snprintf(file, 32, "%s.CPS", filename);
@ -840,7 +840,7 @@ TIMInterpreter_LoL::TIMInterpreter_LoL(LoLEngine *engine, Screen_v2 *screen_v2,
_animations[i].parts = new AnimPart[TIM::kAnimParts]; _animations[i].parts = new AnimPart[TIM::kAnimParts];
memset(_animations[i].parts, 0, TIM::kAnimParts * sizeof(AnimPart)); memset(_animations[i].parts, 0, TIM::kAnimParts * sizeof(AnimPart));
} }
_drawPage2 = 0; _drawPage2 = 0;
memset(_dialogueButtonString, 0, 3 * sizeof(const char*)); memset(_dialogueButtonString, 0, 3 * sizeof(const char*));
@ -948,8 +948,8 @@ void TIMInterpreter_LoL::drawDialogueBox(int numStr, const char *s1, const char
if (numStr == 1) { if (numStr == 1) {
_dialogueButtonXoffs = 0; _dialogueButtonXoffs = 0;
_dialogueButtonPosX = d->sx + d->w - 77; _dialogueButtonPosX = d->sx + d->w - 77;
} else { } else {
_dialogueButtonXoffs = d->w / numStr; _dialogueButtonXoffs = d->w / numStr;
_dialogueButtonPosX = d->sx + (_dialogueButtonXoffs >> 1) - 37; _dialogueButtonPosX = d->sx + (_dialogueButtonXoffs >> 1) - 37;
} }
@ -1049,7 +1049,7 @@ void TIMInterpreter_LoL::updateBackgroundAnimation(int animIndex) {
void TIMInterpreter_LoL::playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay) { void TIMInterpreter_LoL::playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay) {
Animation *anim = &_animations[animIndex]; Animation *anim = &_animations[animIndex];
int step = (lastFrame >= firstFrame) ? 1 : -1; int step = (lastFrame >= firstFrame) ? 1 : -1;
for (int i = firstFrame; i != (lastFrame + step) ; i += step) { for (int i = firstFrame; i != (lastFrame + step) ; i += step) {
uint32 next = _system->getMillis() + delay * _vm->_tickLength; uint32 next = _system->getMillis() + delay * _vm->_tickLength;
@ -1098,10 +1098,10 @@ uint16 TIMInterpreter_LoL::processDialogue() {
if (_dialogueNumButtons == 0) { if (_dialogueNumButtons == 0) {
int e = _vm->checkInput(0, false) & 0xFF; int e = _vm->checkInput(0, false) & 0xFF;
_vm->removeInputTop(); _vm->removeInputTop();
if (e) { if (e) {
_vm->gui_notifyButtonListChanged(); _vm->gui_notifyButtonListChanged();
if (e == 43 || e == 61) { if (e == 43 || e == 61) {
_vm->snd_stopSpeech(true); _vm->snd_stopSpeech(true);
//_dlgTimer = 0; //_dlgTimer = 0;
@ -1146,7 +1146,7 @@ uint16 TIMInterpreter_LoL::processDialogue() {
case 200: case 200:
case 202: case 202:
x = _dialogueButtonPosX; x = _dialogueButtonPosX;
for (int i = 0; i < _dialogueNumButtons; i++) { for (int i = 0; i < _dialogueNumButtons; i++) {
if (_vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, x, _dialogueButtonPosY, x + 74, _dialogueButtonPosY + 9)) { if (_vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, x, _dialogueButtonPosY, x + 74, _dialogueButtonPosY + 9)) {
_dialogueHighlightedButton = i; _dialogueHighlightedButton = i;
@ -1165,7 +1165,7 @@ uint16 TIMInterpreter_LoL::processDialogue() {
if (df != _dialogueHighlightedButton) if (df != _dialogueHighlightedButton)
drawDialogueButtons(); drawDialogueButtons();
if (res == 0) if (res == 0)
return 0; return 0;
@ -1213,7 +1213,7 @@ void TIMInterpreter_LoL::checkSpeechProgress() {
} }
} }
} }
char *TIMInterpreter_LoL::getTableString(int id) { char *TIMInterpreter_LoL::getTableString(int id) {
return _vm->getLangString(id); return _vm->getLangString(id);
} }
@ -1283,7 +1283,7 @@ int TIMInterpreter_LoL::cmd_processDialogue(const uint16 *param) {
_animations[5].wsa = 0; _animations[5].wsa = 0;
if (_currentTim->procParam) if (_currentTim->procParam)
advanceToOpcode(21); advanceToOpcode(21);
return res; return res;
} }

View file

@ -140,7 +140,7 @@ public:
virtual uint16 processDialogue() { return 1; } virtual uint16 processDialogue() { return 1; }
virtual void setupBackgroundAnimationPart(int animIndex, int part, int firstFrame, int lastFrame, int cycles, int nextPart, int partDelay, int f, int sfxIndex, int sfxFrame) {} virtual void setupBackgroundAnimationPart(int animIndex, int part, int firstFrame, int lastFrame, int cycles, int nextPart, int partDelay, int f, int sfxIndex, int sfxFrame) {}
virtual void startBackgroundAnimation(int animIndex, int part) {} virtual void startBackgroundAnimation(int animIndex, int part) {}
virtual void stopBackgroundAnimation(int animIndex) {} virtual void stopBackgroundAnimation(int animIndex) {}
virtual void updateBackgroundAnimation(int animIndex) {} virtual void updateBackgroundAnimation(int animIndex) {}
virtual void playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay) {} virtual void playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay) {}
@ -155,7 +155,7 @@ public:
protected: protected:
virtual KyraEngine_v1 *vm(); virtual KyraEngine_v1 *vm();
virtual Screen_v2 *screen(); virtual Screen_v2 *screen();
KyraEngine_v1 *_vm; KyraEngine_v1 *_vm;
Screen_v2 *_screen; Screen_v2 *_screen;
OSystem *_system; OSystem *_system;
@ -228,7 +228,7 @@ public:
Animation *initAnimStruct(int index, const char *filename, int x, int y, int frameDelay, int, uint16 wsaCopyParams); Animation *initAnimStruct(int index, const char *filename, int x, int y, int frameDelay, int, uint16 wsaCopyParams);
int freeAnimStruct(int index); int freeAnimStruct(int index);
void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3); void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3);
uint16 processDialogue(); uint16 processDialogue();
void resetDialogueState(TIM *tim); void resetDialogueState(TIM *tim);
@ -237,15 +237,15 @@ public:
void startBackgroundAnimation(int animIndex, int part); void startBackgroundAnimation(int animIndex, int part);
void stopBackgroundAnimation(int animIndex); void stopBackgroundAnimation(int animIndex);
void updateBackgroundAnimation(int animIndex); void updateBackgroundAnimation(int animIndex);
void playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay); void playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay);
private: private:
KyraEngine_v1 *vm(); KyraEngine_v1 *vm();
Screen_v2 *screen(); Screen_v2 *screen();
void update(); void update();
void checkSpeechProgress(); void checkSpeechProgress();
char *getTableString(int id); char *getTableString(int id);
void advanceToOpcode(int opcode); void advanceToOpcode(int opcode);

View file

@ -2478,7 +2478,7 @@ void KyraEngine_HoF::seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, i
curframe = firstframe; curframe = firstframe;
_seqWsaChatFrameTimeout = _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; _seqWsaChatFrameTimeout = _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength;
if (wsa) if (wsa)
wsa->displayFrame(curframe % wsa->frames(), 2, wsaXpos, wsaYpos, 0); wsa->displayFrame(curframe % wsa->frames(), 2, wsaXpos, wsaYpos, 0);
_screen->copyPage(2, 12); _screen->copyPage(2, 12);

View file

@ -170,7 +170,7 @@ void LoLEngine::setupPrologueData(bool load) {
memset(_screen->getPalette(1), 0, 768); memset(_screen->getPalette(1), 0, 768);
_sound->setSoundList(&_soundData[kMusicIntro]); _sound->setSoundList(&_soundData[kMusicIntro]);
// We have three sound.dat files, one for the intro, one for the // We have three sound.dat files, one for the intro, one for the
// end sequence and one for ingame, each contained in a different // end sequence and one for ingame, each contained in a different
// PAK file. Therefore a new call to loadSoundFile() is required // PAK file. Therefore a new call to loadSoundFile() is required
@ -182,7 +182,7 @@ void LoLEngine::setupPrologueData(bool load) {
_sound->loadSoundFile("LOREINTR"); _sound->loadSoundFile("LOREINTR");
} else { } else {
delete _chargenWSA; _chargenWSA = 0; delete _chargenWSA; _chargenWSA = 0;
uint8 *pal = _screen->getPalette(0); uint8 *pal = _screen->getPalette(0);
memset(pal, 0, 768); memset(pal, 0, 768);
_screen->setScreenPalette(pal); _screen->setScreenPalette(pal);
@ -667,7 +667,7 @@ void LoLEngine::showStarcraftLogo() {
_sound->voicePlay("star2"); _sound->voicePlay("star2");
while(_sound->voiceIsPlaying("star2") && !(shouldQuit() || inputFlag)) { while(_sound->voiceIsPlaying("star2") && !(shouldQuit() || inputFlag)) {
inputFlag = checkInput(0) & 0xff; inputFlag = checkInput(0) & 0xff;
delay(_tickLength); delay(_tickLength);
} }
} }

View file

@ -149,10 +149,10 @@ uint32 Sound::voicePlayFromList(Common::List<const char*> fileList) {
out->queueBuffer(vocBuffer, size); out->queueBuffer(vocBuffer, size);
totalPlayTime += size; totalPlayTime += size;
} }
totalPlayTime = (totalPlayTime * 1000) / 22050; totalPlayTime = (totalPlayTime * 1000) / 22050;
out->finish(); out->finish();
_soundChannels[h].file = *fileList.begin(); _soundChannels[h].file = *fileList.begin();
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, out); _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, out);
return totalPlayTime; return totalPlayTime;

View file

@ -2720,7 +2720,7 @@ void TownsPC98_OpnSquareSineSource::nextTick(int32 *buffer, uint32 bufferSize) {
finOut += _tlTable[_channels[ii].out ? (_channels[ii].vol & 0x0f) : 0]; finOut += _tlTable[_channels[ii].out ? (_channels[ii].vol & 0x0f) : 0];
} }
finOut /= 3; finOut /= 3;
buffer[i << 1] += finOut; buffer[i << 1] += finOut;
buffer[(i << 1) + 1] += finOut; buffer[(i << 1) + 1] += finOut;
} }
@ -4140,7 +4140,7 @@ SoundTownsPC98_v2::~SoundTownsPC98_v2() {
bool SoundTownsPC98_v2::init() { bool SoundTownsPC98_v2::init() {
_driver = new TownsPC98_OpnDriver(_mixer, _vm->gameFlags().platform == Common::kPlatformPC98 ? _driver = new TownsPC98_OpnDriver(_mixer, _vm->gameFlags().platform == Common::kPlatformPC98 ?
TownsPC98_OpnDriver::OD_TYPE86 : TownsPC98_OpnDriver::OD_TOWNS); TownsPC98_OpnDriver::OD_TYPE86 : TownsPC98_OpnDriver::OD_TOWNS);
if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
_vm->checkCD(); _vm->checkCD();
// FIXME: While checking for 'track1.XXX(X)' looks like // FIXME: While checking for 'track1.XXX(X)' looks like

View file

@ -80,7 +80,7 @@ void LoLEngine::loadMonsterShapes(const char *file, int monsterIndex, int animTy
uint8 *tmpPal2 = new uint8[256]; uint8 *tmpPal2 = new uint8[256];
uint16 *tmpPal3 = new uint16[256]; uint16 *tmpPal3 = new uint16[256];
memset (tmpPal1, 0, 64); memset (tmpPal1, 0, 64);
memset (tmpPal2, 0, 256); memset (tmpPal2, 0, 256);
for (int i = 0; i < 64; i++) { for (int i = 0; i < 64; i++) {
tmpPal1[i] = *p; tmpPal1[i] = *p;
@ -342,7 +342,7 @@ void LoLEngine::removeAssignedObjectFromBlock(LevelBlockProperty *l, int id) {
i->nextAssignedObject = 0; i->nextAssignedObject = 0;
return; return;
} }
i = findObject(*blockItemIndex); i = findObject(*blockItemIndex);
blockItemIndex = &i->nextAssignedObject; blockItemIndex = &i->nextAssignedObject;
} }
@ -356,7 +356,7 @@ void LoLEngine::removeDrawObjectFromBlock(LevelBlockProperty *l, int id) {
if (*blockItemIndex == id) { if (*blockItemIndex == id) {
i = findObject(id); i = findObject(id);
*blockItemIndex = i->nextDrawObject; *blockItemIndex = i->nextDrawObject;
i->nextDrawObject = 0; i->nextDrawObject = 0;
return; return;
} }
@ -605,10 +605,10 @@ void LoLEngine::drawBlockObjects(int blockArrayIndex) {
} }
if (shp) if (shp)
fy += (shp[2] >> 2); fy += (shp[2] >> 2);
} else { } else {
shp = (_itemProperties[i->itemPropertyIndex].flags & 0x40) ? _gameShapes[_itemProperties[i->itemPropertyIndex].shpIndex] : shp = (_itemProperties[i->itemPropertyIndex].flags & 0x40) ? _gameShapes[_itemProperties[i->itemPropertyIndex].shpIndex] :
_itemShapes[_gameShapeMap[_itemProperties[i->itemPropertyIndex].shpIndex << 1]]; _itemShapes[_gameShapeMap[_itemProperties[i->itemPropertyIndex].shpIndex << 1]];
} }
@ -625,7 +625,7 @@ void LoLEngine::drawMonster(uint16 id) {
int curFrm = getMonsterCurFrame(m, flg & 0xffef); int curFrm = getMonsterCurFrame(m, flg & 0xffef);
uint8 *shp = 0; uint8 *shp = 0;
if (curFrm == -1) { if (curFrm == -1) {
shp = _monsterShapes[m->properties->shapeIndex << 4]; shp = _monsterShapes[m->properties->shapeIndex << 4];
calcDrawingLayerParameters(m->x + _monsterShiftOffs[m->shiftStep << 1], m->y + _monsterShiftOffs[(m->shiftStep << 1) + 1], _shpDmX, _shpDmY, _dmScaleW, _dmScaleH, shp, 0); calcDrawingLayerParameters(m->x + _monsterShiftOffs[m->shiftStep << 1], m->y + _monsterShiftOffs[(m->shiftStep << 1) + 1], _shpDmX, _shpDmY, _dmScaleW, _dmScaleH, shp, 0);
} else { } else {
@ -741,7 +741,7 @@ int LoLEngine::getMonsterCurFrame(MonsterInPlay *m, uint16 dirFlags) {
default: default:
return tmp; return tmp;
} }
break; break;
case 2: case 2:
/////// ///////
@ -801,7 +801,7 @@ void LoLEngine::redrawSceneItem() {
setLevelShapesDim(tile, x1, x2, 13); setLevelShapesDim(tile, x1, x2, 13);
uint16 s = _visibleBlocks[tile]->drawObjects; uint16 s = _visibleBlocks[tile]->drawObjects;
int t = (i << 7) + 1; int t = (i << 7) + 1;
while (s) { while (s) {
if (s & 0x8000) { if (s & 0x8000) {
s = _monsters[s & 0x7fff].nextDrawObject; s = _monsters[s & 0x7fff].nextDrawObject;
@ -815,7 +815,7 @@ void LoLEngine::redrawSceneItem() {
if (item->flyingHeight > 1) if (item->flyingHeight > 1)
fy -= ((item->flyingHeight - 1) * 6); fy -= ((item->flyingHeight - 1) * 6);
uint8 *shp = (_itemProperties[item->itemPropertyIndex].flags & 0x40) ? _gameShapes[_itemProperties[item->itemPropertyIndex].shpIndex] : uint8 *shp = (_itemProperties[item->itemPropertyIndex].flags & 0x40) ? _gameShapes[_itemProperties[item->itemPropertyIndex].shpIndex] :
_itemShapes[_gameShapeMap[_itemProperties[item->itemPropertyIndex].shpIndex << 1]]; _itemShapes[_gameShapeMap[_itemProperties[item->itemPropertyIndex].shpIndex << 1]];
drawItemOrMonster(shp, 0, item->x, item->y, fx, fy, 0, t, 0); drawItemOrMonster(shp, 0, item->x, item->y, fx, fy, 0, t, 0);
@ -1052,7 +1052,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) {
f &= 6; f &= 6;
} }
} }
if ((f & 1) && (monster->flags & 0x10)) if ((f & 1) && (monster->flags & 0x10))
setMonsterMode(monster, 7); setMonsterMode(monster, 7);
@ -1081,7 +1081,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) {
moveMonster(monster); moveMonster(monster);
break; break;
case 3: case 3:
if (updateMonsterAdjustBlocks(monster)) if (updateMonsterAdjustBlocks(monster))
setMonsterMode(monster, 7); setMonsterMode(monster, 7);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@ -1233,7 +1233,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(MonsterInPlay *monster) {
} else { } else {
s = monster->curDistWeapon++; s = monster->curDistWeapon++;
if (monster->curDistWeapon == monster->properties->numDistWeapons) if (monster->curDistWeapon == monster->properties->numDistWeapons)
monster->curDistWeapon = 0; monster->curDistWeapon = 0;
} }
int flyingObject = monster->properties->distWeapons[s]; int flyingObject = monster->properties->distWeapons[s];
@ -1273,7 +1273,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(MonsterInPlay *monster) {
if (getMonsterDistance(monster->block, _monsters[i].block) < 7) if (getMonsterDistance(monster->block, _monsters[i].block) < 7)
setMonsterMode(monster, 7); setMonsterMode(monster, 7);
} }
_txt->printMessage(2, getLangString(0x401a)); _txt->printMessage(2, getLangString(0x401a));
} else if (flyingObject == 4) { } else if (flyingObject == 4) {
launchMagicViper(); launchMagicViper();
@ -1296,7 +1296,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) {
int dir = calcMonsterDirection(monster->x & 0xff00, monster->y & 0xff00, _partyPosX & 0xff00, _partyPosY & 0xff00); int dir = calcMonsterDirection(monster->x & 0xff00, monster->y & 0xff00, _partyPosX & 0xff00, _partyPosY & 0xff00);
int x1 = _partyPosX; int x1 = _partyPosX;
int y1 = _partyPosY; int y1 = _partyPosY;
calcSpriteRelPosition(monster->x, monster->y, x1, y1, dir >> 1); calcSpriteRelPosition(monster->x, monster->y, x1, y1, dir >> 1);
int t = (x1 < 0) ? -x1 : x1; int t = (x1 < 0) ? -x1 : x1;
@ -1313,7 +1313,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) {
inflictDamage(dst, dmg, m, 0, 0); inflictDamage(dst, dmg, m, 0, 0);
applyMonsterAttackSkill(monster, dst, dmg); applyMonsterAttackSkill(monster, dst, dmg);
} }
setMonsterMode(monster, 8); setMonsterMode(monster, 8);
checkSceneUpdateNeed(monster->block); checkSceneUpdateNeed(monster->block);
@ -1321,7 +1321,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) {
setMonsterDirection(monster, dir); setMonsterDirection(monster, dir);
checkSceneUpdateNeed(monster->block); checkSceneUpdateNeed(monster->block);
} }
return; return;
} }
} }
@ -1460,12 +1460,12 @@ void LoLEngine::rearrangeAttackingMonster(MonsterInPlay *monster) {
uint16 my = monster->y; uint16 my = monster->y;
uint16 *c = (t & 1) ? &my : &mx; uint16 *c = (t & 1) ? &my : &mx;
bool centered = (*c & 0x7f) ? false : true; bool centered = (*c & 0x7f) ? false : true;
bool posFlag = true; bool posFlag = true;
if (monster->properties->maxWidth <= 63) { if (monster->properties->maxWidth <= 63) {
if (centered) { if (centered) {
bool r = false; bool r = false;
if (monster->nextAssignedObject & 0x8000) { if (monster->nextAssignedObject & 0x8000) {
r = true; r = true;
} else { } else {
@ -1474,7 +1474,7 @@ void LoLEngine::rearrangeAttackingMonster(MonsterInPlay *monster) {
if (id != monster->id) { if (id != monster->id) {
r = true; r = true;
} else { } else {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
t = (t + 1) & 3; t = (t + 1) & 3;
id = _levelBlockProperties[calcNewBlockPosition(monster->block, t)].assignedObjects; id = _levelBlockProperties[calcNewBlockPosition(monster->block, t)].assignedObjects;
@ -1494,7 +1494,7 @@ void LoLEngine::rearrangeAttackingMonster(MonsterInPlay *monster) {
if (centered && posFlag) if (centered && posFlag)
return; return;
if (posFlag) { if (posFlag) {
if (*c & 0x80) if (*c & 0x80)
*c -= 32; *c -= 32;
@ -1506,10 +1506,10 @@ void LoLEngine::rearrangeAttackingMonster(MonsterInPlay *monster) {
else else
*c -= 32; *c -= 32;
} }
if (walkMonsterCheckDest(mx, my, monster, 4)) if (walkMonsterCheckDest(mx, my, monster, 4))
return; return;
int fx = _partyPosX; int fx = _partyPosX;
int fy = _partyPosY; int fy = _partyPosY;
calcSpriteRelPosition(mx, my, fx, fy, monster->direction >> 1); calcSpriteRelPosition(mx, my, fx, fy, monster->direction >> 1);
@ -1524,11 +1524,11 @@ void LoLEngine::rearrangeAttackingMonster(MonsterInPlay *monster) {
void LoLEngine::moveStrayingMonster(MonsterInPlay *monster) { void LoLEngine::moveStrayingMonster(MonsterInPlay *monster) {
int x = 0; int x = 0;
int y = 0; int y = 0;
if (monster->fightCurTick) { if (monster->fightCurTick) {
uint8 d = (monster->direction - monster->fightCurTick) & 6; uint8 d = (monster->direction - monster->fightCurTick) & 6;
uint8 id = monster->id; uint8 id = monster->id;
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
getNextStepCoords(monster->x, monster->y, x, y, d); getNextStepCoords(monster->x, monster->y, x, y, d);

View file

@ -35,7 +35,7 @@ namespace Kyra {
TextDisplayer_LoL::TextDisplayer_LoL(LoLEngine *vm, Screen_LoL *screen) : _vm(vm), _screen(screen), TextDisplayer_LoL::TextDisplayer_LoL(LoLEngine *vm, Screen_LoL *screen) : _vm(vm), _screen(screen),
_scriptParameter(0), _animWidth(0), _animColor1(0), _animColor2(0), _animFlag(true), _lineCount(0), _scriptParameter(0), _animWidth(0), _animColor1(0), _animColor2(0), _animFlag(true), _lineCount(0),
_printFlag(false), _lineWidth(0), _numCharsTotal(0), _numCharsLeft(0), _numCharsPrinted(0) { _printFlag(false), _lineWidth(0), _numCharsTotal(0), _numCharsLeft(0), _numCharsPrinted(0) {
memset(_stringParameters, 0, 15 * sizeof(char*)); memset(_stringParameters, 0, 15 * sizeof(char*));
_buffer = new char[600]; _buffer = new char[600];
memset(_buffer, 0, 600); memset(_buffer, 0, 600);
@ -160,8 +160,8 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script,
int oldDim = 0; int oldDim = 0;
if (dim == 3) { if (dim == 3) {
if (_vm->_updateFlags & 2) { if (_vm->_updateFlags & 2) {
oldDim = clearDim(4); oldDim = clearDim(4);
_textDimData[4].color1 = 254; _textDimData[4].color1 = 254;
_textDimData[4].color2 = _screen->_curDim->unkA; _textDimData[4].color2 = _screen->_curDim->unkA;
} else { } else {
@ -175,7 +175,7 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script,
} }
} else { } else {
oldDim = _screen->curDimIndex(); oldDim = _screen->curDimIndex();
_screen->setScreenDim(dim); _screen->setScreenDim(dim);
_textDimData[dim].color1 = 254; _textDimData[dim].color1 = 254;
_textDimData[dim].color2 = _screen->_curDim->unkA; _textDimData[dim].color2 = _screen->_curDim->unkA;
} }
@ -222,7 +222,7 @@ void TextDisplayer_LoL::printMessage(uint16 type, const char *str, ...) {
vsnprintf((char*) _buffer, 240, str, args); vsnprintf((char*) _buffer, 240, str, args);
va_end(args); va_end(args);
displayText(_buffer); displayText(_buffer);
_screen->setScreenDim(od); _screen->setScreenDim(od);
@ -311,7 +311,7 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint
case 'n': case 'n':
strcpy(dst, _vm->_characters[script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]].name); strcpy(dst, _vm->_characters[script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]].name);
dst += strlen(dst); dst += strlen(dst);
break; break;
case 's': case 's':
@ -328,7 +328,7 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint
break; break;
case '\0': case '\0':
default: default:
continue; continue;
} }
} }
@ -337,20 +337,20 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint
void TextDisplayer_LoL::displayText(char *str, ...) { void TextDisplayer_LoL::displayText(char *str, ...) {
_printFlag = false; _printFlag = false;
_lineWidth = 0; _lineWidth = 0;
_numCharsLeft = 0; _numCharsLeft = 0;
_numCharsPrinted = 0; _numCharsPrinted = 0;
_tempString1 = str; _tempString1 = str;
_tempString2 = 0; _tempString2 = 0;
_currentLine[0] = 0; _currentLine[0] = 0;
memset(_ctrl, 0, 3); memset(_ctrl, 0, 3);
char c = parseCommand(); char c = parseCommand();
va_list args; va_list args;
va_start(args, str); va_start(args, str);
@ -369,7 +369,7 @@ void TextDisplayer_LoL::displayText(char *str, ...) {
} else { } else {
break; break;
} }
_ctrl[0] = _ctrl[2]; _ctrl[0] = _ctrl[2];
_ctrl[2] = _ctrl[1] = 0; _ctrl[2] = _ctrl[1] = 0;
c = parseCommand(); c = parseCommand();
@ -434,9 +434,9 @@ void TextDisplayer_LoL::displayText(char *str, ...) {
if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3)) if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3))
printLine(_currentLine); printLine(_currentLine);
break; break;
} }
c = parseCommand(); c = parseCommand();
} }
@ -490,21 +490,21 @@ void TextDisplayer_LoL::printLine(char *str) {
int fh = (_screen->getFontHeight() + _screen->_charOffset); int fh = (_screen->getFontHeight() + _screen->_charOffset);
int lines = (sd->h - _screen->_charOffset) / fh; int lines = (sd->h - _screen->_charOffset) / fh;
while (_textDimData[sdx].line >= lines) { while (_textDimData[sdx].line >= lines) {
if (lines <= _lineCount && _animFlag) { if (lines <= _lineCount && _animFlag) {
_lineCount = 0; _lineCount = 0;
textPageBreak(); textPageBreak();
_numCharsPrinted = 0; _numCharsPrinted = 0;
} }
int h1 = ((sd->h / fh) - 1) * fh; int h1 = ((sd->h / fh) - 1) * fh;
int h2 = sd->h - fh; int h2 = sd->h - fh;
if (h2) if (h2)
_screen->copyRegion(sd->sx << 3, sd->sy + fh, sd->sx << 3, sd->sy, sd->w << 3, h2, _screen->_curPage, _screen->_curPage, Screen::CR_NO_P_CHECK); _screen->copyRegion(sd->sx << 3, sd->sy + fh, sd->sx << 3, sd->sy, sd->w << 3, h2, _screen->_curPage, _screen->_curPage, Screen::CR_NO_P_CHECK);
_screen->fillRect(sd->sx << 3, sd->sy + h1, (sd->sx + sd->w - 1) << 3, sd->sy + sd->h - 1, _textDimData[sdx].color2); _screen->fillRect(sd->sx << 3, sd->sy + h1, (sd->sx + sd->w - 1) << 3, sd->sy + sd->h - 1, _textDimData[sdx].color2);
if (_textDimData[sdx].line) if (_textDimData[sdx].line)
_textDimData[sdx].line--; _textDimData[sdx].line--;
} }
@ -529,10 +529,10 @@ void TextDisplayer_LoL::printLine(char *str) {
//cut off line after last space //cut off line after last space
c = str[n1]; c = str[n1];
lw -= _screen->getCharWidth(c); lw -= _screen->getCharWidth(c);
if (!n2 && lw <= w) if (!n2 && lw <= w)
n2 = n1; n2 = n1;
if (n2 && c == ' ') { if (n2 && c == ' ') {
s = n1; s = n1;
_printFlag = false; _printFlag = false;
@ -554,11 +554,11 @@ void TextDisplayer_LoL::printLine(char *str) {
c = str[s]; c = str[s];
str[s] = 0; str[s] = 0;
_screen->printText(str, x1, y, _textDimData[sdx].color1, _textDimData[sdx].color2); _screen->printText(str, x1, y, _textDimData[sdx].color1, _textDimData[sdx].color2);
_textDimData[sdx].column += lw; _textDimData[sdx].column += lw;
_numCharsPrinted += strlen(str); _numCharsPrinted += strlen(str);
str[s] = c; str[s] = c;
if (c == ' ') if (c == ' ')
@ -618,7 +618,7 @@ void TextDisplayer_LoL::textPageBreak() {
} else { } else {
x += 6; x += 6;
y = dim->sy + dim->h - 2; y = dim->sy + dim->h - 2;
} }
} else { } else {
y = dim->sy + dim->h - 10; y = dim->sy + dim->h - 10;
} }
@ -638,7 +638,7 @@ void TextDisplayer_LoL::textPageBreak() {
while (!inputFlag) { while (!inputFlag) {
_vm->update(); _vm->update();
if (_vm->_speechFlag) { if (_vm->_speechFlag) {
if (((_vm->_system->getMillis() > speechPartTime) || (_vm->snd_characterSpeaking() != 2)) && speechPartTime) { if (((_vm->_system->getMillis() > speechPartTime) || (_vm->snd_characterSpeaking() != 2)) && speechPartTime) {
loop = false; loop = false;

View file

@ -42,7 +42,7 @@ public:
void setAnimParameters(const char *str, int x, uint8 col1, uint8 col2); void setAnimParameters(const char *str, int x, uint8 col1, uint8 col2);
void setAnimFlag(bool flag) { _animFlag = flag; } void setAnimFlag(bool flag) { _animFlag = flag; }
void setupField(bool mode); void setupField(bool mode);
void expandField(); void expandField();
@ -51,7 +51,7 @@ public:
void printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex); void printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
void printMessage(uint16 type, const char *str, ...); void printMessage(uint16 type, const char *str, ...);
int16 _scriptParameter; int16 _scriptParameter;
private: private:
@ -60,7 +60,7 @@ private:
void readNextPara(); void readNextPara();
void printLine(char *str); void printLine(char *str);
void preprocessString(char *str, EMCState *script, const uint16 *paramList, int16 paramIndex); void preprocessString(char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
void textPageBreak(); void textPageBreak();
void clearCurDim(); void clearCurDim();
@ -79,7 +79,7 @@ private:
uint32 _numCharsTotal; uint32 _numCharsTotal;
uint32 _numCharsLeft; uint32 _numCharsLeft;
uint32 _numCharsPrinted; uint32 _numCharsPrinted;
const char *_animString; const char *_animString;
int16 _animWidth; int16 _animWidth;
uint8 _animColor1; uint8 _animColor1;

View file

@ -200,12 +200,12 @@ uint32 TimerManager::getNextRun(uint8 id) const {
void TimerManager::pauseSingleTimer(uint8 id, bool p) { void TimerManager::pauseSingleTimer(uint8 id, bool p) {
Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id)); Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id));
if (timer == _timers.end()) { if (timer == _timers.end()) {
warning("TimerManager::pauseSingleTimer: No timer %d", id); warning("TimerManager::pauseSingleTimer: No timer %d", id);
return; return;
} }
if (p) { if (p) {
timer->pauseStartTime = _system->getMillis(); timer->pauseStartTime = _system->getMillis();
timer->enabled |= 2; timer->enabled |= 2;
@ -216,7 +216,7 @@ void TimerManager::pauseSingleTimer(uint8 id, bool p) {
timer->nextRun += elapsedTime; timer->nextRun += elapsedTime;
resetNextRun(); resetNextRun();
timer->pauseStartTime = 0; timer->pauseStartTime = 0;
} }
} }
bool TimerManager::isEnabled(uint8 id) const { bool TimerManager::isEnabled(uint8 id) const {

View file

@ -381,7 +381,7 @@ int WSAMovie_v2::open(const char *filename, int unk1, uint8 *palBuf) {
if (palBuf) if (palBuf)
_vm->screen()->loadPalette(wsaData + 8 + ((_numFrames << 2) & 0xFFFF), palBuf, 0x30); _vm->screen()->loadPalette(wsaData + 8 + ((_numFrames << 2) & 0xFFFF), palBuf, 0x30);
} }
_flags |= WF_XOR; _flags |= WF_XOR;
} }