home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
-
- TITLE: sptweak.c
-
- ****************************************************************************/
-
- #include <stdio.h>
- #include <malloc.h>
- #include <conio.h>
-
- #include <dos.h>
- #include <fcntl.h>
- #include "tweak.h" /* Fabco's animation kit header declarations */
-
-
- /***************************************************************************
-
- VARIOUS DEFINITIONS
-
- ****************************************************************************/
-
- #pragma pack(1)
-
- typedef unsigned char uc;
- typedef unsigned int ui;
- typedef unsigned long ul;
-
- /***************************************************************************
- Mouse stuff
- ****************************************************************************/
- #define MO_LEFT 1 /* Mouse left button */
- #define MO_RIGHT 2 /* Mouse right button */
-
- typedef struct mcb /* Mouse control block structure */
- {
- int exists, /* TRUE if MOUSE exists */
- nbuts, /* number of buttons */
- bstat, /* button status */
- nclik, /* number of clicks */
- col, /* position - column */
- row, /* position - row */
- hmove, /* net horizontal movement */
- vmove; /* net vertical movement */
- char *handle; /* my own id */
- } MOUSE, *MOUSEPTR;
-
- /***************************************************************************
- EXTERNAL DECLARATIONS
- ***************************************************************************/
-
-
-
- /***************************************************************************
- GLOBAL DATA
- ***************************************************************************/
- ui min_x=0, min_y=0, max_x=319, max_y=199;
-
- MOUSEPTR m; /* mouse stuff */
-
- /***************************************************************************/
- void do_background( char huge *buffer_start )
- {
- move_backgnd( buffer_start);
-
- }
-
-
- /* Since there is not enough memory for codeview and the background */
- /* at the same time, you can rename this function and disable */
- /* the BACKGND define to get a solid color background working */
- /* with codeview. This only works with the first method since */
- /* the erase has to restore from the background buffer which is */
- /* the big memory hog. */
-
- void do_background1( void) /* solid color backgnd */
- {
- fill_rectangle(0,0,319,199,14);
- }
-
-
-
-
-
-
-
-
- /****************************************************************************
-
- MAIN( int ARGC, uc *ARGV[] )
-
- Just some kluge code to exercise the assembler rectangle routines.
-
- The Program allocates memory, reads in a background and sprite file,
- and uses a simple for next loop to animate the sprites,
- then it frees up memory, and exits.
-
- One animation method, (not used), redraws the background on every
- frame. Useful in case the background is to be
- scrolled or something.
-
- Then there's the draw/erase cycle.
- This just erases where the sprite has been,
- and draws the sprite in a new location on the unseen page,
- then switches pages to reveal the new sprite suddenly in place.
- Etc Etc.
-
- ****************************************************************************/
-
- main( int argc, uc *argv[] ) /* just in case we want to pass in a filename */
- {
-
- ui _dos_open(); /* file stuff */
- ui _dos_read();
- ui file_handle;
- ui ammount_read;
-
- char huge* backgnd_ptr; /* storage for the background and sprite */
- char huge* sprite_ptr; /* storage for the starfighter sprite */
- char huge* cursor_ptr; /* storage for cursor */
- char huge* temp1_ptr; /* storage for the save/restore functions */
-
- char huge* temp2_ptr; /* storage for the text sprite */
-
- char huge* sound_ptr; /* storage for the sound file */
- char huge* temp_ptr; /* ptr for the dos read of the sound file */
-
- ul bufflen; /* long int len of sound buff */
- long *tempLen; /* remaining length of sound not yet played */
- ul filesize; /* long int len of file */
- ul i, j; /* misc counters */
- ui x1,y1,x2,y2; /* upper left hand corner of the sprites */
- ui width, height; /* width and heigth of the sprite. */
- ui c_wid, c_hgh; /* width and heigth of the cursor. */
- ui prev_row, prev_col; /* prev coords to erase where we've been */
- int vzoom, hzoom;
- int color;
-
-
-
-
-
- set320by200TweakMode(); /* 320x400x256 tweaked mode */
-
-
-
- /********************************************************/
- m=(MOUSEPTR)mo_reset(); /* turn on the mouse */
-
-
-
-
- #ifndef SCROLL_FROGGY_SCREEN
-
- if ( (backgnd_ptr = (char huge *)halloc( (65535*4), 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for background.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("froggy.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open background. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, backgnd_ptr, 10, &ammount_read); /* throw away the header */
- _dos_read( file_handle, backgnd_ptr, 768, &ammount_read); /* load pallette */
- set_palette(backgnd_ptr);
-
- /* read the background 64k at a whack */
- _dos_read( file_handle, backgnd_ptr, 65535, &ammount_read);
- _dos_read( file_handle, (backgnd_ptr+ 65536), 65535, &ammount_read);
- _dos_read( file_handle, (backgnd_ptr+ 131072), 65535, &ammount_read);
- _dos_read( file_handle, (backgnd_ptr+ 196608), 65535, &ammount_read);
- _dos_close(file_handle);
- }
- for (x1=0,y1=0; x1<320; x1+=4 )
- {
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- }
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
-
- for (x1=320,y1=0; y1<200; y1+=1 )
- {
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- }
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
-
- for (x1=320,y1=200; x1>4; x1-=4 )
- {
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- }
- scroll_screen( x1,y1, 0,0, 320,200, backgnd_ptr, 640, 64001);
- switch_pages_poll();
-
- for (x1=0,y1=200; y1>0; y1-=1 )
- {
- scroll_screen( x1,y1, 0,0, 320,200, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- }
- scroll_screen( x1,y1, 0,0, 320,200, backgnd_ptr, 640, 64001);
- switch_pages_poll();
-
- for (x1=0,y1=0; x1<320; x1+=4, y1+=1 )
- {
- scroll_screen( x1,y1, 0,0, 320,200, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- scroll_screen( x1,y1, 0,0, 320,200, backgnd_ptr, 640, 64001);
- switch_pages_poll();
- }
- scroll_screen( x1,y1, 0,0, 319,199, backgnd_ptr, 640, 64001);
- switch_pages_poll();
-
-
-
- #ifndef SCROLL_TEXT
- if ( (temp2_ptr = (char huge *)halloc( (65535), 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for text.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("fabco.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open fabco.twk. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, temp2_ptr, 10, &ammount_read); /* throw away the header */
- _dos_read( file_handle, temp2_ptr, 768, &ammount_read); /* load pallette */
-
- /* read the background 64k at a whack */
- _dos_read( file_handle, temp2_ptr, 65535, &ammount_read);
- _dos_close(file_handle);
-
-
- prev_row = 0;
- prev_col = 0;
- for (x1=0,y1=0; y1<100; y1+=1 )
- {
- scroll_screen( 0,0, 0,0, 320,200, backgnd_ptr, 640, 64001);
- scroll_sprite( x1,y1, 40,0, 180,100, temp2_ptr, 320, 16000);
- switch_pages_poll();
- }
- scroll_screen( 0,0, 0,0, 320,200, backgnd_ptr, 640, 64001);
- scroll_sprite( x1,y1, 40,0, 180,100, temp2_ptr, 320, 16000);
- switch_pages_poll();
- }
-
-
- #endif
-
- hfree(temp2_ptr); /* free text buffer */
- hfree(backgnd_ptr);
-
-
- for (i=1; i< 900000; i++)
- ; /* Delay if needed */
-
-
-
- fill_rectangle(0,0,320,200,0); /* clear screen */
- switch_pages_poll();
- fill_rectangle(0,0,320,200,0); /* clear screen */
-
-
- #endif /* end of frog screen scroll stuff */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifndef DRAW_ERASE_SPRITE
- if ( (backgnd_ptr = (char huge *)halloc( (65535), 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for background.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("bkgnd.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open background. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, backgnd_ptr, 10, &ammount_read); /* throw away the header */
- _dos_read( file_handle, backgnd_ptr, 768, &ammount_read); /* load pallette */
- set_palette(backgnd_ptr);
-
- /* read the background 64k at a whack */
- _dos_read( file_handle, backgnd_ptr, 65535, &ammount_read);
- _dos_close(file_handle);
- }
-
- /* Sprite1 */
- if ( (sprite_ptr = (char huge *)halloc( 65535, 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for sprite.\n" );
- exit( 2 );
- }
-
- /* Cursor */
- if ( (cursor_ptr = (char huge *)halloc( 1024, 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for cursor.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("sp.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open sprite. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, sprite_ptr, 10, &ammount_read); /* header */
- width = (int) *(sprite_ptr + 4);
- height = (int) *(sprite_ptr + 6);
-
- _dos_read( file_handle, sprite_ptr, 768, &ammount_read);
- _dos_read( file_handle, sprite_ptr, 65535, &ammount_read);
- _dos_close(file_handle);
- }
-
- if ( _dos_open("cursor.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open cursor. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, cursor_ptr, 10, &ammount_read); /* header */
- c_wid = (int) *(cursor_ptr + 4);
- c_hgh = (int) *(cursor_ptr + 6);
-
- _dos_read( file_handle, cursor_ptr, 768, &ammount_read);
- _dos_read( file_handle, cursor_ptr, 1024, &ammount_read);
- _dos_close(file_handle);
- }
-
- if ( (temp2_ptr = (char huge *)halloc( (65535), 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for text.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("fabco.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open fabco.twk. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, temp2_ptr, 10, &ammount_read); /* throw away the header */
- _dos_read( file_handle, temp2_ptr, 768, &ammount_read); /* load pallette */
-
- /* read the background 64k at a whack */
- _dos_read( file_handle, temp2_ptr, 65535, &ammount_read);
- _dos_close(file_handle);
- }
-
-
- /* load the sound file */
- filesize = (65535*3);
- if ( (sound_ptr = (char huge *)halloc( filesize, 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for sound.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("zz_top.spl", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open sound file. \n" );
- exit( 2 );
- }
- else
- {
- /* throw away the header */
- _dos_read( file_handle, sound_ptr, 26, &ammount_read);
-
- /* read the rest of the sound file 64k at a whack */
- temp_ptr=sound_ptr;
- bufflen=0;
- while (bufflen < (filesize-27) )
- {
- _dos_read( file_handle, temp_ptr, 65535, &ammount_read);
- temp_ptr+=65535;
- bufflen+=ammount_read;
- }
-
- _dos_close(file_handle);
- }
-
-
-
- do_background(backgnd_ptr); /* background on page1 */
- switch_pages_poll();
- do_background(backgnd_ptr); /* background on page2 */
-
- init_speaker_port();
- IRQ0_install(); /* initialize sound interrupt */
-
- /* sound plays in background on return */
- tempLen = play_sound_IRQ0(sound_ptr, bufflen, 77);
-
- prev_row = 0;
- prev_col = 0;
- for (x1=250,y1=150; y1>10; x1-=1,y1-=1) /* next sprite */
- {
- erase_sprite( prev_col, prev_row, width, height, backgnd_ptr );
- draw_sprite( x1,y1, width, height, sprite_ptr);
- switch_pages_poll();
- erase_sprite( prev_col, prev_row, width, height, backgnd_ptr );
- draw_sprite( x1,y1, width, height, sprite_ptr);
- switch_pages_poll();
- prev_row = y1;
- prev_col = x1;
- }
-
-
- #ifndef SCROLL_WINDOW
- color = 3;
- for (x1=29,y1=29; x1<=150; x1+=1) /* window boarder on page 1 */
- write_pixel_twk(x1, y1, color);
- for (x1=29,y1=130; x1<=150; x1+=1)
- write_pixel_twk(x1, y1, color);
- for (x1=150,y1=29; y1<=130; y1+=1)
- write_pixel_twk(x1, y1, color);
- for (x1=29,y1=29; y1<=130; y1+=1)
- write_pixel_twk(x1, y1, color);
-
- switch_pages_poll();
-
- for (x1=29,y1=29; x1<=150; x1+=1) /* window boarder on page 2 */
- write_pixel_twk(x1, y1, color);
- for (x1=29,y1=130; x1<=150; x1+=1)
- write_pixel_twk(x1, y1, color);
- for (x1=150,y1=29; y1<=130; y1+=1)
- write_pixel_twk(x1, y1, color);
- for (x1=29,y1=29; y1<=130; y1+=1)
- write_pixel_twk(x1, y1, color);
-
-
- for (x1=200; x1>10; x1-=1) /* next sprite */
- {
- scroll_window( x1,90, 30,30, 120,100, backgnd_ptr);
- switch_pages_poll();
- #ifdef DELAY
- for (i=1; i< 9000; i++)
- ; /* Delay if needed */
- #endif
- }
- scroll_window( x1,90, 30,30, 120,100, backgnd_ptr);
- switch_pages_poll();
-
- do_background(backgnd_ptr); /* background on page1 */
- switch_pages_poll();
- do_background(backgnd_ptr); /* background on page2 */
- switch_pages_poll();
-
- #endif
-
- #ifdef SCROLL_ZOOM_WINDOW
- scroll_zoom_window( 200,90, 30,30, 120,100, backgnd_ptr, 1,1);
- switch_pages_poll();
- getchar();
- scroll_zoom_window( 200,90, 30,30, 120,100, backgnd_ptr, 1,2);
- switch_pages_poll();
- getchar();
- scroll_zoom_window( 200,90, 30,30, 120,100, backgnd_ptr, 2,1);
- switch_pages_poll();
- getchar();
- scroll_zoom_window( 200,90, 30,30, 120,100, backgnd_ptr, 2,2);
- switch_pages_poll();
- getchar();
- scroll_zoom_window( 200,90, 30,30, 120,100, backgnd_ptr, 4,4);
- switch_pages_poll();
- #endif
-
- #ifdef FATBIT_OUT
- fatbit_out( 200,90, 30,30, 120,100, backgnd_ptr, 1,1);
- switch_pages_poll();
- getchar();
- fatbit_out( 200,90, 30,30, 120,100, backgnd_ptr, 2,2);
- switch_pages_poll();
- getchar();
- fatbit_out( 200,90, 30,30, 120,100, backgnd_ptr, 3,3);
- switch_pages_poll();
- getchar();
- fatbit_out( 200,90, 30,30, 120,100, backgnd_ptr, 4,4);
- switch_pages_poll();
- getchar();
- fatbit_out( 200,90, 30,30, 120,100, backgnd_ptr, 5,5);
- switch_pages_poll();
- #endif
-
- #ifndef FADE_ZOOM_OUT
- scroll_zoom_window( 200,90, 30,30, 96,100, backgnd_ptr, 1,1);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 215,95, 30,30, 96,100, backgnd_ptr, 2,2);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 225,100, 30,30, 96,100, backgnd_ptr, 3,3);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 230,102, 30,30, 96,100, backgnd_ptr, 4,4);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 235,104, 30,30, 96,100, backgnd_ptr, 6,6);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 235,106, 30,30, 96,100, backgnd_ptr, 8,8);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 235,108, 30,30, 96,100, backgnd_ptr, 12,12);
- switch_pages_poll();
- for (i=1; i< 45000; i++) ;
- scroll_zoom_window( 235,110, 30,30, 96,100, backgnd_ptr, 24,24);
- switch_pages_poll();
- for (i=1; i< 100000; i++) ;
- do_background(backgnd_ptr); /* background on page2 */
- switch_pages_poll();
- do_background(backgnd_ptr); /* background on page2 */
- switch_pages_poll();
- #endif
-
-
-
-
- #ifdef SCROLL_ZOOM_WINDOW
- for (x1=220,y1=100, vzoom=1, hzoom=1; x1>10; x1-=1,y1+=0 ) /* next sprite */
- {
- if (x1 == 210)
- hzoom = vzoom = 2;
- if (x1 == 60)
- hzoom = vzoom = 3;
- if (x1 == 50)
- hzoom = vzoom = 4;
- scroll_zoom_window( x1,y1, 30,30, 96,96, backgnd_ptr, vzoom, hzoom);
- scroll_zoom_window( x1,0, 200,40, 96,96, backgnd_ptr, vzoom, hzoom);
- switch_pages_poll();
- }
- scroll_zoom_window( x1,y1, 30,30, 96,96, backgnd_ptr, vzoom, hzoom);
- scroll_zoom_window( x1,0, 200,40, 96,96, backgnd_ptr, vzoom, hzoom);
- switch_pages_poll();
- do_background(backgnd_ptr); /* background on page2 */
- switch_pages_poll();
- do_background(backgnd_ptr); /* background on page2 */
- switch_pages_poll();
-
- #endif
-
-
-
-
- #ifndef MOUSE
-
- prev_row = 0;
- prev_col = 0;
- for (x1=100,y1=10; x1<200; x1+=1 )
- {
- scroll_screen( 80,150, 80,150, 140,50, backgnd_ptr, 320, 16000);
- scroll_sprite( x1,y1, 80,150, 140,50, temp2_ptr, 320, 16000);
- switch_pages_poll();
- }
- scroll_screen( 80,150, 80,150, 140,50, backgnd_ptr, 320, 16000);
- scroll_sprite( x1,y1, 80,150, 140,50, temp2_ptr, 320, 16000);
- switch_pages_poll();
- scroll_screen( 80,150, 80,150, 140,50, backgnd_ptr, 320, 16000);
- scroll_sprite( x1,y1, 80,150, 140,50, temp2_ptr, 320, 16000);
-
- mo_pos(m);
- prev_col = m->col/2; /* convert 640w mouse to 320w screen */
- prev_row = m->row;
-
- while(1)
- {
- mo_pos(m);
- if (m->bstat==MO_LEFT)
- {
- #ifdef HOT_SPOT
- /* determine the hot area where the mouse button was pressed */
- /* and restrict the mouse to this area */
- if (m->col/2 > 50 && m->col/2 < 100 && m->row > 50 && m->row < 100 )
- {
- mo_clim(m, m->col, m->col );
- mo_rlim(m, m->row-20, m->row+20);
- }
- #endif
-
- erase_sprite( prev_col, prev_row, width, height, backgnd_ptr );
- draw_sprite ( m->col/2, m->row, width, height, sprite_ptr);
- draw_sprite( m->col/2, m->row, c_wid, c_hgh, cursor_ptr );
- switch_pages_poll();
-
- erase_sprite( prev_col, prev_row, width, height, backgnd_ptr );
- draw_sprite ( m->col/2, m->row, width, height, sprite_ptr);
- draw_sprite( m->col/2, m->row, c_wid, c_hgh, cursor_ptr );
- switch_pages_poll();
-
- prev_col = m->col/2; /* convert 640w mouse to 320w screen */
- prev_row = m->row;
-
- }
- else if (m->bstat==MO_RIGHT)
- {
- break;
- }
- else if (m->bstat==3)
- {
- /* release the mouse from restricted movement */
- mo_clim(m, 0, 639);
- mo_rlim(m, 0, 199);
- }
- }
- #endif
-
- #ifdef PAUSE
- /* screen save/restore buffer */
- if ( (temp1_ptr = (char huge *)halloc( 65535, 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for get/put.\n" );
- exit( 2 );
- }
- get_rectangle( 100, 100, 40, 40, temp1_ptr );
- fill_rectangle( 100, 100, 40, 40, 14 );
- switch_pages_poll();
- getchar();
- put_rectangle( 100, 100, 40, 40, temp1_ptr );
- switch_pages_poll();
- getchar();
- put_rectangle( 100, 100, 40, 40, temp1_ptr );
- switch_pages_poll();
- getchar();
- #endif
-
-
- hfree(sound_ptr); /* free up memory and exit. */
- hfree(temp2_ptr);
- hfree(cursor_ptr);
- hfree(sprite_ptr); /* free up memory and exit. */
- hfree(backgnd_ptr);
-
- IRQ0_remove();
- restore_ports(); /* cleanup after sound interrupt */
-
- fill_rectangle(0,0,320,200,0); /* clear screen */
- switch_pages_poll();
- fill_rectangle(0,0,320,200,0); /* clear screen */
-
-
- #endif /* end of starwars stuff */
-
-
-
-
-
-
-
-
-
-
-
- #ifdef BITBLT
- for (y1=0; y1<15; y1+=5)
- {
- for (x1=0; x1<310; x1+=1)
- {
- fill_rectangle ( x1, y1, width, height, x1);
- switch_pages_poll();
- #ifdef DELAY
- for (i=1; i< 3000; i++)
- ; /* Delay if needed */
- #endif
- fill_rectangle ( x1, y1, width, height, x1);
- switch_pages_poll();
- #ifdef DELAY
- for (i=1; i< 3000; i++)
- ; /* Delay if needed */
- #endif
- }
- }
- #endif
-
-
-
-
-
-
-
- #ifndef POOH
-
- if ( (backgnd_ptr = (char huge *)halloc( (65535), 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for background.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("poohbk.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open background. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, backgnd_ptr, 10, &ammount_read); /* throw away the header */
- _dos_read( file_handle, backgnd_ptr, 768, &ammount_read); /* load pallette */
- set_palette(backgnd_ptr);
-
- /* read the background 64k at a whack */
- _dos_read( file_handle, backgnd_ptr, 65535, &ammount_read);
- _dos_close(file_handle);
- }
-
- /* Sprite1 */
- if ( (sprite_ptr = (char huge *)halloc( 65535, 1 )) == NULL )
- {
- set_mode( 3 );
- printf( "\nMemory allocation error for sprite.\n" );
- exit( 2 );
- }
-
- if ( _dos_open("poohsp.twk", O_RDONLY, &file_handle) )
- {
- set_mode( 3 );
- printf("\nUnable to open sprite. \n" );
- exit( 2 );
- }
- else
- {
- _dos_read( file_handle, sprite_ptr, 10, &ammount_read); /* header */
- width = (ui) *(sprite_ptr + 4);
- height = (ui) *(sprite_ptr + 6);
- height &= 0x00ff;
-
- _dos_read( file_handle, sprite_ptr, 768, &ammount_read);
- _dos_read( file_handle, sprite_ptr, 65535, &ammount_read);
- _dos_close(file_handle);
- }
-
-
-
- do_background(backgnd_ptr); /* background on page1 */
- switch_pages_poll();
- do_background(backgnd_ptr); /* background on page2 */
-
- prev_row = 0;
- prev_col = 0;
- for (x1=250,y1=150; y1>10; x1-=1,y1-=1) /* next sprite */
- {
- erase_sprite( prev_col, prev_row, width, height, backgnd_ptr );
- draw_sprite( x1,y1, width, height, sprite_ptr);
- switch_pages_poll();
- erase_sprite( prev_col, prev_row, width, height, backgnd_ptr );
- draw_sprite( x1,y1, width, height, sprite_ptr);
- switch_pages_poll();
- prev_row = y1;
- prev_col = x1;
- }
-
-
- for (i=1; i< 900000; i++)
- ; /* Delay if needed */
-
-
- #endif /* end pooh stuff */
-
-
- /* getchar();*/
-
-
- set_mode( 3 );
-
- printf("\n Copyright (C) 1991 Fabco \n");
- printf("\n EXE file made with: Fabco's ");
- printf("\n Animation/Graphics/Multi-media ");
- printf("\n Toolkit ");
- printf("\n ");
- printf("\n available from: James Faubus ");
- printf("\n Rt.1, Box 37 ");
- printf("\n Godley, Texas 76044");
- printf("\n");
-
-
- exit(0);
- }