home *** CD-ROM | disk | FTP | other *** search
- #include "amscrolr.h"
- #include "gfx.h"
-
- int TerrainList[]=
- {
- TERRAIN1, TERRAIN2, TERRAIN3, TERRAIN4, TERRAIN5, TERRAIN6, TERRAIN7,
- TERRAIN8, TERRAIN9, TERRAIN10, TERRAIN11, TERRAIN12, TERRAIN13, TERRAIN14
- };
-
- AlphaMissionScroller::AlphaMissionScroller()
- {
- wrap=wrapping=NO;
- WrapY=0;
- SetPixelIncrement( 2 );
- SetWorldWidthHeight( 320, 2800 );
- SetScreenWidthHeight( 320, 200 );
- SetImageWidthHeight( 320, 200 );
- SetAtSouthMost();
- image=TerrainList;
- NumImages=14;
- }
-
- void AlphaMissionScroller::initialize()
- {
- load_gfxlib( "ss.gfx" );
- }
-
- void AlphaMissionScroller::draw(void)
- {
- if ( AtMost( NORTH )==YES && wrapping==NO )
- wrapping=YES, WrapY=PixelIncrement;
- if ( wrapping )
- {
- show_clipped_image( 0, -(ScreenHeight-WrapY), image[NumImages-1] );
- show_clipped_image( 0, WrapY, image[0] );
- WrapY+=PixelIncrement;
- if ( WrapY>=ScreenHeight )
- {
- wrapping=NO;
- y=WorldHeight-ScreenHeight;
- }
- }
- else
- {
- // figure the index to the image
- int yIndex=y/ImageHeight;
- // figure the remainder of pixels
- int yRemainder=y%ImageHeight;
- // figure number of images to draw
- int vImages=(ScreenHeight+yRemainder)/ImageHeight;
- vImages+=((ScreenHeight+yRemainder)%ImageHeight)!=0 ? 1:0;
- // draw them
- int dy=0-yRemainder;
- for( int i=0; i<vImages; i++ )
- {
- show_clipped_image( 0, dy, image[yIndex+i] );
- dy+=ImageHeight;
- }
- }
- }