home *** CD-ROM | disk | FTP | other *** search
- /*
- * FILE: dualpf.c
- * Support routines for converting a single-playfield Intuition screen
- * into a dual-playfield screen and back.
- *
- * Public Domain, but keep my name in it as the original author.
- * 31-Aug-88 Jan Sven Trabandt first release version
- */
-
-
- #include "gimmelib/gimmefuncs.h"
-
-
- short makeDualPlayfield( screen, ri, reldepth )
- struct Screen *screen;
- struct RasInfo *ri;
- SHORT reldepth;
- {
- SHORT depth;
-
- #ifdef GIMME_WIMPY
- if( !screen ) {
- return( -1 );
- }
- #endif
- if( (screen->ViewPort.Modes & DUALPF)
- || reldepth < -1 || reldepth > 0 || screen->BitMap.Depth > 3 ) {
- return( -1 );
- }
- depth = screen->BitMap.Depth + reldepth;
- if( depth > 3 ) {
- return( -1 );
- }
- ri->BitMap = gimmeBitMap( depth, screen->Width, screen->Height );
- if( !ri->BitMap ) {
- return( -1 );
- }
- ri->Next = NULL;
- ri->RxOffset = 0;
- ri->RyOffset = 0;
- Forbid();
- screen->ViewPort.RasInfo->Next = ri;
- screen->ViewPort.Modes |= DUALPF;
- Permit();
- MakeScreen( screen );
- RethinkDisplay();
- return( 0 );
- } /* makeDualPlayfield */
-
-
- short unmakeDualPlayfield( screen )
- struct Screen *screen;
- {
- struct RasInfo *ri;
- struct BitMap *bm;
-
- #ifdef GIMME_WIMPY
- if( !screen ) {
- return( -1 );
- }
- #endif
- if( !(screen->ViewPort.Modes & DUALPF) ) {
- return( -1 );
- }
- Forbid();
- ri = screen->ViewPort.RasInfo->Next;
- bm = ri->BitMap;
- ri->BitMap = NULL;
- screen->ViewPort.RasInfo->Next = NULL;
- screen->ViewPort.Modes &= ~(DUALPF | PFBA);
- Permit();
- MakeScreen( screen );
- RethinkDisplay();
- if( bm ) {
- getRidOfBitMap( bm );
- }
- return( 0 );
- } /* unmakeDualPlayfield */
-