aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
authorPaul Gilbert2018-01-27 17:12:23 -0500
committerPaul Gilbert2018-01-27 17:12:23 -0500
commit12eacafe0e8f9c1349cd3c131160c6728681e9d9 (patch)
treef288c6bf7dc87d3fa44e2cf0f7ed00548ab9b7b9 /engines/xeen
parent540f47294a0274e2aaa9178a11997b4b975a6234 (diff)
downloadscummvm-rg350-12eacafe0e8f9c1349cd3c131160c6728681e9d9.tar.gz
scummvm-rg350-12eacafe0e8f9c1349cd3c131160c6728681e9d9.tar.bz2
scummvm-rg350-12eacafe0e8f9c1349cd3c131160c6728681e9d9.zip
XEEN: Implement screen shaking
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/combat.cpp1
-rw-r--r--engines/xeen/interface.cpp29
-rw-r--r--engines/xeen/interface.h3
3 files changed, 26 insertions, 7 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 549f7739f3..c7adf54455 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -144,7 +144,6 @@ void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
- Scripts &scripts = *_vm->_scripts;
Sound &sound = *_vm->_sound;
Windows &windows = *_vm->_windows;
int charIndex1 = charIndex + 1;
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index ef6dbc9577..132ca9169a 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -620,7 +620,6 @@ void Interface::doStepCode() {
Combat &combat = *_vm->_combat;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
- Scripts &scripts = *_vm->_scripts;
int damage = 0;
party._stepped = true;
@@ -692,7 +691,6 @@ void Interface::startFalling(bool flag) {
Combat &combat = *_vm->_combat;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
- Scripts &scripts = *_vm->_scripts;
bool isDarkCc = _vm->_files->_isDarkCc;
if (isDarkCc && party._gameFlags[1][118]) {
@@ -1279,7 +1277,6 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
}
void Interface::handleFalling() {
- EventsManager &events = *g_vm->_events;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
@@ -1337,8 +1334,30 @@ void Interface::fall(int yp) {
w.blitFrom(_fallSurface, Common::Rect(0, yp, SCENE_WIDTH, yp + SCENE_HEIGHT), Common::Point(8, 8));
}
-void Interface::shake(int time) {
- // TODO
+void Interface::shake(int count) {
+ Screen &screen = *g_vm->_screen;
+ byte b;
+
+ for (int idx = 0; idx < count * 2; ++idx) {
+ for (int yp = 0; yp < screen.h; ++yp) {
+ byte *lineP = (byte *)screen.getBasePtr(0, yp);
+ if (idx % 2) {
+ // Shift back right
+ b = lineP[SCREEN_WIDTH - 1];
+ Common::copy_backward(lineP, lineP + SCREEN_WIDTH - 1, lineP + SCREEN_WIDTH);
+ lineP[0] = b;
+ } else {
+ // Scroll left one pixel
+ b = lineP[0];
+ Common::copy(lineP + 1, lineP + SCREEN_WIDTH, lineP);
+ lineP[SCREEN_WIDTH - 1] = b;
+ }
+ }
+
+ screen.markAllDirty();
+ screen.update();
+ g_system->delayMillis(5);
+ }
}
void Interface::assembleBorder() {
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 321fe520c7..e2499d8fa3 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -144,8 +144,9 @@ private:
/**
* Shake the screen
+ * @param count Number of times
*/
- void shake(int time);
+ void shake(int count);
/**
* Select next character or monster to be attacking