aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/graphics/effects
diff options
context:
space:
mode:
Diffstat (limited to 'engines/zvision/graphics/effects')
-rw-r--r--engines/zvision/graphics/effects/fog.h6
-rw-r--r--engines/zvision/graphics/effects/wave.cpp148
-rw-r--r--engines/zvision/graphics/effects/wave.h6
3 files changed, 80 insertions, 80 deletions
diff --git a/engines/zvision/graphics/effects/fog.h b/engines/zvision/graphics/effects/fog.h
index 62dd1f9473..45d6f9596d 100644
--- a/engines/zvision/graphics/effects/fog.h
+++ b/engines/zvision/graphics/effects/fog.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef FOGFX_H_INCLUDED
-#define FOGFX_H_INCLUDED
+#ifndef ZVISION_FOG_H
+#define ZVISION_FOG_H
#include "zvision/graphics/effect.h"
@@ -49,4 +49,4 @@ private:
};
} // End of namespace ZVision
-#endif // FOGFX_H_INCLUDED
+#endif // ZVISION_FOG_H
diff --git a/engines/zvision/graphics/effects/wave.cpp b/engines/zvision/graphics/effects/wave.cpp
index 88239f3cad..9f2fbb285c 100644
--- a/engines/zvision/graphics/effects/wave.cpp
+++ b/engines/zvision/graphics/effects/wave.cpp
@@ -30,32 +30,32 @@
namespace ZVision {
-WaveFx::WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 s_x, int16 s_y, float ampl, float waveln, float spd):
+WaveFx::WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 centerX, int16 centerY, float ampl, float waveln, float spd):
Effect(engine, key, region, ported) {
_frame = 0;
- _frame_cnt = frames;
+ _frameCount = frames;
- _ampls.resize(_frame_cnt);
- _hw = _region.width() / 2;
- _hh = _region.height() / 2;
+ _ampls.resize(_frameCount);
+ _halfWidth = _region.width() / 2;
+ _halfHeight = _region.height() / 2;
- int32 frmsize = _hw * _hh;
+ int32 frmsize = _halfWidth * _halfHeight;
float phase = 0;
- int16 w_4 = _hw / 2;
- int16 h_4 = _hh / 2;
+ int16 quarterWidth = _halfWidth / 2;
+ int16 quarterHeight = _halfHeight / 2;
- for (int16 i = 0; i < _frame_cnt; i++) {
+ for (int16 i = 0; i < _frameCount; i++) {
_ampls[i].resize(frmsize);
- for (int16 y = 0; y < _hh; y++)
- for (int16 x = 0; x < _hw; x++) {
- int16 dx = (x - w_4);
- int16 dy = (y - h_4);
+ for (int16 y = 0; y < _halfHeight; y++)
+ for (int16 x = 0; x < _halfWidth; x++) {
+ int16 dx = (x - quarterWidth);
+ int16 dy = (y - quarterHeight);
- _ampls[i][x + y * _hw] = ampl * sin(sqrt(dx * dx / (float)s_x + dy * dy / (float)s_y) / (-waveln * 3.1415926) + phase);
+ _ampls[i][x + y * _halfWidth] = ampl * sin(sqrt(dx * dx / (float)centerX + dy * dy / (float)centerY) / (-waveln * 3.1415926) + phase);
}
phase += spd;
}
@@ -68,66 +68,66 @@ WaveFx::~WaveFx() {
}
const Graphics::Surface *WaveFx::draw(const Graphics::Surface &srcSubRect) {
- for (int16 y = 0; y < _hh; y++) {
+ for (int16 y = 0; y < _halfHeight; y++) {
uint16 *abc = (uint16 *)_surface.getBasePtr(0, y);
- uint16 *abc2 = (uint16 *)_surface.getBasePtr(0, _hh + y);
- uint16 *abc3 = (uint16 *)_surface.getBasePtr(_hw, y);
- uint16 *abc4 = (uint16 *)_surface.getBasePtr(_hw, _hh + y);
-
- for (int16 x = 0; x < _hw; x++) {
- int8 amnt = _ampls[_frame][x + _hw * y];
-
- int16 n_x = x + amnt;
- int16 n_y = y + amnt;
-
- if (n_x < 0)
- n_x = 0;
- if (n_x >= _region.width())
- n_x = _region.width() - 1;
- if (n_y < 0)
- n_y = 0;
- if (n_y >= _region.height())
- n_y = _region.height() - 1;
- *abc = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y);
-
- n_x = x + amnt + _hw;
- n_y = y + amnt;
-
- if (n_x < 0)
- n_x = 0;
- if (n_x >= _region.width())
- n_x = _region.width() - 1;
- if (n_y < 0)
- n_y = 0;
- if (n_y >= _region.height())
- n_y = _region.height() - 1;
- *abc3 = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y);
-
- n_x = x + amnt;
- n_y = y + amnt + _hh;
-
- if (n_x < 0)
- n_x = 0;
- if (n_x >= _region.width())
- n_x = _region.width() - 1;
- if (n_y < 0)
- n_y = 0;
- if (n_y >= _region.height())
- n_y = _region.height() - 1;
- *abc2 = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y);
-
- n_x = x + amnt + _hw;
- n_y = y + amnt + _hh;
-
- if (n_x < 0)
- n_x = 0;
- if (n_x >= _region.width())
- n_x = _region.width() - 1;
- if (n_y < 0)
- n_y = 0;
- if (n_y >= _region.height())
- n_y = _region.height() - 1;
- *abc4 = *(const uint16 *)srcSubRect.getBasePtr(n_x, n_y);
+ uint16 *abc2 = (uint16 *)_surface.getBasePtr(0, _halfHeight + y);
+ uint16 *abc3 = (uint16 *)_surface.getBasePtr(_halfWidth, y);
+ uint16 *abc4 = (uint16 *)_surface.getBasePtr(_halfWidth, _halfHeight + y);
+
+ for (int16 x = 0; x < _halfWidth; x++) {
+ int8 amnt = _ampls[_frame][x + _halfWidth * y];
+
+ int16 nX = x + amnt;
+ int16 nY = y + amnt;
+
+ if (nX < 0)
+ nX = 0;
+ if (nX >= _region.width())
+ nX = _region.width() - 1;
+ if (nY < 0)
+ nY = 0;
+ if (nY >= _region.height())
+ nY = _region.height() - 1;
+ *abc = *(const uint16 *)srcSubRect.getBasePtr(nX, nY);
+
+ nX = x + amnt + _halfWidth;
+ nY = y + amnt;
+
+ if (nX < 0)
+ nX = 0;
+ if (nX >= _region.width())
+ nX = _region.width() - 1;
+ if (nY < 0)
+ nY = 0;
+ if (nY >= _region.height())
+ nY = _region.height() - 1;
+ *abc3 = *(const uint16 *)srcSubRect.getBasePtr(nX, nY);
+
+ nX = x + amnt;
+ nY = y + amnt + _halfHeight;
+
+ if (nX < 0)
+ nX = 0;
+ if (nX >= _region.width())
+ nX = _region.width() - 1;
+ if (nY < 0)
+ nY = 0;
+ if (nY >= _region.height())
+ nY = _region.height() - 1;
+ *abc2 = *(const uint16 *)srcSubRect.getBasePtr(nX, nY);
+
+ nX = x + amnt + _halfWidth;
+ nY = y + amnt + _halfHeight;
+
+ if (nX < 0)
+ nX = 0;
+ if (nX >= _region.width())
+ nX = _region.width() - 1;
+ if (nY < 0)
+ nY = 0;
+ if (nY >= _region.height())
+ nY = _region.height() - 1;
+ *abc4 = *(const uint16 *)srcSubRect.getBasePtr(nX, nY);
abc++;
abc2++;
@@ -140,7 +140,7 @@ const Graphics::Surface *WaveFx::draw(const Graphics::Surface &srcSubRect) {
}
void WaveFx::update() {
- _frame = (_frame + 1) % _frame_cnt;
+ _frame = (_frame + 1) % _frameCount;
}
} // End of namespace ZVision
diff --git a/engines/zvision/graphics/effects/wave.h b/engines/zvision/graphics/effects/wave.h
index 0046dfceec..2e813ed5b6 100644
--- a/engines/zvision/graphics/effects/wave.h
+++ b/engines/zvision/graphics/effects/wave.h
@@ -33,7 +33,7 @@ class ZVision;
class WaveFx : public Effect {
public:
- WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 s_x, int16 s_y, float ampl, float waveln, float spd);
+ WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 centerX, int16 centerY, float ampl, float waveln, float spd);
~WaveFx();
const Graphics::Surface *draw(const Graphics::Surface &srcSubRect);
@@ -42,8 +42,8 @@ public:
private:
int16 _frame;
- int16 _frame_cnt;
- int16 _hw, _hh;
+ int16 _frameCount;
+ int16 _halfWidth, _halfHeight;
Common::Array< Common::Array< int8 > > _ampls;
};
} // End of namespace ZVision