aboutsummaryrefslogtreecommitdiff
path: root/sdl.cpp
diff options
context:
space:
mode:
authorJames Brown2002-04-17 11:20:55 +0000
committerJames Brown2002-04-17 11:20:55 +0000
commit2be1b45bdfa04050308adc5f19557a5111e1a3c8 (patch)
treeea3377f324171190786ffdbc8edeb1c614546bb7 /sdl.cpp
parent8df45c662cacd08c969fc83f348607e6763b957b (diff)
downloadscummvm-rg350-2be1b45bdfa04050308adc5f19557a5111e1a3c8.tar.gz
scummvm-rg350-2be1b45bdfa04050308adc5f19557a5111e1a3c8.tar.bz2
scummvm-rg350-2be1b45bdfa04050308adc5f19557a5111e1a3c8.zip
Add BeIDE project file (update readme accordingly).
Readd shaking support. It doesn't work properly - probably due to the removal of redrawLines(). Ludde? You vanished before I could confirm this with you.. is there a new function to call? svn-id: r3973
Diffstat (limited to 'sdl.cpp')
-rw-r--r--sdl.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/sdl.cpp b/sdl.cpp
index fff9dacf87..e221bb74b2 100644
--- a/sdl.cpp
+++ b/sdl.cpp
@@ -7,7 +7,8 @@
#include "mp3_cd.h"
#include <SDL.h>
-
+#define MAX(a,b) (((a)<(b)) ? (b) : (a))
+#define MIN(a,b) (((a)>(b)) ? (b) : (a))
class OSystem_SDL : public OSystem {
public:
@@ -567,7 +568,7 @@ void OSystem_SDL::update_screen() {
/* Calculate area */
area += r->w * r->h;
- /* scale the rect to fit in SDL_UpdateRects */
+ /* scaling the rect to fit in SDL_UpdateRects */
r->x <<= 1;
r->y <<= 1;
r->w <<= 1;
@@ -624,6 +625,43 @@ void OSystem_SDL::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_
}
void OSystem_SDL::set_shake_pos(int shake_pos) {
+ int old_shake_pos = _current_shake_pos;
+ int dirty_height, dirty_blackheight;
+ int dirty_top, dirty_blacktop;
+
+ if (shake_pos != old_shake_pos) {
+ _current_shake_pos = shake_pos;
+ force_full = true;
+
+ /* Old shake pos was current_shake_pos, new is shake_pos.
+ * Move the screen up or down to account for the change.
+ */
+ SDL_Rect dstr = { 0, shake_pos*scaling, 320*scaling, 200*scaling };
+ SDL_Rect srcr = { 0, old_shake_pos*scaling, 320*scaling, 200*scaling };
+ SDL_BlitSurface(sdl_screen, &srcr, sdl_screen, &dstr);
+
+ /* Refresh either the upper part of the screen,
+ * or the lower part */
+ if (shake_pos > old_shake_pos) {
+ dirty_height = MIN(shake_pos, 0) - MIN(old_shake_pos, 0);
+ dirty_top = -MIN(shake_pos, 0);
+ dirty_blackheight = MAX(shake_pos, 0) - MAX(old_shake_pos, 0);
+ dirty_blacktop = MAX(old_shake_pos, 0);
+ } else {
+ dirty_height = MAX(old_shake_pos, 0) - MAX(shake_pos, 0);
+ dirty_top = 200 - MAX(old_shake_pos, 0);
+ dirty_blackheight = MIN(old_shake_pos, 0) - MIN(shake_pos, 0);
+ dirty_blacktop = 200 + MIN(shake_pos, 0);
+ }
+
+ /* Fill the dirty area with blackness or the scumm image */
+ SDL_Rect blackrect = {0, dirty_blacktop*scaling, 320*scaling, dirty_blackheight*scaling};
+ SDL_FillRect(sdl_screen, &blackrect, 0);
+
+ /* FIXME: Um, screen seems to glitch since this
+ 'not needed' function was removed */
+ //g_scumm->redrawLines(dirty_top, dirty_top + dirty_height);
+ }
}
uint32 OSystem_SDL::get_msecs() {