diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/griffon/cutscenes.cpp | 72 | ||||
-rw-r--r-- | engines/griffon/dialogs.cpp | 20 | ||||
-rw-r--r-- | engines/griffon/draw.cpp | 23 | ||||
-rw-r--r-- | engines/griffon/logic.cpp | 6 |
4 files changed, 41 insertions, 80 deletions
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp index a3df23d421..a61f5643dd 100644 --- a/engines/griffon/cutscenes.cpp +++ b/engines/griffon/cutscenes.cpp @@ -123,30 +123,19 @@ const char *story2[27] = { }; void GriffonEngine::showLogos() { - float y; - int _ticks1; - _ticks = g_system->getMillis(); - _ticks1 = _ticks; - - y = 0.0; + int ticks1 = _ticks; do { - y = 255.0; - if (_ticks < _ticks1 + 1000) { - y = 255.0 * ((float)(_ticks - _ticks1) / 1000.0); - if (y < 0.0) - y = 0.0; - if (y > 255.0) - y = 255.0; + float y = 255.0; + if (_ticks < ticks1 + 1000) { + y = 255.0 * ((float)(_ticks - ticks1) / 1000.0); + y = CLIP<float>(y, 0.0, 255.0); } - if (_ticks > _ticks1 + 3000) { - y = 255.0 - 255.0 * ((float)(_ticks - _ticks1 - 3000.0) / 1000.0); - if (y < 0.0) - y = 0.0; - if (y > 255.0) - y = 255.0; + if (_ticks > ticks1 + 3000) { + y = 255.0 - 255.0 * ((float)(_ticks - ticks1 - 3000.0) / 1000.0); + y = CLIP<float>(y, 0.0, 255.0); } _videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0); @@ -174,7 +163,7 @@ void GriffonEngine::showLogos() { } g_system->delayMillis(10); - if (_ticks > _ticks1 + 4000) + if (_ticks > ticks1 + 4000) break; } while (!_shouldQuit); } @@ -295,7 +284,7 @@ void GriffonEngine::endOfGame() { setChannelVolume(_musicchannel, 0); } - int _ticks1 = _ticks; + int ticks1 = _ticks; int ya = 0; _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0); @@ -316,15 +305,11 @@ void GriffonEngine::endOfGame() { } ya = 0; - if (_ticks < _ticks1 + 1500) { - ya = (255 * (_ticks - _ticks1)) / 1500; - if (ya < 0) - ya = 0; - if (ya > 255) - ya = 255; - } else { + if (_ticks < ticks1 + 1500) { + ya = (255 * (_ticks - ticks1)) / 1500; + ya = CLIP(ya, 0, 255); + } else break; - } _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0); @@ -352,7 +337,7 @@ void GriffonEngine::endOfGame() { } } while (1); - _ticks1 = _ticks; + ticks1 = _ticks; ya = 0; float y = 140; @@ -382,12 +367,9 @@ void GriffonEngine::endOfGame() { } ya = 255; - if (_ticks < _ticks1 + 1000) { - ya = 255 * (_ticks - _ticks1) / 1000; - if (ya < 0) - ya = 0; - if (ya > 255) - ya = 255; + if (_ticks < ticks1 + 1000) { + ya = 255 * (_ticks - ticks1) / 1000; + ya = CLIP(ya, 0, 255); } _videobuffer->setAlpha(ya); @@ -427,14 +409,15 @@ void GriffonEngine::endOfGame() { } while (1); - _ticks1 = _ticks; + ticks1 = _ticks; int y1 = 0; _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h); do { - if (_ticks < _ticks1 + 1500) { - y1 = 255 * (_ticks - _ticks1) / 1500; + if (_ticks < ticks1 + 1500) { + y1 = 255 * (_ticks - ticks1) / 1500; + if (y1 < 0) y1 = 0; if (y1 > 255) @@ -472,19 +455,16 @@ void GriffonEngine::endOfGame() { int keywait = 2000 + _ticks; - _ticks1 = _ticks; + ticks1 = _ticks; y1 = 0; do { _videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h); y1 = 255; - if (_ticks < _ticks1 + 1000) { - y1 = 255 * (_ticks - _ticks1) / 1000; - if (y1 < 0) - y1 = 0; - if (y1 > 255) - y1 = 255; + if (_ticks < ticks1 + 1000) { + y1 = 255 * (_ticks - ticks1) / 1000; + y1 = CLIP(y1, 0, 255); } _videobuffer->setAlpha(y1); diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp index 03254ce006..e30b476c58 100644 --- a/engines/griffon/dialogs.cpp +++ b/engines/griffon/dialogs.cpp @@ -124,10 +124,7 @@ void GriffonEngine::title(int mode) { float yf = 255.0; if (_ticks < _ticks1 + 1000) { yf = 255.0 * ((float)(_ticks - _ticks1) / 1000.0); - if (y < 0.0) - yf = 0.0; - if (y > 255.0) - yf = 255.0; + yf = CLIP<float>(yf, 0.0, 255.0); } _videobuffer->setAlpha((int)yf); @@ -274,10 +271,7 @@ void GriffonEngine::configMenu() { if (i == 15 || i == 17) { int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255; - if (vol < 0) - vol = 0; - if (vol > 9) - vol = 9; + vol = CLIP(vol, 0, 9); strcpy(line, "[----------]"); line[vol + 1] = 'X'; @@ -322,10 +316,7 @@ void GriffonEngine::configMenu() { float yy = 255.0; if (_ticks < _ticks1 + 1000) { yy = 255.0 * ((float)(_ticks - _ticks1) / 1000.0); - if (yy < 0.0) - yy = 0.0; - if (yy > 255.0) - yy = 255.0; + yy = CLIP<float>(yy, 0.0, 255.0); } _videobuffer->setAlpha((int)yy); @@ -747,10 +738,7 @@ void GriffonEngine::saveLoadNew() { int yy = 255; if (_ticks < _ticks1 + 1000) { yy = 255 * (_ticks - _ticks1) / 1000; - if (yy < 0) - yy = 0; - if (yy > 255) - yy = 255; + yy = CLIP(yy, 0, 255); } _videobuffer->setAlpha((int)yy); diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp index 7d364f78b0..50d3fe4c3f 100644 --- a/engines/griffon/draw.cpp +++ b/engines/griffon/draw.cpp @@ -996,11 +996,11 @@ void GriffonEngine::drawNPCs(int mode) { _videobuffer->fillRect(rcDest, ccc); - int pass = 1; + bool pass = true; if (_npcinfo[i].spriteset == kMonsterBoss1) - pass = 0; - if (pass == 1) + pass = false; + if (pass) drawOver(npx, npy); } @@ -1044,17 +1044,17 @@ void GriffonEngine::drawOver(int modx, int mody) { rcDest.setWidth(16); rcDest.setHeight(16); - int pass = 1; + bool pass = true; if (curtilel == 1) { for (int ff = 0; ff <= 5; ff++) { int ffa = 20 * 5 - 1 + ff * 20; int ffb = 20 * 5 + 4 + ff * 20; if (curtile > ffa && curtile < ffb) - pass = 0; + pass = false; } } - if (pass == 1) + if (pass) _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc); } } @@ -1096,11 +1096,11 @@ void GriffonEngine::drawPlayer() { long ccc = _videobuffer->format.RGBToColor(224, 224, 64); - int pass = 0; + bool pass = false; if (_player.hp <= _player.maxhp * 0.25) - pass = 1; + pass = true; - if (pass == 1) { + if (pass) { ccc = _videobuffer->format.RGBToColor(255, 255, 255); if ((int)(_player.hpflash) == 1) ccc = _videobuffer->format.RGBToColor(255, 0, 0); @@ -1200,10 +1200,7 @@ void GriffonEngine::drawView() { } void GriffonEngine::swash() { - float y; - - y = 0; - + float y = 0.0; do { y = y + 1 * _fpsr; diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp index 50ca72ce35..f76245854b 100644 --- a/engines/griffon/logic.cpp +++ b/engines/griffon/logic.cpp @@ -2336,11 +2336,7 @@ void GriffonEngine::updateSpellsUnder() { alpha = 255 * (1 - (xx - 8) / 8); float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8; - if (alpha < 0) - alpha = 0; - if (alpha > 255) - alpha = 255; - + alpha = CLIP(alpha, 0, 255); _spellimg->setAlpha(alpha, true); rcSrc.left = 16 * (int)(RND() * 2); |