[Scummvm-cvs-logs] CVS: scummvm x11.cpp,1.6,1.7
Lionel Ulmer
bbrox at users.sourceforge.net
Sat Mar 23 16:05:14 CET 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.57,1.58 scumm.h,1.99,1.100 scummvm.cpp,1.93,1.94 sdl.cpp,1.50,1.51
- Next message: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.25,1.26 gfx.cpp,1.55,1.56
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv18048
Modified Files:
x11.cpp
Log Message:
Added shaking + 'pixel hunting' and 'right click emulation' modes. Still only working with the 'pre_freeze' label.
Index: x11.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/x11.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** x11.cpp 18 Mar 2002 17:47:04 -0000 1.6
--- x11.cpp 24 Mar 2002 00:04:37 -0000 1.7
***************
*** 71,74 ****
--- 71,75 ----
static int fake_right_mouse = 0;
static int report_presses = 1;
+ static int current_shake_pos = 0;
#define MAX_NUMBER_OF_DIRTY_SQUARES 32
***************
*** 291,296 ****
}
void setShakePos(Scumm *s, int shake_pos) {
! warning("Unimplemented shaking !");
}
--- 292,371 ----
}
+ /* This simply shifts up or down the screen by 'shake pos' */
void setShakePos(Scumm *s, int shake_pos) {
! if (shake_pos != current_shake_pos) {
! int dirty_top = 0, dirty_height = 0;
! int line;
!
! /* This is to provoke a full redraw */
! num_of_dirty_square = MAX_NUMBER_OF_DIRTY_SQUARES;
!
! /* Update the mouse to prevent 'mouse droppings' */
! old_mouse_y += shake_pos - current_shake_pos;
!
! /* Handle the 'dirty part' of the screen */
! if (shake_pos > current_shake_pos) {
! for (line = 199 + shake_pos; line >= -shake_pos; line--) {
! int cur_pos, new_pos;
! int cur_OK, new_OK;
!
! cur_pos = line + current_shake_pos;
! new_pos = line + shake_pos;
!
! cur_OK = (cur_pos >= 0) && (cur_pos < 200);
! new_OK = (new_pos >= 0) && (new_pos < 200);
! if (cur_OK && new_OK)
! memcpy(local_fb + new_pos * 320, local_fb + cur_pos * 320, 320);
! else if (cur_OK)
! memset(local_fb + cur_pos * 320, 0, 320);
! else if (new_OK)
! memset(local_fb + new_pos * 320, 0, 320);
! }
!
! if (current_shake_pos < 0) {
! dirty_top = -shake_pos;
! dirty_height = shake_pos - current_shake_pos;
! if (dirty_top < 0) {
! dirty_height += dirty_top;
! dirty_top = 0;
! }
! if ((dirty_height + dirty_top) > 200)
! dirty_height = 200 - dirty_top;
! } else {
! dirty_height = 0;
! }
! } else {
! for (line = -current_shake_pos; line < 200 + current_shake_pos; line++) {
! int cur_pos, new_pos;
! int cur_OK, new_OK;
!
! cur_pos = line + current_shake_pos;
! new_pos = line + shake_pos;
! cur_OK = (cur_pos >= 0) && (cur_pos < 200);
! new_OK = (new_pos >= 0) && (new_pos < 200);
!
! if (cur_OK && new_OK)
! memcpy(local_fb + new_pos * 320, local_fb + cur_pos * 320, 320);
! else if (cur_OK)
! memset(local_fb + cur_pos * 320, 0, 320);
! else if (new_OK)
! memset(local_fb + new_pos * 320, 0, 320);
! }
!
! if (current_shake_pos <= 0) {
! dirty_height = 0;
! } else {
! dirty_top = 200 - current_shake_pos;
! dirty_height = current_shake_pos - shake_pos;
! if ((dirty_height + dirty_top) > 200)
! dirty_height = 200 - dirty_top;
! }
! }
!
! /* And save the new shake position */
! current_shake_pos = shake_pos;
! if (dirty_height > 0)
! s->redrawLines(dirty_top, dirty_top + dirty_height);
! }
}
***************
*** 304,308 ****
}
void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h) {
! unsigned char *dst = local_fb + 320 * y + x;
if (h<=0) return;
--- 379,395 ----
}
void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h) {
! unsigned char *dst;
!
! y += current_shake_pos;
! if (y < 0) {
! h += y;
! src -= y * 320;
! y = 0;
! }
! if (h > (200 - y)) {
! h = 200 - y;
! }
!
! dst = local_fb + 320 * y + x;
if (h<=0) return;
***************
*** 328,331 ****
--- 415,420 ----
unsigned char *dst,*bak;
+ ydraw += current_shake_pos;
+
if ((xdraw >= 320) || ((xdraw + w) <= 0) ||
(ydraw >= 200) || ((ydraw + h) <= 0)) {
***************
*** 467,471 ****
full_redraw = true;
num_of_dirty_square = 0;
! } else if (num_of_dirty_square > MAX_NUMBER_OF_DIRTY_SQUARES) {
full_redraw = true;
num_of_dirty_square = 0;
--- 556,560 ----
full_redraw = true;
num_of_dirty_square = 0;
! } else if (num_of_dirty_square >= MAX_NUMBER_OF_DIRTY_SQUARES) {
full_redraw = true;
num_of_dirty_square = 0;
- Previous message: [Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.57,1.58 scumm.h,1.99,1.100 scummvm.cpp,1.93,1.94 sdl.cpp,1.50,1.51
- Next message: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.25,1.26 gfx.cpp,1.55,1.56
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list