//---------------------------------------------------//
/*
 *Copyright Bryce Thorup, William Thorup, BitJag 2014
 *
 * Contact: contact@bitjag.com
 *
 *All content developed by BitJag (graphics & Code) is
 *for your personal use only.  Feel free to burn it to a CD, 
 *flash to a SkunkBoard, or use in an emulator.  We 
 *hope you also take the chance to learn from it if needed.
 * 
 *Do not redistribute, duplicate, charge for "handling" 
 *or cost to print, or charge for profit.
 * 
 *If there is someone you know who wants a copy,
 *physical or digital, please direct them to our website.
 *Any other questions about the use of the demo, please
 *shoot us an email.  We will be liberal, promise.
 *
 * http://bitjag.com/
 * 
 *This demo was developed with the Removers Library,
 *which is used under the LGPL licence 2.1, included
 *with the source.  The Removers library is free to 
 *download and use at this location.
 * 
 * http://removers.free.fr/softs/download.php?lang=en
 *
//---------------------------------------------------*/

#include "tran-inout.h"


int gridInOut( int vertOffset, int horiOffset, int spaceCount, int spaces, int spriteW, int spriteH, screen *srcScreen, screen *trgtScreen, int INorOUT){
  
//Transition out (draw the grid)
if(spaceCount != spaces && INorOUT == 0){

fb2d_copy_straight(srcScreen,trgtScreen,spriteW,spriteH,MODE_TRANSPARENT);

trgtScreen->x += horiOffset; 

    if(trgtScreen->x >= 320){
      
    trgtScreen->x = 0;
      
    trgtScreen->y = trgtScreen->y + vertOffset; 
	
    }
  
}



//Transition in (clear the grid)
if(spaceCount != spaces && INorOUT == 1){
  
  fb2d_copy_straight(srcScreen,trgtScreen,spriteW,spriteH,MODE_ZERO);
  
  trgtScreen->x = trgtScreen->x - horiOffset; 
      
      if(trgtScreen->x <= -20){
	
      trgtScreen->x = 300;
	
      trgtScreen->y = trgtScreen->y - vertOffset; 
	
      }
  
}
	  
}

