Advertisement
ZoriaRPG

ScreenToBitmap(int bitmap, bool layer0trans)

Mar 23rd, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. int ScreenToBitmap(int bitmapID, bool layer0trans){
  2.     int q[4]; //array for loops, 0 is layer, 1 is combo pos.
  3.     int x; int y; //grid positions for combos to bitmap.
  4.     int cmb; int cset; int cmbx; int cmby;
  5.    
  6.     Screen_>SetRenderTarget(bitmapID);
  7.     //Clear the bitmap to BLACK.
  8.     Screen->Rectangle(0, 0, 0, BITMAP_RIGHT, BITMAP_LEFT, 0x0F, //black
  9.                 100, 0, 0, 0, true, OP_OPAQUE);
  10.    
  11.    
  12.     for ( q[0] = 0; q[0] <= 6; q++ ) {
  13.         x = 0; y = 0;
  14.         for ( q[1] = 0; q[1] < 176; q[1] ++ ) {
  15.             cmb = GetLayerComboD(q[0], q[1]);
  16.             cset = GetLayerComboC(q[0], q[1]);
  17.            
  18.             //Because drawing combo 0 wastes draws, and is superfluous, we don't do it.
  19.             if ( cmb != 0 ) { //ignore blank combos.
  20.                 cmbx = ComboX(cmb); cmby = ComboY(cmb); //update the x/y.
  21.                 if ( q[0] == 0 ) { //layer 0
  22.                     //draw the combo to the bitmap, using the opacity arg param.
  23.                     DrawCombo(q[0], cmbx, cmby, cmb, 1, 1, cset, -1, -1, 0, 0, 0, 0, 0, layer0trans, OP_OPAQUE);
  24.                 }
  25.                 else { 
  26.                     //not layer 0, so use trans pixels.
  27.                     DrawCombo(q[0], cmbx, cmby, cmb, 1, 1, cset, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE);
  28.                 }
  29.             }
  30.         }
  31.     }
  32.     Screen->SetRenderTarget(RT_SCREEN);
  33.     return 1; //Return true when done.
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement