Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. void TileCopy(TileDataStuff* src, TileDataStuff* dst){
  2.     int srcForm=0;
  3.     int dstForm=0;
  4.     int dstX;
  5.     int dstY;
  6.     int srcX;
  7.     int srcY;
  8.     MyRect CheckRect;
  9.     for(dstX=0; dstX<dst->Width();dstX++ ){
  10.         for(dstY=0; dstY<dst->Height();dstY++ ){
  11.             for(srcX =0; srcX<src->Width();srcX++){
  12.                 for(srcY =0; srcY<src->Height();srcY++){
  13.            
  14.                     //Form a new rect to make sure it doesn't go out of bounds
  15.                     int FinalSrcX=src->X()+srcX;
  16.                     int FinalSrcY=src->Y()+srcY;
  17.                     int FinalDstX=dst->X()+srcX+dstX;
  18.                     int FinalDstY=dst->Y()+srcY+dstY;
  19.  
  20.                     if(FinalDstY<0 || FinalDstY> dst->Y() + dst->Height()) break;
  21.                     if(FinalDstX<0 || FinalDstX> dst->X() + dst->Width()) break;
  22.                     dstForm=()*TILEWIDTH + (dst->Y()+srcY+dstY);
  23.                     srcForm=(FinalSrcX)*TILEWIDTH+FinalSrcY;
  24.                     dst[dstForm]=src[srcForm];
  25.                 }
  26.             }
  27.  
  28.             dstX+=src->Width();
  29.             dstY+=src->Height();
  30.         }
  31.     }    
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement