aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_lol.cpp186
-rw-r--r--engines/kyra/kyra_v1.cpp108
-rw-r--r--engines/kyra/lol.cpp293
-rw-r--r--engines/kyra/scene_lol.cpp28
-rw-r--r--engines/kyra/script_lol.cpp252
-rw-r--r--engines/kyra/sprites_lol.cpp303
-rw-r--r--engines/kyra/text_lol.cpp276
7 files changed, 721 insertions, 725 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 4880e9f914..efd5a83e10 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -624,37 +624,37 @@ void LoLEngine::gui_toggleButtonDisplayMode(int shapeIndex, int mode) {
uint32 t = 0;
switch (mode) {
- case 1:
- mode = 0x100;
- _lastButtonShape = shapeIndex;
- break;
-
- case 0:
- if (!_lastButtonShape)
- return;
+ case 1:
+ mode = 0x100;
+ _lastButtonShape = shapeIndex;
+ break;
- t = _system->getMillis();
- if (_buttonPressTimer > t)
- delay(_buttonPressTimer - t);
+ case 0:
+ if (!_lastButtonShape)
+ return;
- case 2:
- mode = 0;
- _lastButtonShape = 0;
- break;
+ t = _system->getMillis();
+ if (_buttonPressTimer > t)
+ delay(_buttonPressTimer - t);
- case 3:
- mode = 0;
- _lastButtonShape = 0;
- pageNum = 6;
+ case 2:
+ mode = 0;
+ _lastButtonShape = 0;
+ break;
- x2 = x1;
- y2 = y1;
- x1 = 0;
- y1 = 0;
- break;
+ case 3:
+ mode = 0;
+ _lastButtonShape = 0;
+ pageNum = 6;
+
+ x2 = x1;
+ y2 = y1;
+ x1 = 0;
+ y1 = 0;
+ break;
- default:
- break;
+ default:
+ break;
}
_screen->drawShape(pageNum, _gameShapes[shapeIndex], x1, y1, 0, mode, _screen->_paletteOverlay1, 1);
@@ -755,53 +755,53 @@ void LoLEngine::gui_triggerEvent(int eventType) {
evt.type = Common::EVENT_KEYDOWN;
switch (eventType) {
- case 96:
- evt.kbd.keycode = Common::KEYCODE_UP;
- break;
- case 102:
- evt.kbd.keycode = Common::KEYCODE_RIGHT;
- break;
- case 97:
- evt.kbd.keycode = Common::KEYCODE_DOWN;
- break;
- case 92:
- evt.kbd.keycode = Common::KEYCODE_LEFT;
- break;
- case 91:
- evt.kbd.keycode = Common::KEYCODE_HOME;
- break;
- case 101:
- evt.kbd.keycode = Common::KEYCODE_PAGEUP;
- break;
- case 112:
- evt.kbd.keycode = Common::KEYCODE_F1;
- break;
- case 113:
- evt.kbd.keycode = Common::KEYCODE_F2;
- break;
- case 114:
- evt.kbd.keycode = Common::KEYCODE_F3;
- break;
- case 25:
- evt.kbd.keycode = Common::KEYCODE_o;
- break;
- case 20:
- evt.kbd.keycode = Common::KEYCODE_r;
- break;
- case 110:
- evt.kbd.keycode = Common::KEYCODE_ESCAPE;
- break;
- case 43:
- evt.kbd.keycode = Common::KEYCODE_SPACE;
- break;
- case 61:
- evt.kbd.keycode = Common::KEYCODE_RETURN;
- break;
- case 55:
- evt.kbd.keycode = Common::KEYCODE_SLASH;
- break;
- default:
- break;
+ case 96:
+ evt.kbd.keycode = Common::KEYCODE_UP;
+ break;
+ case 102:
+ evt.kbd.keycode = Common::KEYCODE_RIGHT;
+ break;
+ case 97:
+ evt.kbd.keycode = Common::KEYCODE_DOWN;
+ break;
+ case 92:
+ evt.kbd.keycode = Common::KEYCODE_LEFT;
+ break;
+ case 91:
+ evt.kbd.keycode = Common::KEYCODE_HOME;
+ break;
+ case 101:
+ evt.kbd.keycode = Common::KEYCODE_PAGEUP;
+ break;
+ case 112:
+ evt.kbd.keycode = Common::KEYCODE_F1;
+ break;
+ case 113:
+ evt.kbd.keycode = Common::KEYCODE_F2;
+ break;
+ case 114:
+ evt.kbd.keycode = Common::KEYCODE_F3;
+ break;
+ case 25:
+ evt.kbd.keycode = Common::KEYCODE_o;
+ break;
+ case 20:
+ evt.kbd.keycode = Common::KEYCODE_r;
+ break;
+ case 110:
+ evt.kbd.keycode = Common::KEYCODE_ESCAPE;
+ break;
+ case 43:
+ evt.kbd.keycode = Common::KEYCODE_SPACE;
+ break;
+ case 61:
+ evt.kbd.keycode = Common::KEYCODE_RETURN;
+ break;
+ case 55:
+ evt.kbd.keycode = Common::KEYCODE_SLASH;
+ break;
+ default:
+ break;
}
}
@@ -1409,32 +1409,32 @@ int LoLEngine::clickedWall(Button *button) {
int res = 0;
switch (type) {
- case 1:
- res = clickedWallShape(block, dir);
- break;
+ case 1:
+ res = clickedWallShape(block, dir);
+ break;
- case 2:
- res = clickedLeverOn(block, dir);
- break;
+ case 2:
+ res = clickedLeverOn(block, dir);
+ break;
- case 3:
- res = clickedLeverOff(block, dir);
- break;
+ case 3:
+ res = clickedLeverOff(block, dir);
+ break;
- case 4:
- res = clickedWallOnlyScript(block);
- break;
+ case 4:
+ res = clickedWallOnlyScript(block);
+ break;
- case 5:
- res = clickedDoorSwitch(block, dir);
- break;
+ case 5:
+ res = clickedDoorSwitch(block, dir);
+ break;
- case 6:
- res = clickedNiche(block, dir);
- break;
+ case 6:
+ res = clickedNiche(block, dir);
+ break;
- default:
- break;
+ default:
+ break;
}
return res;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 9f3056e422..2ad6d54bc1 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -260,60 +260,60 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop) {
quitGame();
} else {
switch(event.kbd.keycode) {
- case Common::KEYCODE_SPACE:
- keys = 43;
- break;
- case Common::KEYCODE_RETURN:
- keys = 61;
- break;
- case Common::KEYCODE_UP:
- case Common::KEYCODE_KP8:
- keys = 96;
- break;
- case Common::KEYCODE_RIGHT:
- case Common::KEYCODE_KP6:
- keys = 102;
- break;
- case Common::KEYCODE_DOWN:
- case Common::KEYCODE_KP2:
- keys = 97;
- break;
- case Common::KEYCODE_LEFT:
- case Common::KEYCODE_KP4:
- keys = 92;
- break;
- case Common::KEYCODE_HOME:
- case Common::KEYCODE_KP7:
- keys = 91;
- break;
- case Common::KEYCODE_PAGEUP:
- case Common::KEYCODE_KP9:
- keys = 101;
- break;
- case Common::KEYCODE_F1:
- keys = 112;
- break;
- case Common::KEYCODE_F2:
- keys = 113;
- break;
- case Common::KEYCODE_F3:
- keys = 114;
- break;
- case Common::KEYCODE_o:
- keys = 25;
- break;
- case Common::KEYCODE_r:
- keys = 20;
- break;
- case Common::KEYCODE_SLASH:
- keys = 55;
- break;
- case Common::KEYCODE_ESCAPE:
- keys = 110;
- break;
- default:
- keys = 0;
- break;
+ case Common::KEYCODE_SPACE:
+ keys = 43;
+ break;
+ case Common::KEYCODE_RETURN:
+ keys = 61;
+ break;
+ case Common::KEYCODE_UP:
+ case Common::KEYCODE_KP8:
+ keys = 96;
+ break;
+ case Common::KEYCODE_RIGHT:
+ case Common::KEYCODE_KP6:
+ keys = 102;
+ break;
+ case Common::KEYCODE_DOWN:
+ case Common::KEYCODE_KP2:
+ keys = 97;
+ break;
+ case Common::KEYCODE_LEFT:
+ case Common::KEYCODE_KP4:
+ keys = 92;
+ break;
+ case Common::KEYCODE_HOME:
+ case Common::KEYCODE_KP7:
+ keys = 91;
+ break;
+ case Common::KEYCODE_PAGEUP:
+ case Common::KEYCODE_KP9:
+ keys = 101;
+ break;
+ case Common::KEYCODE_F1:
+ keys = 112;
+ break;
+ case Common::KEYCODE_F2:
+ keys = 113;
+ break;
+ case Common::KEYCODE_F3:
+ keys = 114;
+ break;
+ case Common::KEYCODE_o:
+ keys = 25;
+ break;
+ case Common::KEYCODE_r:
+ keys = 20;
+ break;
+ case Common::KEYCODE_SLASH:
+ keys = 55;
+ break;
+ case Common::KEYCODE_ESCAPE:
+ keys = 110;
+ break;
+ default:
+ keys = 0;
+ break;
}
// When we got an keypress, which we might need to handle,
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index d185651ca1..2d9bb388dd 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1333,32 +1333,32 @@ void LoLEngine::increaseExperience(int charNum, int skill, uint32 points) {
int inc = 0;
switch (skill) {
- case 0:
- _txt->printMessage(0x8003, getLangString(0x4023), _characters[charNum].name);
- inc = _rnd.getRandomNumberRng(4, 6);
- _characters[charNum].hitPointsCur += inc;
- _characters[charNum].hitPointsMax += inc;
- break;
+ case 0:
+ _txt->printMessage(0x8003, getLangString(0x4023), _characters[charNum].name);
+ inc = _rnd.getRandomNumberRng(4, 6);
+ _characters[charNum].hitPointsCur += inc;
+ _characters[charNum].hitPointsMax += inc;
+ break;
- case 1:
- _txt->printMessage(0x8003, getLangString(0x4025), _characters[charNum].name);
- inc = _rnd.getRandomNumberRng(2, 6);
- _characters[charNum].hitPointsCur += inc;
- _characters[charNum].hitPointsMax += inc;
- break;
+ case 1:
+ _txt->printMessage(0x8003, getLangString(0x4025), _characters[charNum].name);
+ inc = _rnd.getRandomNumberRng(2, 6);
+ _characters[charNum].hitPointsCur += inc;
+ _characters[charNum].hitPointsMax += inc;
+ break;
- case 2:
- _txt->printMessage(0x8003, getLangString(0x4024), _characters[charNum].name);
- inc = (_characters[charNum].defaultModifiers[6] * (_rnd.getRandomNumberRng(1, 8) + 17)) >> 8;
- _characters[charNum].magicPointsCur += inc;
- _characters[charNum].magicPointsMax += inc;
- inc = _rnd.getRandomNumberRng(1, 6);
- _characters[charNum].hitPointsCur += inc;
- _characters[charNum].hitPointsMax += inc;
- break;
+ case 2:
+ _txt->printMessage(0x8003, getLangString(0x4024), _characters[charNum].name);
+ inc = (_characters[charNum].defaultModifiers[6] * (_rnd.getRandomNumberRng(1, 8) + 17)) >> 8;
+ _characters[charNum].magicPointsCur += inc;
+ _characters[charNum].magicPointsMax += inc;
+ inc = _rnd.getRandomNumberRng(1, 6);
+ _characters[charNum].hitPointsCur += inc;
+ _characters[charNum].hitPointsMax += inc;
+ break;
- default:
- break;
+ default:
+ break;
}
snd_playSoundEffect(118, -1);
@@ -2899,33 +2899,33 @@ void LoLEngine::characterHitpointsZero(int16 charNum, int deathFlag) {
void LoLEngine::removeCharacterEffects(LoLCharacter *c, int first, int last) {
for (int i = first; i <= last; i++) {
switch (i - 1) {
- case 0:
- c->flags &= 0xfffb;
- c->weaponHit = 0;
- break;
+ case 0:
+ c->flags &= 0xfffb;
+ c->weaponHit = 0;
+ break;
- case 1:
- c->damageSuffered = 0;
- break;
+ case 1:
+ c->damageSuffered = 0;
+ break;
- case 2:
- c->flags &= 0xffbf;
- break;
+ case 2:
+ c->flags &= 0xffbf;
+ break;
- case 3:
- c->flags &= 0xff7f;
- break;
+ case 3:
+ c->flags &= 0xff7f;
+ break;
- case 4:
- c->flags &= 0xfeff;
- break;
+ case 4:
+ c->flags &= 0xfeff;
+ break;
- case 6:
- c->flags &= 0xefff;
- break;
+ case 6:
+ c->flags &= 0xefff;
+ break;
- default:
- break;
+ default:
+ break;
}
for (int ii = 0; ii < 5; ii++) {
@@ -2985,67 +2985,66 @@ void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, in
int t = 0;
switch (monster->properties->attackSkillType - 1) {
- case 0:
- t = removeCharacterItem(target, 0x7ff);
- if (t) {
- giveItemToMonster(monster, t);
- if (characterSays(0x4019, _characters[target].id, true))
- _txt->printMessage(6, getLangString(0x4019));
- }
- break;
-
- case 1:
- // poison character
- paralyzePoisonCharacter(target, 0x80, 0x88, 100, 1);
- break;
+ case 0:
+ t = removeCharacterItem(target, 0x7ff);
+ if (t) {
+ giveItemToMonster(monster, t);
+ if (characterSays(0x4019, _characters[target].id, true))
+ _txt->printMessage(6, getLangString(0x4019));
+ }
+ break;
- case 2:
- t = removeCharacterItem(target, 0x20);
- if (t) {
- deleteItem(t);
- if (characterSays(0x401b, _characters[target].id, true))
- _txt->printMessage(6, getLangString(0x401b));
- }
- break;
+ case 1:
+ // poison character
+ paralyzePoisonCharacter(target, 0x80, 0x88, 100, 1);
+ break;
- case 3:
- t = removeCharacterItem(target, 0x0f);
- if (t) {
- if (characterSays(0x401e, _characters[target].id, true))
- _txt->printMessage(6, getLangString(0x401e), _characters[target].name);
- setItemPosition(t, monster->x, monster->y, 0, 1);
- }
- break;
+ case 2:
+ t = removeCharacterItem(target, 0x20);
+ if (t) {
+ deleteItem(t);
+ if (characterSays(0x401b, _characters[target].id, true))
+ _txt->printMessage(6, getLangString(0x401b));
+ }
+ break;
- case 5:
- if (_characters[target].magicPointsCur <= 0)
- return;
+ case 3:
+ t = removeCharacterItem(target, 0x0f);
+ if (t) {
+ if (characterSays(0x401e, _characters[target].id, true))
+ _txt->printMessage(6, getLangString(0x401e), _characters[target].name);
+ setItemPosition(t, monster->x, monster->y, 0, 1);
+ }
+ break;
- monster->hitPoints += _characters[target].magicPointsCur;
- _characters[target].magicPointsCur = 0;
- gui_drawCharPortraitWithStats(target);
- if (characterSays(0x4020, _characters[target].id, true))
- _txt->printMessage(6, getLangString(0x4020), _characters[target].name);
- break;
+ case 5:
+ if (_characters[target].magicPointsCur <= 0)
+ return;
- case 7:
- stunCharacter(target);
- break;
+ monster->hitPoints += _characters[target].magicPointsCur;
+ _characters[target].magicPointsCur = 0;
+ gui_drawCharPortraitWithStats(target);
+ if (characterSays(0x4020, _characters[target].id, true))
+ _txt->printMessage(6, getLangString(0x4020), _characters[target].name);
+ break;
- case 8:
- monster->hitPoints += damage;
- if (monster->hitPoints > monster->properties->hitPoints)
- monster->hitPoints = monster->properties->hitPoints;
+ case 7:
+ stunCharacter(target);
+ break;
- break;
+ case 8:
+ monster->hitPoints += damage;
+ if (monster->hitPoints > monster->properties->hitPoints)
+ monster->hitPoints = monster->properties->hitPoints;
+ break;
- case 9:
- // paralyze party (spider web)
- paralyzePoisonAllCharacters(0x40, 0x48, 100);
- break;
+ case 9:
+ // paralyze party (spider web)
+ paralyzePoisonAllCharacters(0x40, 0x48, 100);
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -3056,66 +3055,64 @@ void LoLEngine::applyMonsterDefenseSkill(MonsterInPlay *monster, int16 attacker,
int itm = 0;
switch (monster->properties->defenseSkillType - 1) {
- case 0:
- case 1:
- if ((deathFlag & 0x3f) == 2 || skill)
- return;
-
- for (int i = 0; i < 3 ; i++) {
- itm = _characters[attacker].items[i];
- if (!itm)
- continue;
- if ((_itemProperties[_itemsInPlay[itm].itemPropertyIndex].protection & 0x3f) != deathFlag)
- continue;
+ case 0:
+ case 1:
+ if ((deathFlag & 0x3f) == 2 || skill)
+ return;
- removeCharacterItem(attacker, 0x7fff);
-
- if (monster->properties->defenseSkillType == 1) {
- deleteItem(itm);
- if (characterSays(0x401d, _characters[attacker].id, true))
- _txt->printMessage(6, getLangString(0x401d));
- } else {
- giveItemToMonster(monster, itm);
- if (characterSays(0x401c, _characters[attacker].id, true))
- _txt->printMessage(6, getLangString(0x401c));
- }
- }
- break;
+ for (int i = 0; i < 3 ; i++) {
+ itm = _characters[attacker].items[i];
+ if (!itm)
+ continue;
+ if ((_itemProperties[_itemsInPlay[itm].itemPropertyIndex].protection & 0x3f) != deathFlag)
+ continue;
- case 2:
- if (!(deathFlag & 0x80))
- return;
- monster->flags |= 8;
- monster->direction = calcMonsterDirection(monster->x, monster->y, _partyPosX, _partyPosY) ^ 4;
- setMonsterMode(monster, 9);
- monster->fightCurTick = 30;
- break;
+ removeCharacterItem(attacker, 0x7fff);
- case 3:
- if (deathFlag != 3)
- return;
- monster->hitPoints += damage;
- if (monster->hitPoints > monster->properties->hitPoints)
- monster->hitPoints = monster->properties->hitPoints;
+ if (monster->properties->defenseSkillType == 1) {
+ deleteItem(itm);
+ if (characterSays(0x401d, _characters[attacker].id, true))
+ _txt->printMessage(6, getLangString(0x401d));
+ } else {
+ giveItemToMonster(monster, itm);
+ if (characterSays(0x401c, _characters[attacker].id, true))
+ _txt->printMessage(6, getLangString(0x401c));
+ }
+ }
+ break;
+ case 2:
+ if (!(deathFlag & 0x80))
+ return;
+ monster->flags |= 8;
+ monster->direction = calcMonsterDirection(monster->x, monster->y, _partyPosX, _partyPosY) ^ 4;
+ setMonsterMode(monster, 9);
+ monster->fightCurTick = 30;
+ break;
- break;
+ case 3:
+ if (deathFlag != 3)
+ return;
+ monster->hitPoints += damage;
+ if (monster->hitPoints > monster->properties->hitPoints)
+ monster->hitPoints = monster->properties->hitPoints;
+ break;
- case 4:
- if (!(deathFlag & 0x80))
- return;
- monster->hitPoints += damage;
- if (monster->hitPoints > monster->properties->hitPoints)
- monster->hitPoints = monster->properties->hitPoints;
- break;
+ case 4:
+ if (!(deathFlag & 0x80))
+ return;
+ monster->hitPoints += damage;
+ if (monster->hitPoints > monster->properties->hitPoints)
+ monster->hitPoints = monster->properties->hitPoints;
+ break;
- case 5:
- if ((deathFlag & 0x84) == 0x84)
- monster->numDistAttacks++;
- break;
+ case 5:
+ if ((deathFlag & 0x84) == 0x84)
+ monster->numDistAttacks++;
+ break;
- default:
- break;
+ default:
+ break;
}
}
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index a92f3f8240..79da4a994d 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -661,20 +661,20 @@ void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int buttonShape)
if (_sceneDefaultUpdate) {
switch (unk2) {
- case 0:
- movePartySmoothScrollUp(2);
- break;
- case 1:
- movePartySmoothScrollDown(2);
- break;
- case 2:
- movePartySmoothScrollLeft(1);
- break;
- case 3:
- movePartySmoothScrollRight(1);
- break;
- default:
- break;
+ case 0:
+ movePartySmoothScrollUp(2);
+ break;
+ case 1:
+ movePartySmoothScrollDown(2);
+ break;
+ case 2:
+ movePartySmoothScrollLeft(1);
+ break;
+ case 3:
+ movePartySmoothScrollRight(1);
+ break;
+ default:
+ break;
}
} else {
gui_drawScene(0);
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 4dca1e9bf0..ce752e6254 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -143,51 +143,51 @@ int LoLEngine::olol_moveParty(EMCState *script) {
b.data0Val3 = b.data1Val3 = b.data2Val3 = 0x01;
switch (mode) {
- case 0:
- clickedUpArrow(&b);
- break;
-
- case 1:
- clickedRightArrow(&b);
- break;
-
- case 2:
- clickedDownArrow(&b);
- break;
-
- case 3:
- clickedLeftArrow(&b);
- break;
-
- case 4:
- clickedTurnLeftArrow(&b);
- break;
-
- case 5:
- clickedTurnRightArrow(&b);
- break;
-
- case 10:
- case 11:
- case 12:
- case 13:
- mode = ABS(mode - 10 - _currentDirection);
- if (mode > 2)
- mode = (mode ^ 2) * -1;
-
- while (mode) {
- if (mode > 0) {
- clickedTurnRightArrow(&b);
- mode--;
- } else {
- clickedTurnLeftArrow(&b);
- mode++;
- }
+ case 0:
+ clickedUpArrow(&b);
+ break;
+
+ case 1:
+ clickedRightArrow(&b);
+ break;
+
+ case 2:
+ clickedDownArrow(&b);
+ break;
+
+ case 3:
+ clickedLeftArrow(&b);
+ break;
+
+ case 4:
+ clickedTurnLeftArrow(&b);
+ break;
+
+ case 5:
+ clickedTurnRightArrow(&b);
+ break;
+
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ mode = ABS(mode - 10 - _currentDirection);
+ if (mode > 2)
+ mode = (mode ^ 2) * -1;
+
+ while (mode) {
+ if (mode > 0) {
+ clickedTurnRightArrow(&b);
+ mode--;
+ } else {
+ clickedTurnLeftArrow(&b);
+ mode++;
}
- break;
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
return 1;
@@ -1200,30 +1200,30 @@ int LoLEngine::olol_changeMonsterStat(EMCState *script) {
uint16 y = 0;
switch (stackPos(1)) {
- case 0:
- setMonsterMode(m, d);
- break;
-
- case 1:
- m->hitPoints = d;
- break;
-
- case 2:
- calcCoordinates(x, y, d, m->x & 0xff, m->y & 0xff);
- if (!walkMonsterCheckDest(x, y, m, 7))
- placeMonster(m, x, y);
- break;
-
- case 3:
- setMonsterDirection(m, d << 1);
- break;
-
- case 6:
- m->flags |= d;
- break;
-
- default:
- break;
+ case 0:
+ setMonsterMode(m, d);
+ break;
+
+ case 1:
+ m->hitPoints = d;
+ break;
+
+ case 2:
+ calcCoordinates(x, y, d, m->x & 0xff, m->y & 0xff);
+ if (!walkMonsterCheckDest(x, y, m, 7))
+ placeMonster(m, x, y);
+ break;
+
+ case 3:
+ setMonsterDirection(m, d << 1);
+ break;
+
+ case 6:
+ m->flags |= d;
+ break;
+
+ default:
+ break;
}
return 1;
@@ -1238,26 +1238,26 @@ int LoLEngine::olol_getMonsterStat(EMCState *script) {
int d = stackPos(1);
switch (d) {
- case 0:
- return m->mode;
- case 1:
- return m->hitPoints;
- case 2:
- return m->block;
- case 3:
- return m->facing;
- case 4:
- return m->type;
- case 5:
- return m->properties->hitPoints;
- case 6:
- return m->flags;
- case 7:
- return m->properties->flags;
- case 8:
- return _monsterAnimType[m->properties->shapeIndex];
- default:
- break;
+ case 0:
+ return m->mode;
+ case 1:
+ return m->hitPoints;
+ case 2:
+ return m->block;
+ case 3:
+ return m->facing;
+ case 4:
+ return m->type;
+ case 5:
+ return m->properties->hitPoints;
+ case 6:
+ return m->flags;
+ case 7:
+ return m->properties->flags;
+ case 8:
+ return _monsterAnimType[m->properties->shapeIndex];
+ default:
+ break;
}
return 0;
@@ -2074,46 +2074,46 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
uint8 *tmp = 0;
switch (param[0]) {
- case 0:
+ case 0:
+ _screen->fadeClearSceneWindow(10);
+ break;
+
+ case 1:
+ tmp = _screen->getPalette(3);
+ memcpy(tmp + 0x180, _screen->_currentPalette + 0x180, 0x180);
+ _screen->loadSpecialColors(tmp);
+ _screen->fadePalette(tmp, 10);
+ _screen->_fadeFlag = 0;
+ break;
+
+ case 2:
+ _screen->fadeToBlack(10);
+ break;
+
+ case 3:
+ tmp = _screen->getPalette(3);
+ _screen->loadSpecialColors(tmp);
+ _screen->fadePalette(tmp, 10);
+ _screen->_fadeFlag = 0;
+ break;
+
+ case 4:
+ if (_screen->_fadeFlag != 2)
_screen->fadeClearSceneWindow(10);
- break;
-
- case 1:
- tmp = _screen->getPalette(3);
- memcpy(tmp + 0x180, _screen->_currentPalette + 0x180, 0x180);
- _screen->loadSpecialColors(tmp);
- _screen->fadePalette(tmp, 10);
- _screen->_fadeFlag = 0;
- break;
-
- case 2:
- _screen->fadeToBlack(10);
- break;
-
- case 3:
- tmp = _screen->getPalette(3);
- _screen->loadSpecialColors(tmp);
- _screen->fadePalette(tmp, 10);
- _screen->_fadeFlag = 0;
- break;
-
- case 4:
- if (_screen->_fadeFlag != 2)
- _screen->fadeClearSceneWindow(10);
- gui_drawPlayField();
- setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect);
- _screen->_fadeFlag = 0;
- break;
-
- case 5:
- tmp = _screen->getPalette(3);
- _screen->loadSpecialColors(tmp);
- _screen->fadePalette(_screen->getPalette(1), 10);
- _screen->_fadeFlag = 0;
- break;
-
- default:
- break;
+ gui_drawPlayField();
+ setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect);
+ _screen->_fadeFlag = 0;
+ break;
+
+ case 5:
+ tmp = _screen->getPalette(3);
+ _screen->loadSpecialColors(tmp);
+ _screen->fadePalette(_screen->getPalette(1), 10);
+ _screen->_fadeFlag = 0;
+ break;
+
+ default:
+ break;
}
return 1;
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 06e974963a..dfe2323e32 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -583,22 +583,22 @@ void LoLEngine::drawBlockObjects(int blockArrayIndex) {
if (ii != 8) {
switch (_currentDirection - (_flyingObjects[ii].direction >> 1) + 3) {
- case 1:
- case 5:
- shpIndex = _flyingItemShapes[shpIndex].shapeFront;
- break;
- case 3:
- shpIndex = _flyingItemShapes[shpIndex].shapeBack;
- break;
- case 2:
- case 6:
- flg |= 0x10;
- case 0:
- case 4:
- shpIndex = _flyingItemShapes[shpIndex].shapeLeft;
- break;
- default:
- break;
+ case 1:
+ case 5:
+ shpIndex = _flyingItemShapes[shpIndex].shapeFront;
+ break;
+ case 3:
+ shpIndex = _flyingItemShapes[shpIndex].shapeBack;
+ break;
+ case 2:
+ case 6:
+ flg |= 0x10;
+ case 0:
+ case 4:
+ shpIndex = _flyingItemShapes[shpIndex].shapeLeft;
+ break;
+ default:
+ break;
}
shp = _thrownShapes[shpIndex];
@@ -699,60 +699,60 @@ void LoLEngine::drawMonster(uint16 id) {
int LoLEngine::getMonsterCurFrame(MonsterInPlay *m, uint16 dirFlags) {
int tmp = 0;
switch (_monsterAnimType[m->properties->shapeIndex]) {
- case 0:
- // default
- if (dirFlags) {
- return (m->mode == 13) ? -1 : (dirFlags + m->currentSubFrame);
- } else {
- if (m->damageReceived)
- return 12;
-
- switch (m->mode - 5) {
- case 0:
- return (m->properties->flags & 4) ? 13 : 0;
- case 3:
- return (m->fightCurTick + 13);
- case 6:
- return 14;
- case 8:
- return -1;
- default:
- return m->currentSubFrame;
- }
- }
- break;
- case 1:
- // monsters whose outward appearance reflects the damage they have taken
- tmp = (m->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8;
- if (m->hitPoints > (tmp >> 1))
- tmp = 0;
- else if (m->hitPoints > (tmp >> 2))
- tmp = 4;
- else
- tmp = 8;
-
- switch (m->mode) {
- case 8:
- return (m->fightCurTick + tmp);
- case 11:
- return 12;
- case 13:
- return (m->fightCurTick + 12);
- default:
- return tmp;
+ case 0:
+ // default
+ if (dirFlags) {
+ return (m->mode == 13) ? -1 : (dirFlags + m->currentSubFrame);
+ } else {
+ if (m->damageReceived)
+ return 12;
+
+ switch (m->mode - 5) {
+ case 0:
+ return (m->properties->flags & 4) ? 13 : 0;
+ case 3:
+ return (m->fightCurTick + 13);
+ case 6:
+ return 14;
+ case 8:
+ return -1;
+ default:
+ return m->currentSubFrame;
}
-
- break;
- case 2:
- ///////
- // TODO
- break;
- case 3:
- ///////
- // TODO
- break;
+ }
+ break;
+ case 1:
+ // monsters whose outward appearance reflects the damage they have taken
+ tmp = (m->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8;
+ if (m->hitPoints > (tmp >> 1))
+ tmp = 0;
+ else if (m->hitPoints > (tmp >> 2))
+ tmp = 4;
+ else
+ tmp = 8;
+
+ switch (m->mode) {
+ case 8:
+ return (m->fightCurTick + tmp);
+ case 11:
+ return 12;
+ case 13:
+ return (m->fightCurTick + 12);
default:
- break;
+ return tmp;
+ }
+
+ break;
+ case 2:
+ ///////
+ // TODO
+ break;
+ case 3:
+ ///////
+ // TODO
+ break;
+ default:
+ break;
}
return 0;
@@ -1064,102 +1064,101 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) {
}
switch (monster->mode) {
- case 0:
- case 1:
- // friendly mode
- if (monster->flags & 0x10) {
- for (int i = 0; i < 30; i++) {
- if (_monsters[i].mode == 1)
- setMonsterMode(&_monsters[i], 7);
- }
- } else if (monster->mode == 1) {
- moveMonster(monster);
+ case 0:
+ case 1:
+ // friendly mode
+ if (monster->flags & 0x10) {
+ for (int i = 0; i < 30; i++) {
+ if (_monsters[i].mode == 1)
+ setMonsterMode(&_monsters[i], 7);
}
- break;
-
- case 2:
+ } else if (monster->mode == 1) {
moveMonster(monster);
- break;
-
- case 3:
- if (updateMonsterAdjustBlocks(monster))
- setMonsterMode(monster, 7);
- for (int i = 0; i < 4; i++) {
- if (calcNewBlockPosition(monster->block, i) == _currentBlock)
- setMonsterMode(monster, 7);
- }
- break;
-
- case 4:
- // straying around not tracing the party
- moveStrayingMonster(monster);
- break;
+ }
+ break;
- case 5:
- // second recovery phase after delivering an attack
- // monsters will rearrange positions in this phase so as to allow a maximum
- // number of monsters possible attacking at the same time
- _partyAwake = true;
- monster->fightCurTick--;
- if ((monster->fightCurTick <= 0) || (checkDrawObjectSpace(_partyPosX, _partyPosY, monster->x, monster->y) > 256) || (monster->flags & 8))
- setMonsterMode(monster, 7);
- else
- rearrangeAttackingMonster(monster);
- break;
+ case 2:
+ moveMonster(monster);
+ break;
- case 6:
- // same as mode 5, but without rearranging
- if (--monster->fightCurTick <= 0)
+ case 3:
+ if (updateMonsterAdjustBlocks(monster))
+ setMonsterMode(monster, 7);
+ for (int i = 0; i < 4; i++) {
+ if (calcNewBlockPosition(monster->block, i) == _currentBlock)
setMonsterMode(monster, 7);
- break;
-
- case 7:
- // monster destination is set to current party position
- // depending on the flag setting this gets updated each round
- // monster can't change mode before arriving at destination and/or attacking the party
- if (!chasePartyWithDistanceAttacks(monster))
- chasePartyWithCloseAttacks(monster);
- checkSceneUpdateNeed(monster->block);
- break;
+ }
+ break;
+
+ case 4:
+ // straying around not tracing the party
+ moveStrayingMonster(monster);
+ break;
+
+ case 5:
+ // second recovery phase after delivering an attack
+ // monsters will rearrange positions in this phase so as to allow a maximum
+ // number of monsters possible attacking at the same time
+ _partyAwake = true;
+ monster->fightCurTick--;
+ if ((monster->fightCurTick <= 0) || (checkDrawObjectSpace(_partyPosX, _partyPosY, monster->x, monster->y) > 256) || (monster->flags & 8))
+ setMonsterMode(monster, 7);
+ else
+ rearrangeAttackingMonster(monster);
+ break;
- case 8:
- // first recovery phase after delivering an attack
- if (++monster->fightCurTick > 2) {
- setMonsterMode(monster, 5);
- monster->fightCurTick = (int8) ((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers[6 + _monsterDifficulty]) >> 8);
- }
- checkSceneUpdateNeed(monster->block);
- break;
+ case 6:
+ // same as mode 5, but without rearranging
+ if (--monster->fightCurTick <= 0)
+ setMonsterMode(monster, 7);
+ break;
+
+ case 7:
+ // monster destination is set to current party position
+ // depending on the flag setting this gets updated each round
+ // monster can't change mode before arriving at destination and/or attacking the party
+ if (!chasePartyWithDistanceAttacks(monster))
+ chasePartyWithCloseAttacks(monster);
+ checkSceneUpdateNeed(monster->block);
+ break;
- case 9:
- if (--monster->fightCurTick) {
- chasePartyWithCloseAttacks(monster);
- } else {
- setMonsterMode(monster, 7);
- monster->flags &= 0xfff7;
- }
+ case 8:
+ // first recovery phase after delivering an attack
+ if (++monster->fightCurTick > 2) {
+ setMonsterMode(monster, 5);
+ monster->fightCurTick = (int8) ((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers[6 + _monsterDifficulty]) >> 8);
+ }
+ checkSceneUpdateNeed(monster->block);
+ break;
- break;
+ case 9:
+ if (--monster->fightCurTick) {
+ chasePartyWithCloseAttacks(monster);
+ } else {
+ setMonsterMode(monster, 7);
+ monster->flags &= 0xfff7;
+ }
+ break;
- case 12:
- checkSceneUpdateNeed(monster->block);
- if (++monster->fightCurTick > 13)
- runLevelScriptCustom(0x404, -1, monster->id, monster->id, 0, 0);
- break;
+ case 12:
+ checkSceneUpdateNeed(monster->block);
+ if (++monster->fightCurTick > 13)
+ runLevelScriptCustom(0x404, -1, monster->id, monster->id, 0, 0);
+ break;
- case 13:
- // monster death
- if (++monster->fightCurTick > 2)
- killMonster(monster);
- checkSceneUpdateNeed(monster->block);
- break;
+ case 13:
+ // monster death
+ if (++monster->fightCurTick > 2)
+ killMonster(monster);
+ checkSceneUpdateNeed(monster->block);
+ break;
- case 14:
- monster->damageReceived = 0;
- break;
+ case 14:
+ monster->damageReceived = 0;
+ break;
- default:
- break;
+ default:
+ break;
}
if (monster->damageReceived) {
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 1091fd3a4c..1afe84961a 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -249,35 +249,35 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint
bool eos = false;
switch (para) {
- case '\0':
- eos = true;
- break;
- case '#':
- para = *++s;
- switch (para) {
- case 'E':
- case 'G':
- case 'X':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- case 'g':
- case 's':
- case 'u':
- case 'x':
- break;
- default:
- eos = true;
- break;
- }
+ case '\0':
+ eos = true;
+ break;
+ case '#':
+ para = *++s;
+ switch (para) {
+ case 'E':
+ case 'G':
+ case 'X':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 's':
+ case 'u':
+ case 'x':
break;
- case ' ':
- case '+':
- case '-':
- ++s;
default:
+ eos = true;
break;
+ }
+ break;
+ case ' ':
+ case '+':
+ case '-':
+ ++s;
+ default:
+ break;
}
if (eos)
@@ -286,16 +286,16 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint
para = *s;
switch (para) {
- case '\0':
- eos = true;
- break;
- case '0':
- ++s;
- break;
- default:
- while(para && para > 47 && para < 58)
- para = *++s;
- break;
+ case '\0':
+ eos = true;
+ break;
+ case '0':
+ ++s;
+ break;
+ default:
+ while(para && para > 47 && para < 58)
+ para = *++s;
+ break;
}
if (eos)
@@ -304,32 +304,32 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint
para = *s++;
switch (para) {
- case 'a':
- snprintf(dst, 7, "%d", _scriptParameter);
- dst += strlen(dst);
- break;
-
- case 'n':
- strcpy(dst, _vm->_characters[script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]].name);
- dst += strlen(dst);
- break;
-
- case 's':
- strcpy(dst, _vm->getLangString(script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]));
- dst += strlen(dst);
- break;
-
- case 'X':
- case 'd':
- case 'u':
- case 'x':
- snprintf(dst, 7, "%d", script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]);
- dst += strlen(dst);
- break;
-
- case '\0':
- default:
- continue;
+ case 'a':
+ snprintf(dst, 7, "%d", _scriptParameter);
+ dst += strlen(dst);
+ break;
+
+ case 'n':
+ strcpy(dst, _vm->_characters[script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]].name);
+ dst += strlen(dst);
+ break;
+
+ case 's':
+ strcpy(dst, _vm->getLangString(script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]));
+ dst += strlen(dst);
+ break;
+
+ case 'X':
+ case 'd':
+ case 'u':
+ case 'x':
+ snprintf(dst, 7, "%d", script ? script->stack[script->sp + paramIndex] : paramList[paramIndex]);
+ dst += strlen(dst);
+ break;
+
+ case '\0':
+ default:
+ continue;
}
}
*dst = 0;
@@ -376,66 +376,66 @@ void TextDisplayer_LoL::displayText(char *str, ...) {
}
switch (c - 1) {
- case 0:
- printLine(_currentLine);
- textPageBreak();
- _numCharsPrinted = 0;
- break;
-
- case 1:
- printLine(_currentLine);
- _textDimData[sdx].color2 = parseCommand();
- break;
-
- case 5:
- printLine(_currentLine);
- _textDimData[sdx].color1 = parseCommand();
- break;
-
- case 8:
- //TODO
- break;
-
- case 11:
- //TODO
- break;
-
- case 12:
+ case 0:
+ printLine(_currentLine);
+ textPageBreak();
+ _numCharsPrinted = 0;
+ break;
+
+ case 1:
+ printLine(_currentLine);
+ _textDimData[sdx].color2 = parseCommand();
+ break;
+
+ case 5:
+ printLine(_currentLine);
+ _textDimData[sdx].color1 = parseCommand();
+ break;
+
+ case 8:
+ //TODO
+ break;
+
+ case 11:
+ //TODO
+ break;
+
+ case 12:
+ printLine(_currentLine);
+ _lineCount++;
+ _textDimData[sdx].column = 0;
+ _textDimData[sdx].line++;
+ break;
+
+ case 18:
+ //TODO
+ break;
+
+ case 23:
+ //TODO
+ break;
+
+ case 24:
+ //TODO
+ break;
+
+ case 26:
+ //TODO
+ break;
+
+ case 28:
+ //TODO
+ break;
+
+ default:
+ _lineWidth += _screen->getCharWidth(c);
+ _currentLine[_numCharsLeft++] = c;
+ _currentLine[_numCharsLeft] = 0;
+
+ if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3))
printLine(_currentLine);
- _lineCount++;
- _textDimData[sdx].column = 0;
- _textDimData[sdx].line++;
- break;
-
- case 18:
- //TODO
- break;
-
- case 23:
- //TODO
- break;
-
- case 24:
- //TODO
- break;
-
- case 26:
- //TODO
- break;
-
- case 28:
- //TODO
- break;
-
- default:
- _lineWidth += _screen->getCharWidth(c);
- _currentLine[_numCharsLeft++] = c;
- _currentLine[_numCharsLeft] = 0;
-
- if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3))
- printLine(_currentLine);
-
- break;
+
+ break;
}
c = parseCommand();
@@ -654,25 +654,25 @@ void TextDisplayer_LoL::textPageBreak() {
_vm->gui_notifyButtonListChanged();
switch (inputFlag) {
- case 43:
- case 61:
+ case 43:
+ case 61:
+ loop = false;
+ break;
+
+ case 199:
+ case 201:
+ if (_vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, x, y, x + 74, y + 9))
+ target = true;
+ break;
+
+ case 200:
+ case 202:
+ if (target)
loop = false;
- break;
-
- case 199:
- case 201:
- if (_vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, x, y, x + 74, y + 9))
- target = true;
- break;
-
- case 200:
- case 202:
- if (target)
- loop = false;
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
} while (loop);