[Scummvm-git-logs] scummvm master -> 110e232ed7d698d2939b56d4227392c64806f62b
sev-
sev at scummvm.org
Wed Apr 1 18:40:20 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
110e232ed7 GRIFFON: Simplify rendering calls
Commit: 110e232ed7d698d2939b56d4227392c64806f62b
https://github.com/scummvm/scummvm/commit/110e232ed7d698d2939b56d4227392c64806f62b
Author: ixote (nuageux142857 at outlook.com)
Date: 2020-04-01T20:40:16+02:00
Commit Message:
GRIFFON: Simplify rendering calls
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 84fd40e118..f46f17917e 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -256,7 +256,6 @@ void GriffonEngine::configMenu() {
int ticks1 = _ticks;
- _cloudImg->setAlpha(128, true);
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
@@ -267,14 +266,14 @@ void GriffonEngine::configMenu() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest, TS_ARGB(128, 255, 255, 255));
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest, TS_ARGB(128, 255, 255, 255));
configwindow->blit(*_videoBuffer);
@@ -467,7 +466,6 @@ void GriffonEngine::configMenu() {
g_system->delayMillis(10);
} while (!_shouldQuit && !exitMenu && _gameMode != kGameModeNewGame && _gameMode != kGameModeLoadGame);
- _cloudImg->setAlpha(64, true);
configwindow->free();
_itemTicks = _ticks + 210;
@@ -559,7 +557,6 @@ void GriffonEngine::saveLoadNew() {
int ticks1 = _ticks;
int tickPause = _ticks + 150;
- _cloudImg->setAlpha(128, true);
renderSaveStates();
@@ -583,14 +580,14 @@ void GriffonEngine::saveLoadNew() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest, TS_ARGB(128, 255, 255, 255));
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest, TS_ARGB(128, 255, 255, 255));
_saveLoadImg->blit(*_videoBuffer);
@@ -783,7 +780,6 @@ void GriffonEngine::saveLoadNew() {
g_system->delayMillis(10);
} while (!_shouldQuit);
- _cloudImg->setAlpha(64, true);
}
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 401392cec1..29fe0fde2c 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -220,7 +220,7 @@ void GriffonEngine::drawHud() {
if (ico != 99)
_itemImg[ico]->blit(*_videoBuffer, rcDest.left, rcDest.top);
if (ico == 99) {
- _spellImg->setAlpha((int)(RND() * 96) + 96, true);
+ int alpha = (int)(RND() * 96) + 96;
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -230,7 +230,7 @@ void GriffonEngine::drawHud() {
rcDest.left = ix;
rcDest.top = iy;
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
}
}
}
@@ -588,8 +588,7 @@ void GriffonEngine::drawNPCs(int mode) {
int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
- _spellImg->setAlpha(x, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(x, 255, 255, 255));
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -603,8 +602,7 @@ void GriffonEngine::drawNPCs(int mode) {
x = 192 + f % 3 * 64;
if (x > 255)
x = 255;
- _spellImg->setAlpha(x, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(x, 255, 255, 255));
}
rcSrc.left = 0;
@@ -770,7 +768,7 @@ void GriffonEngine::drawNPCs(int mode) {
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcInfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
- _spellImg->setAlpha(128 + (int)(RND() * 96), true);
+ int alpha = 128 + (int)(RND() * 96);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -780,7 +778,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
rcDest.top = sy - (int)(RND() * 6);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
}
for (int ii = 0; ii <= 8; ii++) {
@@ -797,9 +795,9 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- _spellImg->setAlpha(i2 / 3 * 224, true);
+ int alpha = i2 / 3 * 224;
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
int xloc = rcDest.left;
int yloc = rcDest.top;
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index d0ed91b2c3..1a6a6c962e 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -1305,8 +1305,7 @@ void GriffonEngine::updateSpells() {
}
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- _spellImg->setAlpha(alf, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB((int)alf, 255, 255, 255));
if (_spellInfo[i].damagewho == 0) {
for (int e = 1; e <= _lastNpc; e++) {
@@ -1381,8 +1380,7 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
- _spellImg->setAlpha(255, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(255, 255, 255, 255));
_spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
if (_spellInfo[i].frame < 0)
@@ -1504,8 +1502,7 @@ void GriffonEngine::updateSpells() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- _spellImg->setAlpha(255, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(255, 255, 255, 255));
if (scatter) {
if (_spellInfo[i].damagewho == 0) {
@@ -1584,8 +1581,7 @@ void GriffonEngine::updateSpells() {
if (fra > 24)
f = 192 * (1 - (fra - 24) / 8);
- _spellImg->setAlpha(f, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(f, 255, 255, 255));
_spellInfo[i].frame = _spellInfo[i].frame - 0.3 * _fpsr;
if (_spellInfo[i].frame < 0) {
@@ -1667,7 +1663,7 @@ void GriffonEngine::updateSpells() {
if (_spellInfo[i].frame > 16) {
float fr = (32 - _spellInfo[i].frame);
- _spellImg->setAlpha(192 * sin(3.14159 * fr / 4), true);
+ int alpha = 192 * sin(3.14159 * fr / 4);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -1682,10 +1678,9 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
}
} else {
- _spellImg->setAlpha(192, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -1715,7 +1710,7 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(192, 255, 255, 255));
}
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
@@ -2092,8 +2087,7 @@ void GriffonEngine::updateSpellsUnder() {
if (fra > 24)
f = 160 * (1 - (fra - 24) / 8);
- _spellImg->setAlpha(f, true);
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(f, 255, 255, 255));
_spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
if (_spellInfo[i].frame < 0)
@@ -2180,7 +2174,7 @@ void GriffonEngine::updateSpellsUnder() {
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
if (_spellInfo[i].legalive[f] >= x) {
- _spellImg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
+ int alpha = 192 * sin(3.14159 * x / 32) * s / 8;
float an = 360 / 5 * f + x / 32 * 180;
@@ -2195,7 +2189,7 @@ void GriffonEngine::updateSpellsUnder() {
rcDest.top = (int)yloc;
if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
@@ -2304,7 +2298,6 @@ void GriffonEngine::updateSpellsUnder() {
float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
alpha = CLIP(alpha, 0, 255);
- _spellImg->setAlpha(alpha, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2318,7 +2311,7 @@ void GriffonEngine::updateSpellsUnder() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
- _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
if (_spellInfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (_player.px + 12);
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index c413e4bfc1..9211aec572 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -293,12 +293,13 @@ void GriffonEngine::loadMap(int mapnum) {
rcDest.setWidth(16);
rcDest.setHeight(16);
+ int alpha = 255;
if (l == 2 && 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) {
- _tiles[curtilel]->setAlpha(128, true);
+ alpha = 128;
}
}
}
@@ -306,13 +307,12 @@ void GriffonEngine::loadMap(int mapnum) {
for (int ff = 0; ff <= 4; ff++) {
int ffa = 20 * (5 + ff) + 3;
if (curtile == ffa) {
- _tiles[curtilel]->setAlpha(192, true);
+ alpha = 192;
}
}
}
- _tiles[curtilel]->blit(*_mapBg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _tiles[curtilel]->setAlpha(255, true);
+ _tiles[curtilel]->blit(*_mapBg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(alpha, 255, 255, 255));
rcDest.left = x * 8;
rcDest.top = y * 8;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 36d80d7e3c..00a27eb4b5 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -131,8 +131,7 @@ void GriffonEngine::setupAudio() {
rcDest.left = 160 - 44;
rcDest.top = 116 + 12;
- loadimg->setAlpha(160, true); // 128
- loadimg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ loadimg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc, TS_ARGB(160, 255, 255, 255));
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
More information about the Scummvm-git-logs
mailing list