[Scummvm-cvs-logs] CVS: scummvm x11.cpp,1.19,1.20
Lionel Ulmer
bbrox at users.sourceforge.net
Sun Apr 28 14:29:01 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv27834
Modified Files:
x11.cpp
Log Message:
Implemented shaking in the X11 driver the 'easy' way :-)
Added also the possibility to capture the sound played during the
game. To convert to a WAV file, do :
'sox -r 22050 -w -s -c 2 sound.raw sound.wav'
Index: x11.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/x11.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** x11.cpp 24 Apr 2002 21:19:19 -0000 1.19
--- x11.cpp 27 Apr 2002 17:44:57 -0000 1.20
***************
*** 152,155 ****
--- 152,156 ----
int report_presses;
int current_shake_pos;
+ int new_shake_pos;
struct timeval start_time;
***************
*** 180,183 ****
--- 181,186 ----
} THREAD_PARAM;
+ #undef CAPTURE_SOUND
+
#define FRAG_SIZE 4096
static void *sound_and_music_thread(void *params)
***************
*** 189,192 ****
--- 192,199 ----
void *proc_param = ((THREAD_PARAM *) params)->param;
+ #ifdef CAPTURE_SOUND
+ FILE *f = fopen("sound.raw", "wb");
+ #endif
+
sound_fd = open("/dev/dsp", O_WRONLY);
audio_buf_info info;
***************
*** 249,252 ****
--- 256,263 ----
buf[2 * i + 1] = buf[2 * i] = buf[i];
}
+ #ifdef CAPTURE_SOUND
+ fwrite(buf, 2, FRAG_SIZE >> 1, f);
+ fflush(f);
+ #endif
size = FRAG_SIZE;
while (size > 0) {
***************
*** 300,303 ****
--- 311,315 ----
report_presses = 1;
current_shake_pos = 0;
+ new_shake_pos = 0;
_palette_changed = false;
num_of_dirty_square = MAX_NUMBER_OF_DIRTY_SQUARES;
***************
*** 516,520 ****
}
}
! if (need_redraw == true) {
#ifdef USE_XV_SCALING
XvShmPutImage(display, 65, window, DefaultGC(display, screen), image,
--- 528,544 ----
}
}
!
! if (current_shake_pos != new_shake_pos) {
! /* Redraw first the 'black borders' in case of resize */
! if (current_shake_pos < new_shake_pos)
! XFillRectangle(display, window, black_gc, 0, current_shake_pos, window_width, new_shake_pos);
! else
! XFillRectangle(display, window, black_gc, 0, window_height - current_shake_pos,
! window_width, window_height - new_shake_pos);
! XShmPutImage(display, window, DefaultGC(display, screen), image,
! 0, 0, scumm_x, scumm_y + new_shake_pos,
! 320, 200, 0);
! current_shake_pos = new_shake_pos;
! } else if (need_redraw == true) {
#ifdef USE_XV_SCALING
XvShmPutImage(display, 65, window, DefaultGC(display, screen), image,
***************
*** 522,526 ****
#else
XShmPutImage(display, window, DefaultGC(display, screen), image,
! dout.x, dout.y, scumm_x + dout.x, scumm_y + dout.y,
dout.w - dout.x, dout.h - dout.y, 0);
#endif
--- 546,550 ----
#else
XShmPutImage(display, window, DefaultGC(display, screen), image,
! dout.x, dout.y, scumm_x + dout.x, scumm_y + dout.y + current_shake_pos,
dout.w - dout.x, dout.h - dout.y, 0);
#endif
***************
*** 660,664 ****
void OSystem_X11::set_shake_pos(int shake_pos) {
! warning("Shaking not implemented yet (%d) ", shake_pos);
}
--- 684,688 ----
void OSystem_X11::set_shake_pos(int shake_pos) {
! new_shake_pos = shake_pos;
}
More information about the Scummvm-git-logs
mailing list