[Scummvm-git-logs] scummvm master -> 12eacafe0e8f9c1349cd3c131160c6728681e9d9
dreammaster
dreammaster at scummvm.org
Sat Jan 27 23:12:30 CET 2018
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:
12eacafe0e XEEN: Implement screen shaking
Commit: 12eacafe0e8f9c1349cd3c131160c6728681e9d9
https://github.com/scummvm/scummvm/commit/12eacafe0e8f9c1349cd3c131160c6728681e9d9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-27T17:12:23-05:00
Commit Message:
XEEN: Implement screen shaking
Changed paths:
engines/xeen/combat.cpp
engines/xeen/interface.cpp
engines/xeen/interface.h
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 549f773..c7adf54 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 ef6dbc9..132ca91 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 321fe52..e2499d8 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
More information about the Scummvm-git-logs
mailing list