aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorNorbert Lange2009-07-17 21:23:54 +0000
committerNorbert Lange2009-07-17 21:23:54 +0000
commitbb64bf008d03e01760a468d0df8cacb164725d41 (patch)
treed73710df5b07f3fa1ca30e719c1c1f58ebe0b107 /engines/kyra
parent81ac29ebca30c352646a5b21de512087cb96a672 (diff)
parent53756ef1d022a959b24c041e18f55eef34e60dd3 (diff)
downloadscummvm-rg350-bb64bf008d03e01760a468d0df8cacb164725d41.tar.gz
scummvm-rg350-bb64bf008d03e01760a468d0df8cacb164725d41.tar.bz2
scummvm-rg350-bb64bf008d03e01760a468d0df8cacb164725d41.zip
merge with trunk
svn-id: r42574
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/detection.cpp26
-rw-r--r--engines/kyra/gui.h2
-rw-r--r--engines/kyra/kyra_lok.cpp2
-rw-r--r--engines/kyra/kyra_mr.cpp7
-rw-r--r--engines/kyra/kyra_v1.cpp5
-rw-r--r--engines/kyra/lol.cpp45
-rw-r--r--engines/kyra/lol.h5
-rw-r--r--engines/kyra/saveload.cpp4
-rw-r--r--engines/kyra/saveload_lok.cpp8
-rw-r--r--engines/kyra/scene_lol.cpp4
-rw-r--r--engines/kyra/scene_v2.cpp2
-rw-r--r--engines/kyra/screen.cpp308
-rw-r--r--engines/kyra/screen.h25
-rw-r--r--engines/kyra/screen_lol.cpp156
-rw-r--r--engines/kyra/screen_lol.h21
-rw-r--r--engines/kyra/script.cpp2
-rw-r--r--engines/kyra/script_lol.cpp23
-rw-r--r--engines/kyra/script_tim.cpp12
-rw-r--r--engines/kyra/sequences_hof.cpp10
-rw-r--r--engines/kyra/sequences_lok.cpp2
-rw-r--r--engines/kyra/sequences_lol.cpp2
-rw-r--r--engines/kyra/sound.h20
-rw-r--r--engines/kyra/sound_adlib.h113
-rw-r--r--engines/kyra/sound_intern.h65
-rw-r--r--engines/kyra/sound_pcspk.cpp31
-rw-r--r--engines/kyra/sprites_lol.cpp8
-rw-r--r--engines/kyra/staticres.cpp36
-rw-r--r--engines/kyra/text_lol.h2
-rw-r--r--engines/kyra/timer_lol.cpp4
29 files changed, 312 insertions, 638 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 3491c54b36..3199a043e7 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -230,7 +230,7 @@ const KYRAGameDescription adGameDescs[] = {
KYRA1_FLOPPY_FLAGS
},
- { // FM-Towns version
+ { // FM-TOWNS version
{
"kyra1",
0,
@@ -263,26 +263,12 @@ const KYRAGameDescription adGameDescs[] = {
KYRA1_TOWNS_SJIS_FLAGS
},
- { // PC-9821 (CD) version
- {
- "kyra1",
- "CD",
- {
- { "EMC.PAK", 0, "a046bb0b422061aab8e4c4689400343a", -1 },
- { "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 },
- { NULL, 0, NULL, 0 }
- },
- Common::EN_ANY,
- Common::kPlatformPC98,
- ADGF_CD,
- Common::GUIO_NOSPEECH
- },
- KYRA1_TOWNS_FLAGS
- },
+ // PC-9801 floppy + CD / PC-9821 floppy version are all using the same data files,
+ // thus we will mark it as non CD game.
{
{
"kyra1",
- "CD",
+ "",
{
{ "JMC.PAK", 0, "9c5707a2a478e8167e44283246612d2c", -1 },
{ "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 },
@@ -290,7 +276,7 @@ const KYRAGameDescription adGameDescs[] = {
},
Common::JA_JPN,
Common::kPlatformPC98,
- ADGF_CD,
+ ADGF_NO_FLAGS,
Common::GUIO_NOSPEECH
},
KYRA1_TOWNS_SJIS_FLAGS
@@ -652,7 +638,7 @@ const KYRAGameDescription adGameDescs[] = {
KYRA2_DEMO_FLAGS
},
- { // FM-Towns
+ { // FM-TOWNS
{
"kyra2",
0,
diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h
index 3989062506..95df656977 100644
--- a/engines/kyra/gui.h
+++ b/engines/kyra/gui.h
@@ -260,7 +260,7 @@ private:
void drawBox(int x, int y, int w, int h, int fill);
bool getInput();
- void printString(const char *string, int x, int y, int col1, int col2, int flags, ...);
+ void printString(const char *string, int x, int y, int col1, int col2, int flags, ...) GCC_PRINTF(2, 8);
};
} // end of namesapce Kyra
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index e5ca52abcc..a3a249de18 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -434,7 +434,7 @@ void KyraEngine_LoK::mainLoop() {
// FIXME: Why is this here?
_screen->showMouse();
- int inputFlag = checkInput(_buttonList, true);
+ int inputFlag = checkInput(_buttonList, _currentCharacter->sceneId != 210);
removeInputTop();
updateMousePointer();
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 871edd578d..a00b3a8956 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -310,16 +310,19 @@ Common::Error KyraEngine_MR::go() {
break;
case 3:
- default:
fadeOutMusic(60);
_screen->fadeToBlack(60);
uninitMainMenu();
quitGame();
running = false;
+ break;
+
+ default:
+ break;
}
}
- if (_showOutro)
+ if (_showOutro && !shouldQuit())
playVQA("CREDITS");
return Common::kNoError;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index a8889768a7..186b270e58 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -117,7 +117,6 @@ Common::Error KyraEngine_v1::init() {
_sound = new SoundAmiga(this, _mixer);
} else if (midiDriver == MD_ADLIB) {
_sound = new SoundAdlibPC(this, _mixer);
- assert(_sound);
} else {
Sound::kType type;
@@ -128,7 +127,6 @@ Common::Error KyraEngine_v1::init() {
else
type = Sound::kMidiGM;
-
MidiDriver *driver = 0;
if (midiDriver == MD_PCSPK) {
@@ -153,9 +151,10 @@ Common::Error KyraEngine_v1::init() {
assert(adlib);
_sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib);
- assert(_sound);
}
}
+
+ assert(_sound);
}
if (_sound)
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 020e1ea3ea..d2c8be9556 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -214,8 +214,6 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_compassBroken = _drainMagic = 0;
_dialogueField = false;
- _rndSpecial = 0x12349876;
-
_buttonData = 0;
_activeButtons = 0;
gui_resetButtonList();
@@ -1082,7 +1080,7 @@ bool LoLEngine::addCharacter(int id) {
loadCharFaceShapes(numChars, id);
- _characters[numChars].nextAnimUpdateCountdown = (int16) _rnd.getRandomNumberRng(1, 12) + 6;
+ _characters[numChars].nextAnimUpdateCountdown = rollDice(1, 12) + 6;
for (i = 0; i < 11; i++) {
if (_characters[numChars].items[i]) {
@@ -1176,7 +1174,7 @@ void LoLEngine::updatePortraitSpeechAnim() {
}
}
- int f = _rnd.getRandomNumberRng(1, 6) - 1;
+ int f = rollDice(1, 6) - 1;
if (f == _characters[_updateCharNum].curFaceFrame)
f++;
if (f > 5)
@@ -1404,24 +1402,24 @@ void LoLEngine::increaseExperience(int charNum, int skill, uint32 points) {
switch (skill) {
case 0:
_txt->printMessage(0x8003, getLangString(0x4023), _characters[charNum].name);
- inc = _rnd.getRandomNumberRng(4, 6);
+ inc = rollDice(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);
+ inc = rollDice(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;
+ inc = (_characters[charNum].defaultModifiers[6] * (rollDice(1, 8) + 17)) >> 8;
_characters[charNum].magicPointsCur += inc;
_characters[charNum].magicPointsMax += inc;
- inc = _rnd.getRandomNumberRng(1, 6);
+ inc = rollDice(1, 6);
_characters[charNum].hitPointsCur += inc;
_characters[charNum].hitPointsMax += inc;
break;
@@ -1874,6 +1872,17 @@ void LoLEngine::delay(uint32 millis, bool doUpdate, bool) {
}
}
+int LoLEngine::rollDice(int times, int pips) {
+ if (times <= 0 || pips <= 0)
+ return 0;
+
+ int res = 0;
+ while (times--)
+ res += _rnd.getRandomNumberRng(1, pips);
+
+ return res;
+}
+
void LoLEngine::updateEnvironmentalSfx(int soundId) {
snd_processEnvironmentalSoundEffect(soundId, _currentBlock);
}
@@ -1885,7 +1894,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
_activeSpell.spell = spellType;
_activeSpell.p = &_spellProperties[spellType];
- _activeSpell.level = spellLevel < 0 ? -spellLevel : spellLevel;
+ _activeSpell.level = ABS(spellLevel);
if ((_spellProperties[spellType].flags & 0x100) && testWallFlag(calcNewBlockPosition(_currentBlock, _currentDirection), _currentDirection, 1)) {
_txt->printMessage(2, getLangString(0x4257));
@@ -2260,7 +2269,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) {
} else {
uint16 o = _levelBlockProperties[calcNewBlockPosition(_currentBlock, _currentDirection)].assignedObjects;
while (o & 0x8000) {
- int might = _rnd.getRandomNumberRng(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel];
+ int might = rollDice(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel];
int dmg = calcInflictableDamagePerItem(charNum, 0, might, 3, 2);
MonsterInPlay *m = &_monsters[o & 0x7fff];
@@ -2880,7 +2889,7 @@ void LoLEngine::drinkBezelCup(int numUses, int charNum) {
uint16 step = 0;
do {
- step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 2]);
+ step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 1]);
increaseCharacterHitpoints(charNum, step / 256, true);
gui_drawCharPortraitWithStats(charNum);
@@ -3192,7 +3201,7 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) {
evadeChanceModifier = _characters[target].defaultModifiers[3];
}
- int r = _rnd.getRandomNumberRng(1, 100);
+ int r = rollDice(1, 100);
if (r >= sk)
return 2;
@@ -3230,9 +3239,9 @@ int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int ski
m->hitPoints -= damage;
m->damageReceived = 0x8000 | damage;
m->flags |= 0x10;
- m->hitOffsX = _rnd.getRandomNumberRng(1, 24);
+ m->hitOffsX = rollDice(1, 24);
m->hitOffsX -= 12;
- m->hitOffsY = _rnd.getRandomNumberRng(1, 24);
+ m->hitOffsY = rollDice(1, 24);
m->hitOffsY -= 12;
m->hitPoints = CLIP<int16>(m->hitPoints, 0, m->properties->hitPoints);
@@ -3436,7 +3445,7 @@ void LoLEngine::checkForPartyDeath() {
}
void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, int16 damage) {
- if (_rnd.getRandomNumberRng(1, 100) > monster->properties->attackSkillChance)
+ if (rollDice(1, 100) > monster->properties->attackSkillChance)
return;
int t = 0;
@@ -3506,7 +3515,7 @@ void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, in
}
void LoLEngine::applyMonsterDefenseSkill(MonsterInPlay *monster, int16 attacker, int flags, int skill, int damage) {
- if (_rnd.getRandomNumberRng(1, 100) > monster->properties->defenseSkillChance)
+ if (rollDice(1, 100) > monster->properties->defenseSkillChance)
return;
int itm = 0;
@@ -3593,7 +3602,7 @@ int LoLEngine::paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFl
if (!(_characters[charNum].flags & 1) || (_characters[charNum].flags & immunityFlags))
return 0;
- if ((int)_rnd.getRandomNumberRng(1, 100) > hitChance)
+ if (rollDice(1, 100) > hitChance)
return 0;
int r = 0;
@@ -3711,7 +3720,7 @@ void LoLEngine::launchMagicViper() {
_screen->copyPage(12, 0);
_screen->copyPage(12, 2);
- int t = _rnd.getRandomNumberRng(1, 4);
+ int t = rollDice(1, 4);
for (int i = 0; i < 4; i++) {
if (!(_characters[i].flags & 1)) {
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 12000c31fa..f4ac597b5c 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -642,6 +642,7 @@ private:
int olol_setWallType(EMCState *script);
int olol_getWallType(EMCState *script);
int olol_drawScene(EMCState *script);
+ int olol_rollDice(EMCState *script);
int olol_moveParty(EMCState *script);
int olol_delay(EMCState *script);
int olol_setGameFlag(EMCState *script);
@@ -1313,6 +1314,7 @@ private:
// misc
void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false);
+ int rollDice(int times, int pips);
uint8 _compassBroken;
uint8 _drainMagic;
@@ -1320,8 +1322,7 @@ private:
uint8 *_pageBuffer1;
uint8 *_pageBuffer2;
- uint32 _rndSpecial;
-
+
// spells
typedef Common::Functor1Mem<ActiveSpell*, int, LoLEngine> SpellProc;
Common::Array<const SpellProc*> _spellProcs;
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index ecd6bbe450..83230d6e3b 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -126,7 +126,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
}
}
- return (in->ioFailed() ? kRSHEIoError : kRSHENoError);
+ return ((in->err() || in->eos()) ? kRSHEIoError : kRSHENoError);
}
Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filename, SaveHeader &header) {
@@ -168,7 +168,7 @@ Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filena
delete in;
return 0;
} else if ((header.flags & GF_FMTOWNS) && !(_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)) {
- warning("Can not load FM-Towns/PC98 savefile for this (non FM-Towns/PC98) gameversion");
+ warning("Can not load FM-TOWNS/PC98 savefile for this (non FM-TOWNS/PC98) gameversion");
delete in;
return 0;
}
diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp
index c481794e53..c59f2bebf6 100644
--- a/engines/kyra/saveload_lok.cpp
+++ b/engines/kyra/saveload_lok.cpp
@@ -167,7 +167,6 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) {
}
}
- _screen->_disableScreen = true;
loadMainScreen(8);
if (queryGameFlag(0x2D)) {
@@ -185,19 +184,16 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) {
setHandItem(_itemInHand);
_animator->setBrandonAnimSeqSize(3, 48);
redrawInventory(0);
- _animator->_noDrawShapesFlag = 1;
+ _brandonPosX = brandonX;
+ _brandonPosY = brandonY;
enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
- _animator->_noDrawShapesFlag = 0;
- _currentCharacter->x1 = brandonX;
- _currentCharacter->y1 = brandonY;
_animator->animRefreshNPC(0);
_animator->restoreAllObjectBackgrounds();
_animator->preserveAnyChangedBackgrounds();
_animator->prepDrawAllObjects();
_animator->copyChangedObjectsForward(0);
_screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0);
- _screen->_disableScreen = false;
_screen->updateScreen();
setMousePos(brandonX, brandonY);
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 945495517f..32ee7a4d77 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -552,14 +552,14 @@ void LoLEngine::updateLampStatus() {
if (_lampEffect == -1) {
if (_screen->_fadeFlag == 0)
setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect);
- _lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength;
+ _lampStatusTimer = _system->getMillis() + (10 + rollDice(1, 30)) * _tickLength;
} else {
if ((_lampEffect & 0xfe) == (newLampEffect & 0xfe)) {
if (_system->getMillis() <= _lampStatusTimer) {
newLampEffect = _lampEffect;
} else {
newLampEffect = _lampEffect ^ 1;
- _lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength;
+ _lampStatusTimer = _system->getMillis() + (10 + rollDice(1, 30)) * _tickLength;
}
} else {
if (_screen->_fadeFlag == 0)
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index 9ffaf5515d..3def71a076 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -73,7 +73,7 @@ void KyraEngine_v2::runSceneScript6() {
_sceneScriptState.regs[0] = _mainCharacter.sceneId;
_sceneScriptState.regs[1] = _mouseX;
_sceneScriptState.regs[2] = _mouseY;
- _sceneScriptState.regs[3] = _itemInHand;
+ _sceneScriptState.regs[4] = _itemInHand;
_emc->start(&_sceneScriptState, 6);
while (_emc->isValid(&_sceneScriptState))
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index fa54bffa98..6c2c48cb02 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -26,7 +26,10 @@
#include "common/endian.h"
#include "common/system.h"
+
#include "graphics/cursorman.h"
+#include "graphics/sjis.h"
+
#include "kyra/screen.h"
#include "kyra/kyra_v1.h"
#include "kyra/resource.h"
@@ -43,6 +46,8 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system)
_drawShapeVar3 = 1;
_drawShapeVar4 = 0;
_drawShapeVar5 = 0;
+
+ _sjisFont = 0;
}
Screen::~Screen() {
@@ -56,8 +61,7 @@ Screen::~Screen() {
_fonts[f].fontData = NULL;
}
- delete[] _sjisFontData;
- delete[] _sjisTempPage;
+ delete _sjisFont;
delete _screenPalette;
delete _internFadePalette;
delete[] _decodeShapeBuffer;
@@ -70,7 +74,6 @@ Screen::~Screen() {
}
bool Screen::init() {
- _disableScreen = false;
_debugEnabled = false;
memset(_sjisOverlayPtrs, 0, sizeof(_sjisOverlayPtrs));
@@ -78,8 +81,6 @@ bool Screen::init() {
_useSJIS = false;
_use16ColorMode = _vm->gameFlags().use16ColorMode;
- _sjisTempPage = _sjisFontData = 0;
-
if (_vm->gameFlags().useHiResOverlay) {
_useOverlays = true;
_useSJIS = (_vm->gameFlags().lang == Common::JA_JPN);
@@ -94,14 +95,17 @@ bool Screen::init() {
}
if (_useSJIS) {
- if (!_sjisFontData) {
- // we use the FM-Towns font rom for PC-98, too, until we feel
+ if (!_sjisFont) {
+ // we use the FM-TOWNS font rom for PC-98, too, until we feel
// like adding support for the PC-98 font
//if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
- // FM-Towns
- _sjisFontData = _vm->resource()->fileData("FMT_FNT.ROM", 0);
- if (!_sjisFontData)
- error("missing font rom ('FMT_FNT.ROM') required for this version");
+ // FM-TOWNS
+ Common::SeekableReadStream *rom = _vm->resource()->createReadStream("FMT_FNT.ROM");
+ Graphics::FontTowns *townsFont = new Graphics::FontTowns();
+ if (!rom || !townsFont || !townsFont->loadFromStream(*rom))
+ error("Could not load font rom ('FMT_FNT.ROM') required for this version");
+ _sjisFont = townsFont;
+ delete rom;
/*} else {
// PC-98
_sjisFontData = _vm->resource()->fileData("FONT.ROM", 0);
@@ -109,16 +113,12 @@ bool Screen::init() {
error("missing font rom ('FONT.ROM') required for this version");
}*/
}
-
- if (!_sjisTempPage) {
- _sjisTempPage = new uint8[420];
- assert(_sjisTempPage);
- _sjisTempPage2 = _sjisTempPage + 60;
- _sjisSourceChar = _sjisTempPage + 384;
- }
+
+ _sjisFont->enableOutline(!_use16ColorMode);
}
}
+
_curPage = 0;
uint8 *pagePtr = new uint8[SCREEN_PAGE_SIZE * 8];
for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2)
@@ -218,9 +218,6 @@ void Screen::setResolution() {
}
void Screen::updateScreen() {
- if (_disableScreen)
- return;
-
if (_useOverlays)
updateDirtyRectsOvl();
else
@@ -657,7 +654,7 @@ void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
}
addDirtyRect(0, y, SCREEN_W, h);
// This would remove the text in the end sequence of
- // the (Kyrandia 1) FM-Towns version.
+ // the (Kyrandia 1) FM-TOWNS version.
// Since this method is just used for the Seqplayer
// this shouldn't be a problem anywhere else, so it's
// safe to disable the call here.
@@ -1027,8 +1024,8 @@ int Screen::getCharWidth(uint16 c) const {
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return 0;
- if (c & 0xFF00)
- return SJIS_CHARSIZE >> 1;
+ if ((c & 0xFF00) && _sjisFont)
+ return _sjisFont->getFontWidth() >> 1;
if (_fonts[_currentFont].lastGlyph < c)
return 0;
@@ -1115,7 +1112,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
c = READ_LE_UINT16(str - 1);
++str;
charWidth = getCharWidth(c);
- charHeight = SJIS_CHARSIZE >> 1;
+ charHeight = _sjisFont->getFontHeight() >> 1;
drawCharSJIS(c, x, y);
}
@@ -1529,6 +1526,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
_dsTmpWidth = shapeWidth;
int cnt = _dsOffscreenLeft;
int scaleState = (this->*_dsProcessMargin)(d, src, cnt);
+
if (_dsTmpWidth) {
cnt += shpWidthScaled1;
if (cnt > 0) {
@@ -1584,7 +1582,6 @@ int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt)
while (cnt > 0) {
--cnt;
-
if (*src++)
continue;
@@ -1611,7 +1608,6 @@ int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cn
while (cnt > 0) {
--cnt;
-
if (*src++)
continue;
@@ -1640,10 +1636,11 @@ int Screen::drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
return 0;
do {
+ --cnt;
if (*src++)
continue;
cnt = cnt + 1 - (*src++);
- } while (--cnt > 0);
+ } while (cnt > 0);
return 0;
}
@@ -1656,16 +1653,17 @@ int Screen::drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt)
return 0;
do {
+ --cnt;
if (*src++)
continue;
found = true;
cnt = cnt + 1 - (*src++);
- } while (--cnt > 0);
+ } while (cnt > 0);
return found ? 0 : _dsOffscreenScaleVal1;
}
-void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
+void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) {
do {
uint8 c = *src++;
if (c) {
@@ -1680,7 +1678,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i
} while (cnt > 0);
}
-void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
+void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) {
do {
uint8 c = *src++;
if (c) {
@@ -1695,7 +1693,7 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src,
} while (cnt > 0);
}
-void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
+void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) {
int c = 0;
do {
@@ -1723,7 +1721,7 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int
cnt = -1;
}
-void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
+void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) {
int c = 0;
do {
@@ -3006,93 +3004,6 @@ void Screen::copyOverlayRegion(int x, int y, int x2, int y2, int w, int h, int s
}
}
-// SJIS rendering
-
-namespace {
-int SJIStoFMTChunk(int f, int s) { // copied from scumm\charset.cpp
- enum {
- KANA = 0,
- KANJI = 1,
- EKANJI = 2
- };
- int base = s - ((s + 1) % 32);
- int c = 0, p = 0, chunk_f = 0, chunk = 0, cr = 0, kanjiType = KANA;
-
- if (f >= 0x81 && f <= 0x84) kanjiType = KANA;
- if (f >= 0x88 && f <= 0x9f) kanjiType = KANJI;
- if (f >= 0xe0 && f <= 0xea) kanjiType = EKANJI;
-
- if ((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) {
- c = 48; //correction
- p = -8; //correction
- }
-
- if (kanjiType == KANA) {//Kana
- chunk_f = (f - 0x81) * 2;
- } else if (kanjiType == KANJI) {//Standard Kanji
- p += f - 0x88;
- chunk_f = c + 2 * p;
- } else if (kanjiType == EKANJI) {//Enhanced Kanji
- p += f - 0xe0;
- chunk_f = c + 2 * p;
- }
-
- // Base corrections
- if (base == 0x7f && s == 0x7f)
- base -= 0x20;
- if (base == 0x9f && s == 0xbe)
- base += 0x20;
- if (base == 0xbf && s == 0xde)
- base += 0x20;
- //if (base == 0x7f && s == 0x9e)
- // base += 0x20;
-
- switch (base) {
- case 0x3f:
- cr = 0; //3f
- if (kanjiType == KANA) chunk = 1;
- else if (kanjiType == KANJI) chunk = 31;
- else if (kanjiType == EKANJI) chunk = 111;
- break;
- case 0x5f:
- cr = 0; //5f
- if (kanjiType == KANA) chunk = 17;
- else if (kanjiType == KANJI) chunk = 47;
- else if (kanjiType == EKANJI) chunk = 127;
- break;
- case 0x7f:
- cr = -1; //80
- if (kanjiType == KANA) chunk = 9;
- else if (kanjiType == KANJI) chunk = 63;
- else if (kanjiType == EKANJI) chunk = 143;
- break;
- case 0x9f:
- cr = 1; //9e
- if (kanjiType == KANA) chunk = 2;
- else if (kanjiType == KANJI) chunk = 32;
- else if (kanjiType == EKANJI) chunk = 112;
- break;
- case 0xbf:
- cr = 1; //be
- if (kanjiType == KANA) chunk = 18;
- else if (kanjiType == KANJI) chunk = 48;
- else if (kanjiType == EKANJI) chunk = 128;
- break;
- case 0xdf:
- cr = 1; //de
- if (kanjiType == KANA) chunk = 10;
- else if (kanjiType == KANJI) chunk = 64;
- else if (kanjiType == EKANJI) chunk = 144;
- break;
- default:
- debug(4, "Invalid Char! f %x s %x base %x c %d p %d", f, s, base, c, p);
- }
-
- debug(6, "Kanji: %c%c f 0x%x s 0x%x base 0x%x c %d p %d chunk %d cr %d index %d", f, s, f, s, base, c, p, chunk, cr, ((chunk_f + chunk) * 32 + (s - base)) + cr);
- return ((chunk_f + chunk) * 32 + (s - base)) + cr;
-}
-} // end of anonymous namespace
-
void Screen::drawCharSJIS(uint16 c, int x, int y) {
int color1, color2;
@@ -3104,14 +3015,13 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) {
} else {
color1 = _textColorsMap[1];
color2 = _textColorsMap[0];
- }
- memset(_sjisTempPage2, _sjisInvisibleColor, 324);
- memset(_sjisSourceChar, 0, 36);
- memcpy(_sjisSourceChar, _sjisFontData + 0x20 * SJIStoFMTChunk(c & 0xff, c >> 8), 0x20);
+ if (color2 == _sjisInvisibleColor)
+ _sjisFont->enableOutline(false);
+ }
if (_curPage == 0 || _curPage == 1)
- addDirtyRect(x, y, SJIS_CHARSIZE >> 1, SJIS_CHARSIZE >> 1);
+ addDirtyRect(x, y, _sjisFont->getFontWidth() >> 1, _sjisFont->getFontHeight() >> 1);
x <<= 1;
y <<= 1;
@@ -3123,154 +3033,10 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) {
}
destPage += y * 640 + x;
- uint8 *src = 0, *dst = 0;
- if (color2 != _sjisInvisibleColor) {
- // draw color2 shadow
- src = _sjisSourceChar;
- dst = _sjisTempPage2;
-
- for (int i = 0; i < SJIS_CHARSIZE; i++) {
- *((uint16*)dst) = READ_LE_UINT16(src);
- dst += 2; src += 2;
- *dst++ = 0;
- }
+ _sjisFont->drawChar(destPage, c, 640, 1, color1, color2);
- src = _sjisTempPage2;
- dst = _sjisTempPage;
- memset(dst, 0, 60);
- for (int i = 0; i < 48; i++)
- *dst++ |= *src++;
-
- src = _sjisTempPage2;
- dst = _sjisTempPage + 3;
- for (int i = 0; i < 48; i++)
- *dst++ |= *src++;
-
- src = _sjisTempPage2;
- dst = _sjisTempPage + 6;
- for (int i = 0; i < 48; i++)
- *dst++ |= *src++;
-
- for (int i = 0; i < 2; i++) {
- src = _sjisTempPage;
- for (int ii = 0; ii < SJIS_CHARSIZE; ii++) {
- uint8 cy2 = 0;
- uint8 cy1 = 0;
- for (int iii = 0; iii < 3; iii++) {
- cy1 = *src & 1;
- *src |= ((*src >> 1) | (cy2 << 7));
- cy2 = cy1;
- src++;
- }
- }
- }
-
- src = _sjisTempPage2;
- for (int i = 0; i < SJIS_CHARSIZE; i++) {
- uint8 cy2 = 0;
- uint8 cy1 = 0;
- for (int ii = 0; ii < 3; ii++) {
- cy1 = *src & 1;
- *src = ((*src >> 1) | (cy2 << 7));
- cy2 = cy1;
- src++;
- }
- }
-
- src = _sjisTempPage2;
- dst = _sjisTempPage + 3;
- for (int i = 0; i < 48; i++)
- *dst++ ^= *src++;
-
- memset(_sjisTempPage2, _sjisInvisibleColor, 324);
- src = _sjisTempPage;
- dst = _sjisTempPage2;
-
- uint8 height = SJIS_CHARSIZE * 3;
- uint8 width = SJIS_CHARSIZE;
- if (color2 & 0xff00) {
- height -= 3;
- width--;
- dst += 0x13;
- }
-
- for (int i = 0; i < height; i++) {
- uint8 rs = *src++;
- for (int ii = 0; ii < 8; ii++) {
- if (rs & 0x80)
- *dst = (color2 & 0xff);
- rs <<= 1;
- dst++;
-
- if (!--width) {
- width = SJIS_CHARSIZE;
- if (color2 & 0xff00) {
- width--;
- dst++;
- }
- break;
- }
- }
- }
- }
-
- // draw color1 char
- src = _sjisSourceChar;
- dst = _sjisTempPage;
-
- for (int i = 0; i < SJIS_CHARSIZE; i++) {
- *(uint16*)dst = READ_LE_UINT16(src);
- dst += 2; src += 2;
- *dst++ = 0;
- }
-
- src = _sjisTempPage;
- dst = _sjisTempPage2;
- if (color2 != _sjisInvisibleColor)
- color1 = (color1 & 0xff) | 0x100;
-
- uint8 height = SJIS_CHARSIZE * 3;
- uint8 width = SJIS_CHARSIZE;
- if (color1 & 0xff00) {
- height -= 3;
- width--;
- dst += 0x13;
- }
-
- for (int i = 0; i < height; i++) {
- uint8 rs = *src++;
- for (int ii = 0; ii < 8; ii++) {
- if (rs & 0x80)
- *dst = (color1 & 0xff);
- rs <<= 1;
- dst++;
-
- if (!--width) {
- width = SJIS_CHARSIZE;
- if (color1 & 0xff00) {
- width--;
- dst++;
- }
- break;
- }
- }
- }
-
- // copy char to surface
- src = _sjisTempPage2;
- dst = destPage;
- int pitch = 640 - SJIS_CHARSIZE;
-
- for (int i = 0; i < SJIS_CHARSIZE; i++) {
- for (int ii = 0; ii < SJIS_CHARSIZE; ii++) {
- if (*src != _sjisInvisibleColor)
- *dst = *src;
- src++;
- dst++;
- }
- dst += pitch;
- }
+ _sjisFont->enableOutline(!_use16ColorMode);
}
#pragma mark -
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 390d058bb8..d8380d104d 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -35,6 +35,10 @@
class OSystem;
+namespace Graphics {
+class FontSJIS;
+} // end of namespace Graphics
+
namespace Kyra {
typedef Common::Functor0<void> UpdateFunctor;
@@ -331,7 +335,6 @@ public:
uint8 *_shapePages[2];
int _maskMinY, _maskMaxY;
FontId _currentFont;
- bool _disableScreen;
// decoding functions
static void decodeFrame3(const uint8 *src, uint8 *dst, uint32 size);
@@ -360,11 +363,6 @@ protected:
void drawCharANSI(uint8 c, int x, int y);
void drawCharSJIS(uint16 c, int x, int y);
- enum {
- SJIS_CHARSIZE = 18,
- SJIS_CHARS = 8192
- };
-
int16 encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size);
template<bool noXor> static void wrapped_decodeFrameDelta(uint8 *dst, const uint8 *src);
@@ -377,10 +375,7 @@ protected:
bool _useSJIS;
bool _use16ColorMode;
- uint8 *_sjisFontData;
- uint8 *_sjisTempPage;
- uint8 *_sjisTempPage2;
- uint8 *_sjisSourceChar;
+ Graphics::FontSJIS *_sjisFont;
uint8 _sjisInvisibleColor;
Palette *_screenPalette;
@@ -421,10 +416,10 @@ protected:
int drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
int drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);
int drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
- void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
- void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
- void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
- void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+ void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
+ void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
+ void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
+ void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
void drawShapePlotType0(uint8 *dst, uint8 cmd);
void drawShapePlotType1(uint8 *dst, uint8 cmd);
@@ -446,7 +441,7 @@ protected:
void drawShapePlotType52(uint8 *dst, uint8 cmd);
typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt);
- typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+ typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd);
DsMarginSkipFunc _dsProcessMargin;
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index b9bf9961c5..ce8a1bdaa4 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -44,8 +44,6 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system),
_fadeFlag = 2;
_curDimIndex = 0;
-
- _internDimX = _internDimY = _internDimW = _internDimH = _internDimDstX = _internBlockWidth = _internDimDstY = _internBlockHeight = _internDimU5 = _internDimU6 = _internBlockWidth2 = _internDimU8 = 0;
}
Screen_LoL::~Screen_LoL() {
@@ -588,44 +586,25 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
va_end(args);
}
- // _internDimH: h0
-// _internDimW: w0
-// _internDimDstX: x1
-// _internDimDstY: y1
-// _internBlockWidth: w1
-// _internBlockHeight: h1
-// _internDimU5: x2
-// _internDimU6: y2
-// _internBlockWidth2: w2
-
- _internDimX = _internDimY = 0;
- _internDimW = w1;
- _internDimH = h1;
- calcBoundariesIntern(x1, y1, w3, h3);
- if (_internBlockWidth == -1)
+ int na = 0, nb = 0, nc = w3;
+ if (!calcBounds(w1, h1, x1, y1, w3, h3, na, nb, nc))
return;
- int iu5_1 = _internDimU5;
- int iu6_1 = _internDimU6;
- int ibw_1 = _internBlockWidth;
- int ibh_1 = _internBlockHeight;
- int dx_1 = _internDimDstX;
- int dy_1 = _internDimDstY;
-
- _internDimX = _internDimY = 0;
- _internDimW = w2;
- _internDimH = h2;
+ int iu5_1 = na;
+ int iu6_1 = nb;
+ int ibw_1 = w3;
+ int dx_1 = x1;
+ int dy_1 = y1;
- calcBoundariesIntern(x2, y2, ibw_1, ibh_1);
- if (_internBlockWidth == -1)
+ if (!calcBounds(w2, h2, x2, y2, w3, h3, na, nb, nc))
return;
- int iu5_2 = _internDimU5;
- int iu6_2 = _internDimU6;
- int ibw_2 = _internBlockWidth;
- int ibh_2 = _internBlockHeight;
- int dx_2 = _internDimDstX;
- int dy_2 = _internDimDstY;
+ int iu5_2 = na;
+ int iu6_2 = nb;
+ int ibw_2 = w3;
+ int ibh_2 = h3;
+ int dx_2 = x2;
+ int dy_2 = y2;
uint8 *src = getPagePtr(page1) + (dy_1 + iu6_2) * w1;
uint8 *dst = getPagePtr(page2) + (dy_2 + iu6_1) * w2;
@@ -670,7 +649,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
}
if (!page2)
- addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
+ addDirtyRect(x2, y2, w2, h2);
}
void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl) {
@@ -678,23 +657,23 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2,
return;
const ScreenDim *cdim = getScreenDim(dim);
- _internDimX = cdim->sx << 3;
- _internDimY = cdim->sy;
- _internDimW = cdim->w << 3;
- _internDimH = cdim->h;
+ int ix = cdim->sx << 3;
+ int iy = cdim->sy;
+ int iw = cdim->w << 3;
+ int ih = cdim->h;
- calcBoundariesIntern(x2, y2, w, h);
- if (_internBlockWidth == -1)
+ int na = 0, nb = 0, nc = w;
+ if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc))
return;
uint8 *src = getPagePtr(page1) + y1 * 320 + x1;
- uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320;
+ uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320;
- for (int i = 0; i < _internBlockHeight; i++) {
- uint8 *s = src + _internDimU5;
- uint8 *d = dst + (_internDimDstX + _internDimX);
+ for (int i = 0; i < h; i++) {
+ uint8 *s = src + na;
+ uint8 *d = dst + (x2 + ix);
- for (int ii = 0; ii < _internBlockWidth; ii++) {
+ for (int ii = 0; ii < w; ii++) {
uint8 p = ovl[*s++];
if (p)
*d = p;
@@ -706,7 +685,7 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2,
}
if (!page2)
- addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
+ addDirtyRect(x2 + ix, y2 + iy, w, h);
}
void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl) {
@@ -714,26 +693,26 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x
return;
const ScreenDim *cdim = getScreenDim(dim);
- _internDimX = cdim->sx << 3;
- _internDimY = cdim->sy;
- _internDimW = cdim->w << 3;
- _internDimH = cdim->h;
+ int ix = cdim->sx << 3;
+ int iy = cdim->sy;
+ int iw = cdim->w << 3;
+ int ih = cdim->h;
- calcBoundariesIntern(x2, y2, w, h);
- if (_internBlockWidth == -1)
+ int na = 0, nb = 0, nc = w;
+ if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc))
return;
uint8 *src = getPagePtr(page1) + y1 * 320 + x1;
- uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320;
+ uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320;
- for (int i = 0; i < _internBlockHeight; i++) {
- uint8 *s = src + _internDimU5;
- uint8 *d = dst + (_internDimDstX + _internDimX);
+ for (int i = 0; i < h; i++) {
+ uint8 *s = src + na;
+ uint8 *d = dst + (x2 + ix);
if (flag)
d += (i >> 1);
- for (int ii = 0; ii < _internBlockWidth; ii++) {
+ for (int ii = 0; ii < w; ii++) {
if (*s++)
*d = ovl[*d];
d++;
@@ -744,7 +723,7 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x
}
if (!page2)
- addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
+ addDirtyRect(x2 + ix, y2 + iy, w, h);
}
void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const uint8 *ovl) {
@@ -778,59 +757,6 @@ void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const u
}
}
-void Screen_LoL::calcBoundariesIntern(int dstX, int dstY, int width, int height) {
- _internBlockWidth = _internBlockWidth2 = width;
- _internBlockHeight = height;
- _internDimDstX = dstX;
- _internDimDstY = dstY;
-
- _internDimU5 = _internDimU6 = _internDimU8 = 0;
-
- int t = _internDimDstX + _internBlockWidth;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internDimDstX) {
- _internDimU5 = _internBlockWidth - t;
- _internBlockWidth = t;
- _internDimDstX = 0;
- }
-
- t = _internDimW - _internDimDstX;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internBlockWidth)
- _internBlockWidth = t;
-
- _internBlockWidth2 -= _internBlockWidth;
-
- t = _internDimDstY + _internBlockHeight;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internDimDstY) {
- _internDimU6 = _internBlockHeight - t;
- _internBlockHeight = t;
- _internDimDstY = 0;
- }
-
- t = _internDimH - _internDimDstY;
- if (t <= 0) {
- _internBlockWidth = _internBlockHeight = -1;
- return;
- }
-
- if (t <= _internBlockHeight)
- _internBlockHeight = t;
-}
-
void Screen_LoL::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
Screen::fadeToBlack(delay, upFunc);
_fadeFlag = 2;
@@ -986,7 +912,7 @@ void Screen_LoL::mergeOverlay(int x, int y, int w, int h) {
void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) {
while (h--) {
for (int i = 0; i < w; ++i) {
- *data = _paletteConvTable[*data];
+ *data = (*data >> 4) & (*data & 0x0F);
++data;
}
@@ -1001,7 +927,7 @@ void Screen_LoL::postProcessCursor(uint8 *data, int w, int h, int pitch) {
while (h--) {
for (int i = 0; i < w; ++i) {
if (*data != _cursorColorKey)
- *data = _paletteConvTable[*data];
+ *data = (*data >> 4) & (*data & 0x0F);
++data;
}
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index db355977f8..4980a89694 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -46,8 +46,8 @@ public:
int curDimIndex() { return _curDimIndex; }
void modifyScreenDim(int dim, int x, int y, int w, int h);
- void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...);
- void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...);
+ void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8);
+ void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) GCC_PRINTF(2, 9);
void drawGridBox(int x, int y, int w, int h, int col);
void fadeClearSceneWindow(int delay);
@@ -109,25 +109,8 @@ private:
uint8 *_levelOverlays[8];
- static const uint8 _paletteConvTable[256];
void mergeOverlay(int x, int y, int w, int h);
void postProcessCursor(uint8 *data, int width, int height, int pitch);
-
- // magic atlas
- void calcBoundariesIntern(int dstX, int dstY, int c, int d);
-
- int _internDimX;
- int _internDimY;
- int _internDimW;
- int _internDimH;
- int _internDimDstX;
- int _internBlockWidth;
- int _internDimDstY;
- int _internBlockHeight;
- int _internDimU5;
- int _internDimU6;
- int _internBlockWidth2;
- int _internDimU8;
};
} // end of namespace Kyra
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index 0473f03591..726c013b5a 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -125,7 +125,7 @@ bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Commo
error("No DATA chunk found in file: '%s'", filename);
if (stream->err())
- error("Read error while parsing file '%s", filename);
+ error("Read error while parsing file '%s'", filename);
delete stream;
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index a606419722..e4b77f6a07 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -135,6 +135,11 @@ int LoLEngine::olol_drawScene(EMCState *script) {
return 1;
}
+int LoLEngine::olol_rollDice(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_rollDice(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ return rollDice(stackPos(0), stackPos(1));
+}
+
int LoLEngine::olol_moveParty(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_moveParty(%p) (%d)", (const void *)script, stackPos(0));
int mode = stackPos(0);
@@ -831,10 +836,10 @@ int LoLEngine::olol_initMonster(EMCState *script) {
l->hitPoints = (l->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8;
if (_currentLevel == 12 && l->type == 2)
- l->hitPoints = (l->hitPoints * (_rnd.getRandomNumberRng(1, 128) + 192)) >> 8;
+ l->hitPoints = (l->hitPoints * (rollDice(1, 128) + 192)) >> 8;
l->numDistAttacks = l->properties->numDistAttacks;
- l->distAttackTick = _rnd.getRandomNumberRng(1, calcMonsterSkillLevel(l->id | 0x8000, 8)) - 1;
+ l->distAttackTick = rollDice(1, calcMonsterSkillLevel(l->id | 0x8000, 8)) - 1;
l->flyingHeight = 2;
l->flags = stackPos(5);
l->assignedItems = 0;
@@ -1366,18 +1371,18 @@ int LoLEngine::olol_characterSkillTest(EMCState *script){
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_characterSkillTest(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
int skill = stackPos(0);
int n = countActiveCharacters();
- uint m = 0;
+ int m = 0;
int c = 0;
for (int i = 0; i < n ; i++) {
- uint v = _characters[i].skillModifiers[skill] + _characters[i].skillLevels[skill] + 25;
+ int v = _characters[i].skillModifiers[skill] + _characters[i].skillLevels[skill] + 25;
if (v > m) {
m = v;
c = i;
}
}
- return (_rnd.getRandomNumberRng(1, 100) > m) ? -1 : c;
+ return (rollDice(1, 100) > m) ? -1 : c;
}
int LoLEngine::olol_countAllMonsters(EMCState *script){
@@ -1440,7 +1445,7 @@ int LoLEngine::olol_calcInflictableDamage(EMCState *script) {
int LoLEngine::olol_getInflictedDamage(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getInflictedDamage(%p) (%d)", (const void *)script, stackPos(0));
int mx = stackPos(0);
- return mx ? _rnd.getRandomNumberRng(2, mx) : 0;
+ return rollDice(2, mx);
}
int LoLEngine::olol_checkForCertainPartyMember(EMCState *script) {
@@ -2340,8 +2345,8 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) {
int h2 = (h1 * factor) / 100;
anim->wsa->displayFrame(frame, 2, x1, y1, anim->wsaCopyParams & 0xF0FF, 0, 0);
- _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo ? 0 : 8, 0);
- if (!_flags.isDemo)
+ _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo && _flags.platform != Common::kPlatformPC98 ? 0 : 8, 0);
+ if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98)
_screen->checkedPageUpdate(8, 4);
_screen->updateScreen();
@@ -2617,7 +2622,7 @@ void LoLEngine::setupOpcodeTable() {
Opcode(olol_setWallType);
Opcode(olol_getWallType);
Opcode(olol_drawScene);
- Opcode(o1_getRand);
+ Opcode(olol_rollDice);
// 0x04
Opcode(olol_moveParty);
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 424a62aaf8..731b8d206f 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -98,7 +98,10 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys
_textDisplayed = false;
_textAreaBuffer = new uint8[320*40];
assert(_textAreaBuffer);
- _drawPage2 = (_vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL) ? 0 : 8;
+ if ((_vm->gameFlags().platform == Common::kPlatformPC98 || _vm->gameFlags().isDemo) && _vm->gameFlags().gameID == GI_LOL)
+ _drawPage2 = 0;
+ else
+ _drawPage2 = 8;
_palDelayInc = _palDiff = _palDelayAcc = 0;
_abortFlag = 0;
@@ -169,7 +172,7 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpc
error("No AVTL chunk found in file: '%s'", filename);
if (stream->err())
- error("Read error while parsing file '%s", filename);
+ error("Read error while parsing file '%s'", filename);
delete stream;
@@ -461,7 +464,10 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
anim->wsaCopyParams = wsaFlags;
const bool isLoLDemo = _vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL;
- _drawPage2 = (isLoLDemo || _currentTim->isLoLOutro) ? 0 : 8;
+ if (isLoLDemo || _vm->gameFlags().platform == Common::kPlatformPC98 || _currentTim->isLoLOutro)
+ _drawPage2 = 0;
+ else
+ _drawPage2 = 8;
uint16 wsaOpenFlags = 0;
if (isLoLDemo) {
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index 90b2fdd580..81ab237e0f 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -770,12 +770,12 @@ int KyraEngine_HoF::seq_introDragon(WSAMovie_v2 *wsaObj, int x, int y, int frm)
}
int KyraEngine_HoF::seq_introDarm(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- //NULLSUB (at least in fm-towns version)
+ //NULLSUB (at least in FM-TOWNS version)
return frm;
}
int KyraEngine_HoF::seq_introLibrary2(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- //NULLSUB (at least in fm-towns version)
+ //NULLSUB (at least in FM-TOWNS version)
return frm;
}
@@ -788,7 +788,7 @@ int KyraEngine_HoF::seq_introMarco(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
}
int KyraEngine_HoF::seq_introHand1a(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- //NULLSUB (at least in fm-towns version)
+ //NULLSUB (at least in FM-TOWNS version)
return frm;
}
@@ -805,12 +805,12 @@ int KyraEngine_HoF::seq_introHand1c(WSAMovie_v2 *wsaObj, int x, int y, int frm)
}
int KyraEngine_HoF::seq_introHand2(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- //NULLSUB (at least in fm-towns version)
+ //NULLSUB (at least in FM-TOWNS version)
return frm;
}
int KyraEngine_HoF::seq_introHand3(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- //NULLSUB (at least in fm-towns version)
+ //NULLSUB (at least in FM-TOWNS version)
return frm;
}
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index d483409090..0279831c9d 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -1049,7 +1049,7 @@ void KyraEngine_LoK::seq_playCredits() {
_screen->setTextColorMap(colorMap);
_screen->_charWidth = -1;
- // we only need this for the fm-towns version
+ // we only need this for the FM-TOWNS version
if (_flags.platform == Common::kPlatformFMTowns && _configMusic == 1)
snd_playWanderScoreViaMap(53, 1);
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index beea129f66..5826b2b09e 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -224,7 +224,7 @@ void LoLEngine::showIntro() {
while (!_tim->finished() && !shouldQuit() && !skipFlag()) {
updateInput();
_tim->exec(intro, false);
- if (!_flags.isDemo)
+ if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98)
_screen->checkedPageUpdate(8, 4);
if (_tim->_palDiff) {
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index f393ae15ba..263cd586f7 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -8,32 +8,16 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * LGPL License
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
* $URL$
* $Id$
*
diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h
new file mode 100644
index 0000000000..f384113af7
--- /dev/null
+++ b/engines/kyra/sound_adlib.h
@@ -0,0 +1,113 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * LGPL License
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef KYRA_SOUND_ADLIB_H
+#define KYRA_SOUND_ADLIB_H
+
+#include "kyra/sound.h"
+
+#include "common/mutex.h"
+
+namespace Kyra {
+class AdlibDriver;
+
+/**
+ * AdLib implementation of the sound output device.
+ *
+ * It uses a special sound file format special to
+ * Dune II, Kyrandia 1 and 2. While Dune II and
+ * Kyrandia 1 are using exact the same format, the
+ * one of Kyrandia 2 slightly differs.
+ *
+ * See AdlibDriver for more information.
+ * @see AdlibDriver
+ */
+class SoundAdlibPC : public Sound {
+public:
+ SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer);
+ ~SoundAdlibPC();
+
+ kType getMusicType() const { return kAdlib; }
+
+ bool init();
+ void process();
+
+ void loadSoundFile(uint file);
+ void loadSoundFile(Common::String file);
+
+ void playTrack(uint8 track);
+ void haltTrack();
+ bool isPlaying();
+
+ void playSoundEffect(uint8 track);
+
+ void beginFadeOut();
+private:
+ void internalLoadFile(Common::String file);
+
+ void play(uint8 track);
+
+ void unk1();
+ void unk2();
+
+ AdlibDriver *_driver;
+
+ bool _v2;
+ uint8 _trackEntries[500];
+ uint8 *_soundDataPtr;
+ int _sfxPlayingSound;
+
+ Common::String _soundFileLoaded;
+
+ uint8 _sfxPriority;
+ uint8 _sfxFourthByteOfSong;
+
+ int _numSoundTriggers;
+ const int *_soundTriggers;
+
+ static const int _kyra1NumSoundTriggers;
+ static const int _kyra1SoundTriggers[];
+};
+
+} // end of namespace Kyra
+
+#endif
+
diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h
index a41ca2258c..792887ab35 100644
--- a/engines/kyra/sound_intern.h
+++ b/engines/kyra/sound_intern.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -27,6 +27,7 @@
#define KYRA_SOUND_INTERN_H
#include "kyra/sound.h"
+#include "kyra/sound_adlib.h"
#include "common/mutex.h"
@@ -40,66 +41,6 @@ class MaxTrax;
} // end of namespace Audio
namespace Kyra {
-class AdlibDriver;
-
-/**
- * AdLib implementation of the sound output device.
- *
- * It uses a special sound file format special to
- * Dune II, Kyrandia 1 and 2. While Dune II and
- * Kyrandia 1 are using exact the same format, the
- * one of Kyrandia 2 slightly differs.
- *
- * See AdlibDriver for more information.
- * @see AdlibDriver
- */
-class SoundAdlibPC : public Sound {
-public:
- SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer);
- ~SoundAdlibPC();
-
- kType getMusicType() const { return kAdlib; }
-
- bool init();
- void process();
-
- void loadSoundFile(uint file);
- void loadSoundFile(Common::String file);
-
- void playTrack(uint8 track);
- void haltTrack();
- bool isPlaying();
-
- void playSoundEffect(uint8 track);
-
- void beginFadeOut();
-private:
- void internalLoadFile(Common::String file);
-
- void play(uint8 track);
-
- void unk1();
- void unk2();
-
- AdlibDriver *_driver;
-
- bool _v2;
- uint8 _trackEntries[500];
- uint8 *_soundDataPtr;
- int _sfxPlayingSound;
-
- Common::String _soundFileLoaded;
-
- uint8 _sfxPriority;
- uint8 _sfxFourthByteOfSong;
-
- int _numSoundTriggers;
- const int *_soundTriggers;
-
- static const int _kyra1NumSoundTriggers;
- static const int _kyra1SoundTriggers[];
-};
-
class MidiOutput;
/**
diff --git a/engines/kyra/sound_pcspk.cpp b/engines/kyra/sound_pcspk.cpp
index 22c24bf56c..2afed22a80 100644
--- a/engines/kyra/sound_pcspk.cpp
+++ b/engines/kyra/sound_pcspk.cpp
@@ -1,25 +1,22 @@
-/*
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+/* ScummVM - Graphic Adventure Engine
*
- * LGPL License
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 8cee1dc5fc..f644feeb65 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -1071,7 +1071,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) {
monster->speedTick = 0;
if (monster->properties->flags & 0x40) {
- monster->hitPoints += _rnd.getRandomNumberRng(1, 8);
+ monster->hitPoints += rollDice(1, 8);
if (monster->hitPoints > monster->properties->hitPoints)
monster->hitPoints = monster->properties->hitPoints;
}
@@ -1264,7 +1264,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(MonsterInPlay *monster) {
int s = 0;
if (monster->flags & 0x10) {
- s = monster->properties->numDistWeapons ? _rnd.getRandomNumberRng(1, monster->properties->numDistWeapons) : 0;
+ s = monster->properties->numDistWeapons ? rollDice(1, monster->properties->numDistWeapons) : 0;
} else {
s = monster->curDistWeapon++;
if (monster->curDistWeapon >= monster->properties->numDistWeapons)
@@ -1344,7 +1344,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) {
if (hit) {
int mx = calcInflictableDamage(m, dst, hit);
- int dmg = mx ? _rnd.getRandomNumberRng(2, mx) : 0;
+ int dmg = rollDice(2, mx );
inflictDamage(dst, dmg, m, 0, 0);
applyMonsterAttackSkill(monster, dst, dmg);
}
@@ -1364,7 +1364,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) {
walkMonster(monster);
} else {
setMonsterDirection(monster, monster->destDirection);
- setMonsterMode(monster, (_rnd.getRandomNumberRng(1, 100) <= 50) ? 4 : 3);
+ setMonsterMode(monster, (rollDice(1, 100) <= 50) ? 4 : 3);
}
}
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index e8597c8326..86680a7b76 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -3159,42 +3159,6 @@ const ScreenDim Screen_LoL::_screenDimTable16C[] = {
const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C);
-// 256 -> 16 color conversion table
-const uint8 Screen_LoL::_paletteConvTable[256] = {
- 0x0, 0x1, 0x0, 0x3, 0x0, 0x5, 0x0, 0x7,
- 0x0, 0x9, 0x0, 0xB, 0x0, 0xD, 0x0, 0xF,
- 0x1, 0x1, 0x1, 0x3, 0x1, 0x5, 0x1, 0x7,
- 0x1, 0x9, 0x1, 0xB, 0x1, 0xD, 0x1, 0xF,
- 0x2, 0x1, 0x2, 0x3, 0x2, 0x5, 0x2, 0x7,
- 0x2, 0x9, 0x2, 0xB, 0x2, 0xD, 0x2, 0xF,
- 0x3, 0x1, 0x3, 0x3, 0x3, 0x5, 0x3, 0x7,
- 0x3, 0x9, 0x3, 0xB, 0x3, 0xD, 0x3, 0xF,
- 0x4, 0x1, 0x4, 0x3, 0x4, 0x5, 0x4, 0x7,
- 0x4, 0x9, 0x4, 0xB, 0x4, 0xD, 0x4, 0xF,
- 0x5, 0x1, 0x5, 0x3, 0x5, 0x5, 0x5, 0x7,
- 0x5, 0x9, 0x5, 0xB, 0x5, 0xD, 0x5, 0xF,
- 0x6, 0x1, 0x6, 0x3, 0x6, 0x5, 0x6, 0x7,
- 0x6, 0x9, 0x6, 0xB, 0x6, 0xD, 0x6, 0xF,
- 0x7, 0x1, 0x7, 0x3, 0x7, 0x5, 0x7, 0x7,
- 0x7, 0x9, 0x7, 0xB, 0x7, 0xD, 0x7, 0xF,
- 0x8, 0x1, 0x8, 0x3, 0x8, 0x5, 0x8, 0x7,
- 0x8, 0x9, 0x8, 0xB, 0x8, 0xD, 0x8, 0xF,
- 0x9, 0x1, 0x9, 0x3, 0x9, 0x5, 0x9, 0x7,
- 0x9, 0x9, 0x9, 0xB, 0x9, 0xD, 0x9, 0xF,
- 0xA, 0x1, 0xA, 0x3, 0xA, 0x5, 0xA, 0x7,
- 0xA, 0x9, 0xA, 0xB, 0xA, 0xD, 0xA, 0xF,
- 0xB, 0x1, 0xB, 0x3, 0xB, 0x5, 0xB, 0x7,
- 0xB, 0x9, 0xB, 0xB, 0xB, 0xD, 0xB, 0xF,
- 0xC, 0x1, 0xC, 0x3, 0xC, 0x5, 0xC, 0x7,
- 0xC, 0x9, 0xC, 0xB, 0xC, 0xD, 0xC, 0xF,
- 0xD, 0x1, 0xD, 0x3, 0xD, 0x5, 0xD, 0x7,
- 0xD, 0x9, 0xD, 0xB, 0xD, 0xD, 0xD, 0xF,
- 0xE, 0x1, 0xE, 0x3, 0xE, 0x5, 0xE, 0x7,
- 0xE, 0x9, 0xE, 0xB, 0xE, 0xD, 0xE, 0xF,
- 0xF, 0x1, 0xF, 0x3, 0xF, 0x5, 0xF, 0x7,
- 0xF, 0x9, 0xF, 0xB, 0xF, 0xD, 0xF, 0xF
-};
-
const char * const LoLEngine::_languageExt[] = {
"ENG",
"FRE",
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index 06c13e1fef..5586be730e 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -47,7 +47,7 @@ public:
void resetDimTextPositions(int dim);
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, ...) GCC_PRINTF(3, 4);
int16 _scriptParameter;
diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp
index 84c4f8b19d..0e43487217 100644
--- a/engines/kyra/timer_lol.cpp
+++ b/engines/kyra/timer_lol.cpp
@@ -147,7 +147,7 @@ void LoLEngine::timerSpecialCharacterUpdate(int timerNum) {
break;
case 3:
- v = _rnd.getRandomNumberRng(1, 2);
+ v = rollDice(1, 2);
if (inflictDamage(i, v, 0x8000, 0, 0x80)) {
_txt->printMessage(2, getLangString(0x4022), _characters[i].name);
_characters[i].characterUpdateDelay[ii] = 10;
@@ -241,7 +241,7 @@ void LoLEngine::timerUpdatePortraitAnimations(int skipUpdate) {
} else {
_characters[i].curFaceFrame = 0;
gui_drawCharPortraitWithStats(i);
- _characters[i].nextAnimUpdateCountdown = (int16) _rnd.getRandomNumberRng(1, 12) + 6;
+ _characters[i].nextAnimUpdateCountdown = rollDice(1, 12) + 6;
}
}
}