[Scummvm-cvs-logs] CVS: scummvm/morphos morphos.cpp,1.2,1.3
Ruediger Hanke
tomjoad at users.sourceforge.net
Sat Apr 6 07:57:03 CEST 2002
Update of /cvsroot/scummvm/scummvm/morphos
In directory usw-pr-cvs1:/tmp/cvs-serv7432
Modified Files:
morphos.cpp
Log Message:
Thorough fix for screen shaking
Index: morphos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** morphos.cpp 4 Apr 2002 14:05:54 -0000 1.2
--- morphos.cpp 6 Apr 2002 15:56:23 -0000 1.3
***************
*** 66,74 ****
SOUND_DRIVER_TYPE snd_driv;
! typedef void (*ScalerFunc)( uint32 src_x, uint32 src_y, uint32 width, uint32 height );
! void Super2xSaI( uint32 src_x, uint32 src_y, uint32 width, uint32 height );
! void SuperEagle( uint32 src_x, uint32 src_y, uint32 width, uint32 height );
! void PointScaler( uint32 src_x, uint32 src_y, uint32 width, uint32 height );
static struct Screen *ScummScreen = NULL;
--- 66,74 ----
SOUND_DRIVER_TYPE snd_driv;
! typedef void (*ScalerFunc)( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
! void Super2xSaI( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
! void SuperEagle( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
! void PointScaler( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height );
static struct Screen *ScummScreen = NULL;
***************
*** 86,89 ****
--- 86,90 ----
static WORD ScummWinY = -1;
static bool ScummOrigMouse = false;
+ static int ScummShakePos = 0;
static struct MsgPort *TimerMsgPort = NULL;
***************
*** 169,174 ****
struct Device *TimerBase = NULL;
- static int current_shake_pos;
-
void updateScreen(Scumm *s);
--- 170,173 ----
***************
*** 850,901 ****
}
- #define MAX(a,b) (((a)<(b)) ? (b) : (a))
- #define MIN(a,b) (((a)>(b)) ? (b) : (a))
-
void setShakePos( Scumm *s, 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;
!
! /* Old shake pos was current_shake_pos, new is shake_pos.
! * Move the screen up or down to account for the change.
! */
! MovePixelArray( 0, old_shake_pos << ScummScale, ScummWindow->RPort, 0, shake_pos << ScummScale, ScummScrWidth, ScummScrHeight );
!
! /* Also adjust the mouse pointer backup Y coordinate.
! * There is a minor mouse glitch when the mouse is moved
! * at the blackness of the shake area, but it's hardly noticable
! */
! old_mouse_y += shake_pos - old_shake_pos;
!
! /* 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 */
! {
! FillPixelArray( ScummWindow->RPort, 0, dirty_blacktop << ScummScale, ScummScrWidth, dirty_blackheight << ScummScale, 0 );
! s->redrawLines(dirty_top, dirty_top + dirty_height);
! }
! }
}
--- 849,855 ----
}
void setShakePos( Scumm *s, int shake_pos )
{
! ScummShakePos = shake_pos;
}
***************
*** 906,910 ****
#define Q_INTERPOLATE(A, B, C, D) ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2) + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask)
! void Super2xSaI( uint32 src_x, uint32 src_y, uint32 width, uint32 height )
{
unsigned int x, y;
--- 860,864 ----
#define Q_INTERPOLATE(A, B, C, D) ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2) + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask)
! void Super2xSaI( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height )
{
unsigned int x, y;
***************
*** 927,931 ****
src_line[3] = src + 320 * 2;
! dst_line[0] = dest+src_y*2*dest_pitch+src_x*2*dest_bpp;
dst_line[1] = dst_line[0]+dest_pitch;
--- 881,885 ----
src_line[3] = src + 320 * 2;
! dst_line[0] = dest+dest_y*2*dest_pitch+dest_x*2*dest_bpp;
dst_line[1] = dst_line[0]+dest_pitch;
***************
*** 1121,1125 ****
}
! void SuperEagle( uint32 src_x, uint32 src_y, uint32 width, uint32 height )
{
unsigned int x, y;
--- 1075,1079 ----
}
! void SuperEagle( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height )
{
unsigned int x, y;
***************
*** 1142,1146 ****
src_line[3] = src + 320 * 2;
! dst_line[0] = dest+src_y*2*dest_pitch+src_x*2*dest_bpp;
dst_line[1] = dst_line[0]+dest_pitch;
--- 1096,1100 ----
src_line[3] = src + 320 * 2;
! dst_line[0] = dest+dest_y*2*dest_pitch+dest_x*2*dest_bpp;
dst_line[1] = dst_line[0]+dest_pitch;
***************
*** 1342,1346 ****
}
! void PointScaler( uint32 src_x, uint32 src_y, uint32 width, uint32 height )
{
byte *src;
--- 1296,1300 ----
}
! void PointScaler( uint32 src_x, uint32 src_y, uint32 dest_x, uint32 dest_y, uint32 width, uint32 height )
{
byte *src;
***************
*** 1363,1367 ****
src = (byte *)ScummBuffer+src_y*320+src_x;
! dst_line[0] = dest+src_y*2*dest_pitch+src_x*2*dest_bpp;
dst_line[1] = dst_line[0]+dest_pitch;
--- 1317,1321 ----
src = (byte *)ScummBuffer+src_y*320+src_x;
! dst_line[0] = dest+dest_y*2*dest_pitch+dest_x*2*dest_bpp;
dst_line[1] = dst_line[0]+dest_pitch;
***************
*** 1410,1415 ****
s->drawMouse();
- /* Account for the shaking and do Y clipping */
- y += current_shake_pos;
if( y < 0 )
{
--- 1364,1367 ----
***************
*** 1456,1465 ****
if( ScummDepth == 8 )
! WritePixelArray( ScummBuffer, 0, 0, 320, &rp, 0, 0, 320, 200, RECTFMT_LUT8 );
else
! WriteLUTPixelArray( ScummBuffer, 0, 0, 320, &rp, ScummColors, 0, 0, 320, 200, CTABFMT_XRGB8 );
}
else
! (*ScummScaler)( 0, 0, 320, 200 );
if( ScummScreen )
--- 1408,1439 ----
if( ScummDepth == 8 )
! WritePixelArray( ScummBuffer, 0, 0, 320, &rp, 0, ScummShakePos, 320, 200, RECTFMT_LUT8 );
else
! WriteLUTPixelArray( ScummBuffer, 0, 0, 320, &rp, ScummColors, 0, ScummShakePos, 320, 200, CTABFMT_XRGB8 );
}
else
! {
! uint32 src_y = 0;
! uint32 dest_y = 0;
! if( ScummShakePos < 0 )
! src_y = -ScummShakePos;
! else
! dest_y = ScummShakePos;
! (*ScummScaler)( 0, src_y, 0, dest_y, 320, 200-src_y-dest_y );
! }
!
! /* Account for shaking (blacken rest of screen) */
! if( ScummShakePos )
! {
! struct RastPort rp;
!
! InitRastPort( &rp );
! rp.BitMap = ScummRenderTo;
!
! if( ScummShakePos < 0 )
! FillPixelArray( &rp, 0, 199 << ScummScale, ScummScrWidth, -ScummShakePos << ScummScale, 0 );
! else
! FillPixelArray( &rp, 0, 0, ScummScrWidth, ScummShakePos << ScummScale, 0 );
! }
if( ScummScreen )
***************
*** 1508,1513 ****
if( visible )
{
- ydraw += current_shake_pos;
-
dst = (byte*)ScummBuffer + ydraw*320 + xdraw;
bak = old_backup;
--- 1482,1485 ----
***************
*** 1679,1688 ****
}
! static void ReadToolTypes( STRPTR OfFile )
{
struct DiskObject *dobj;
char *ToolValue;
! dobj = GetDiskObject( OfFile );
if( dobj == NULL )
return;
--- 1651,1664 ----
}
! static void ReadToolTypes( struct WBArg *OfFile )
{
struct DiskObject *dobj;
char *ToolValue;
+ char IconPath[ 256 ];
! NameFromLock( OfFile->wa_Lock, IconPath, 256 );
! AddPart( IconPath, OfFile->wa_Name, 256 );
!
! dobj = GetDiskObject( IconPath );
if( dobj == NULL )
return;
***************
*** 1841,1848 ****
{
/* We've been started from Workbench */
! ReadToolTypes( (char *)_WBenchMsg->sm_ArgList[ 0 ].wa_Name );
if( _WBenchMsg->sm_NumArgs > 1 )
{
! ReadToolTypes( (char *)_WBenchMsg->sm_ArgList[ 1 ].wa_Name );
OrigDirLock = CurrentDir( _WBenchMsg->sm_ArgList[ 1 ].wa_Lock );
}
--- 1817,1824 ----
{
/* We've been started from Workbench */
! ReadToolTypes( &_WBenchMsg->sm_ArgList[ 0 ] );
if( _WBenchMsg->sm_NumArgs > 1 )
{
! ReadToolTypes( &_WBenchMsg->sm_ArgList[ 1 ] );
OrigDirLock = CurrentDir( _WBenchMsg->sm_ArgList[ 1 ].wa_Lock );
}
More information about the Scummvm-git-logs
mailing list