Advertisement
ZoriaRPG

do_bitmapexr()

Sep 18th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 38.36 KB | None | 0 0
  1. //Draw]()
  2. void do_drawbitmapexr(BITMAP *bmp, int *sdci, int xoffset, int yoffset)
  3. {
  4.     /*
  5.     //sdci[1]=layer
  6.     //sdci[2]=bitmap
  7.     //sdci[3]=sourcex
  8.     //sdci[4]=sourcey
  9.     //sdci[5]=sourcew
  10.     //sdci[6]=sourceh
  11.     //sdci[7]=destx
  12.     //sdci[8]=desty
  13.     //sdci[9]=destw
  14.     //sdci[10]=desth
  15.     //sdci[11]=rotation/angle
  16.     //scdi[12] = pivot cx
  17.     //sdci[13] = pivot cy
  18.     //scdi[14] = effect flags
  19.    
  20.        
  21.         const int BITDX_NORMAL = 0;
  22.         const int BITDX_TRANS = 1; //Translucent
  23.         const int BITDX_PIVOT = 2; //THe sprite will rotate at a specific point, instead of its centre.
  24.         const int BITDX_HFLIP = 4; //Horizontal Flip
  25.         const int BITDX_VFLIP = 8; //Vertical Flip.
  26.         //Note: Some modes cannot be combined. if a combination is not supported, an error
  27.         //  detailing this will be shown in allegro.log.
  28.        
  29.     //scdi[15] = litcolour
  30.         //The allegro docs are wrong. The params are: rotate_sprite_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  31.         /not rotate_sprite_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  32.    
  33.     //sdci[16]=mask
  34.    
  35.     */
  36.  
  37.     int bitmapIndex = sdci[2]/10000;
  38.     int sx = sdci[3]/10000;
  39.     int sy = sdci[4]/10000;
  40.     int sw = sdci[5]/10000;
  41.     int sh = sdci[6]/10000;
  42.     int dx = sdci[7]/10000;
  43.     int dy = sdci[8]/10000;
  44.     int dw = sdci[9]/10000;
  45.     int dh = sdci[10]/10000;
  46.     float rot = sdci[11]/10000;
  47.     int cx = sdci[12]/10000;
  48.     int cy = sdci[13]/10000;
  49.     int mode = sdci[14]/10000;
  50.     int litcolour = sdci[15]/10000;
  51.     bool masked = (sdci[16] != 0);
  52.    
  53.    
  54.  
  55.     //bugfix
  56.     sx = vbound(sx, 0, 512);
  57.     sy = vbound(sy, 0, 512);
  58.     sw = vbound(sw, 0, 512 - sx); //keep the w/h within range as well
  59.     sh = vbound(sh, 0, 512 - sy);
  60.  
  61.  
  62.     if(sx >= ZScriptDrawingRenderTarget::BitmapWidth || sy >= ZScriptDrawingRenderTarget::BitmapHeight)
  63.     return;
  64.  
  65.     bool stretched = (sw != dw || sh != dh);
  66.  
  67.     BITMAP *sourceBitmap = zscriptDrawingRenderTarget->GetBitmapPtr(bitmapIndex);
  68.    
  69.     if(!sourceBitmap)
  70.     {
  71.         Z_message("Warning: Screen->DrawBitmap(%d) contains invalid data or is not initialized.\n", bitmapIndex);
  72.         Z_message("[Note* Deferred drawing or layering order possibly not set right.]\n");
  73.         return;
  74.     }
  75.    
  76.     BITMAP* subBmp = 0;
  77.    
  78.     /*
  79.     if ( bitmapIndex == -1 ) {
  80.         blit(bmp, sourceBitmap, sx, sy, 0, 0, dw, dh);
  81.     }
  82.     */
  83.    
  84.     if(rot != 0 || mode != 0)    
  85.     {
  86.         subBmp = script_drawing_commands.AquireSubBitmap(dw, dh);
  87.        
  88.         if(!subBmp)
  89.         {
  90.         }
  91.     }
  92.    
  93.    
  94.     dx = dx + xoffset;
  95.     dy = dy + yoffset;
  96.    
  97.     if(stretched) {
  98.         if(masked) {    //stretched and masked
  99.             if ( rot == 0 ) { //if not rotated
  100.                 switch(mode) {
  101.                     case 1:
  102.                     //transparent
  103.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  104.                     draw_trans_sprite(bmp, subBmp, dx, dy);
  105.                     break;
  106.                    
  107.                    
  108.                     case 2:
  109.                         //pivot?
  110.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  111.                     pivot_sprite(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  112.                     //Pivoting requires two more args
  113.                     break;
  114.                    
  115.                     case 3:
  116.                         //pivot + trans
  117.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  118.                     pivot_sprite_trans(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  119.                     break;
  120.                    
  121.                     case 4:
  122.                         //flip v
  123.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  124.                     draw_sprite_v_flip(bmp, subBmp, dx, dy);
  125.                     break;
  126.                    
  127.                     case 5:
  128.                         //trans + v flip
  129.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  130.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_V_FLIP);
  131.                     break;
  132.                    
  133.                     case 6:
  134.                         //pivot + v flip
  135.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  136.                     pivot_sprite_v_flip(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  137.                    
  138.                     case 8:
  139.                         //vlip h
  140.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  141.                     draw_sprite_h_flip(bmp, subBmp, dx, dy);
  142.                     break;
  143.                    
  144.                     case 9:
  145.                         //trans + h flip
  146.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  147.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_H_FLIP);
  148.                     break;
  149.                    
  150.                     case 10:
  151.                         //flip H and pivot
  152.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  153.                     //return error cannot pivot and h flip
  154.                     break;
  155.                    
  156.                     case 12:
  157.                         //vh flip
  158.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  159.                     draw_sprite_vh_flip(bmp, subBmp, dx, dy);
  160.                     break;
  161.                    
  162.                     case 13:
  163.                         //trans + vh flip
  164.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  165.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_VH_FLIP);
  166.                     break;
  167.                    
  168.                     case 14:
  169.                         //pivot and vh flip
  170.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  171.                     //return error cannot both pivot and vh flip
  172.                     break;
  173.                    
  174.                     case 16:
  175.                         //lit
  176.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  177.                     draw_lit_sprite(bmp, subBmp, dx, dy, litcolour);
  178.                     break;
  179.                    
  180.                     case 18:
  181.                         //pivot, lit
  182.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  183.                     pivot_sprite_lit(bmp, subBmp, dx, dy, cx, cy,  degrees_to_fixed(rot),litcolour);
  184.                     break;
  185.                    
  186.                     case 20:
  187.                         //lit + v flip
  188.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  189.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_V_FLIP);
  190.                     break;
  191.                    
  192.                     case 22:
  193.                         //Pivot, vflip, lit
  194.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  195.                     pivot_sprite_v_flip_lit(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot),litcolour);
  196.                     break;
  197.                    
  198.                     case 24:
  199.                         //lit + h flip
  200.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  201.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_H_FLIP);
  202.                     break;
  203.                    
  204.                     case 26:
  205.                         //pivot + lit + hflip
  206.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot, Flip, and Lit.\n", bitmapIndex);
  207.                     //return error cannot pivot, lit, and flip
  208.                     break;
  209.                    
  210.                     case 28:
  211.                         //lit + vh flip
  212.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  213.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_VH_FLIP);
  214.                     break;
  215.                    
  216.                     case 32: //gouraud
  217.                         //Probably not wort supporting.
  218.                     //masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  219.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  220.                     break;
  221.                    
  222.                     case 0:
  223.                         //no effect
  224.                     masked_stretch_blit(sourceBitmap, bmp, sx, sy, sw, sh, dx, dy, dw, dh);
  225.                     break;
  226.                    
  227.                    
  228.                     default:
  229.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  230.                    
  231.                    
  232.                 }
  233.             } //end if not rotated
  234.            
  235.             if ( rot != 0 ) { //if rotated
  236.                 switch(mode){
  237.                     case 1:
  238.                         //transparent
  239.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  240.                     rotate_sprite_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  241.                    
  242.                     break;
  243.                    
  244.                     case 2:
  245.                         //pivot?
  246.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  247.                     //return an error, cannot both rotate and pivot
  248.                     break;
  249.                    
  250.                     case 3:
  251.                         //pivot + trans
  252.                     //return an error, cannot both rotate and pivot
  253.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  254.                     break;
  255.                    
  256.                     case 4:
  257.                         //flip v
  258.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  259.                     rotate_sprite_v_flip(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  260.                     break;
  261.                    
  262.                     case 5:
  263.                         //trans + v flip
  264.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  265.                     rotate_sprite_v_flip_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  266.                     break;
  267.                    
  268.                     case 6:
  269.                         //pivot + v flip
  270.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  271.                     //return an error, cannot both rotate and pivot
  272.                     break;
  273.                    
  274.                     case 8:
  275.                         //flip h
  276.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rorate and H-Flip.\n", bitmapIndex);
  277.                     //return an error, cannot both rotate and flip H
  278.                     break;
  279.                    
  280.                     case 9:
  281.                         //trans + h flip
  282.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot Rotate and Flip a Trans Sprite.\n", bitmapIndex);
  283.                     //return an error, cannot rotate and flip a trans sprite
  284.                     break;
  285.                    
  286.                     case 10:
  287.                         //flip H and pivot
  288.                     //return error cannot pivot and h flip
  289.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  290.                     break;
  291.                    
  292.                     case 12:
  293.                         //vh flip
  294.                     //return an error, cannot rotate and VH flip a trans sprite
  295.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  296.                     break;
  297.                    
  298.                     case 13:
  299.                         //trans + vh flip
  300.                     //return an error, cannot rotate and VH flip a trans sprite
  301.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  302.                     break;
  303.                    
  304.                     case 14:
  305.                         //pivot and vh flip
  306.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  307.                     //return error cannot both pivot and vh flip
  308.                     break;
  309.                    
  310.                     case 16:
  311.                         //lit
  312.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  313.                     rotate_sprite_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  314.                     break;
  315.                    
  316.                     case 18:
  317.                         //pivot, lit
  318.                     //return an error, cannot both rotate and pivot
  319.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  320.                     break;
  321.                    
  322.                     case 20:
  323.                         //lit + vflip
  324.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  325.                     rotate_sprite_v_flip_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  326.                     break;
  327.                    
  328.                     case 22:
  329.                         //Pivot, vflip, lit
  330.                     //return an error, cannot both rotate and pivot
  331.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  332.                     break;
  333.                    
  334.                     case 24:
  335.                         //lit + h flip
  336.                     //return an error, cannot both rotate and H flip
  337.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and H-Flip.\n", bitmapIndex);
  338.                     break;
  339.                    
  340.                     case 26:
  341.                         //pivot + lit + hflip
  342.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Flip a Lit Sprite.\n", bitmapIndex);
  343.                     //return error cannot pivot, lit, and flip
  344.                     break;
  345.                    
  346.                     case 28:
  347.                         //lit + vh flip
  348.                     //return an error, cannot both rotate and VH flip
  349.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  350.                     break;
  351.                    
  352.                     case 32: //gouraud
  353.                         //Probably not wort supporting.
  354.                     //masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  355.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  356.                     break;
  357.                    
  358.                     case 0:
  359.                         //no effect.
  360.                     masked_stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  361.                     rotate_sprite(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  362.                     break;
  363.                    
  364.                     default:
  365.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  366.                
  367.                 }
  368.             }
  369.         } //end if stretched and masked
  370.        
  371.         else { //stretched, not masked
  372.            
  373.        
  374.             if ( rot == 0 ) { //if not rotated
  375.                 switch(mode) {
  376.                     case 1:
  377.                     //transparent
  378.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  379.                     draw_trans_sprite(bmp, subBmp, dx, dy);
  380.                     break;
  381.                    
  382.                    
  383.                     case 2:
  384.                         //pivot?
  385.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  386.                     pivot_sprite(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  387.                     //Pivoting requires two more args
  388.                     break;
  389.                    
  390.                     case 3:
  391.                         //pivot + trans
  392.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  393.                     pivot_sprite_trans(bmp, subBmp, dx,dy,  cx,  cy, degrees_to_fixed(rot));
  394.                     break;
  395.                    
  396.                     case 4:
  397.                         //flip v
  398.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  399.                     draw_sprite_v_flip(bmp, subBmp, dx, dy);
  400.                     break;
  401.                    
  402.                     case 5:
  403.                         //trans + v flip
  404.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  405.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_V_FLIP);
  406.                     break;
  407.                    
  408.                     case 6:
  409.                         //pivot + v flip
  410.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  411.                     pivot_sprite_v_flip(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  412.                    
  413.                     case 8:
  414.                         //vlip h
  415.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  416.                     draw_sprite_h_flip(bmp, subBmp, dx, dy);
  417.                     break;
  418.                    
  419.                     case 9:
  420.                         //trans + h flip
  421.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  422.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_H_FLIP);
  423.                     break;
  424.                    
  425.                     case 10:
  426.                         //flip H and pivot
  427.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  428.                     //return error cannot pivot and h flip
  429.                     break;
  430.                    
  431.                     case 12:
  432.                         //vh flip
  433.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  434.                     draw_sprite_vh_flip(bmp, subBmp, dx, dy);
  435.                     break;
  436.                    
  437.                     case 13:
  438.                         //trans + vh flip
  439.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  440.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_VH_FLIP);
  441.                     break;
  442.                    
  443.                     case 14:
  444.                         //pivot and vh flip
  445.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  446.                     //return error cannot both pivot and vh flip
  447.                     break;
  448.                    
  449.                     case 16:
  450.                         //lit
  451.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  452.                     draw_lit_sprite(bmp, subBmp, dx, dy, litcolour);
  453.                     break;
  454.                    
  455.                     case 18:
  456.                         //pivot, lit
  457.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  458.                     pivot_sprite_lit(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot),litcolour);
  459.                     break;
  460.                    
  461.                     case 20:
  462.                         //lit + v flip
  463.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  464.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_V_FLIP);
  465.                     break;
  466.                    
  467.                     case 22:
  468.                         //Pivot, vflip, lit
  469.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  470.                     pivot_sprite_v_flip_lit(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot),litcolour);
  471.                     break;
  472.                    
  473.                     case 24:
  474.                         //lit + h flip
  475.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  476.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_H_FLIP);
  477.                     break;
  478.                    
  479.                     case 26:
  480.                         //pivot + lit + hflip
  481.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot, Flip, and Lit.\n", bitmapIndex);
  482.                     //return error cannot pivot, lit, and flip
  483.                     break;
  484.                    
  485.                     case 28:
  486.                         //lit + vh flip
  487.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  488.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_VH_FLIP);
  489.                     break;
  490.                    
  491.                     case 32: //gouraud
  492.                         //Probably not wort supporting.
  493.                     //stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  494.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  495.                     break;
  496.                    
  497.                     case 0:
  498.                         //no effect
  499.                     stretch_blit(sourceBitmap, bmp, sx, sy, sw, sh, dx, dy, dw, dh);
  500.                     break;
  501.                    
  502.                    
  503.                     default:
  504.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  505.                    
  506.                    
  507.                 }
  508.             } //end if not rotated
  509.            
  510.             if ( rot != 0 ) { //if rotated
  511.                 switch(mode){
  512.                     case 1:
  513.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);//transparent
  514.                     rotate_sprite_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  515.                    
  516.                     break;
  517.                    
  518.                     case 2:
  519.                         //pivot?
  520.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  521.                     //return an error, cannot both rotate and pivot
  522.                     break;
  523.                    
  524.                     case 3:
  525.                         //pivot + trans
  526.                     //return an error, cannot both rotate and pivot
  527.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  528.                     break;
  529.                    
  530.                     case 4:
  531.                         //flip v
  532.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  533.                     rotate_sprite_v_flip(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  534.                     break;
  535.                    
  536.                     case 5:
  537.                         //trans + v flip
  538.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  539.                     rotate_sprite_v_flip_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  540.                     break;
  541.                    
  542.                     case 6:
  543.                         //pivot + v flip
  544.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  545.                     //return an error, cannot both rotate and pivot
  546.                     break;
  547.                    
  548.                     case 8:
  549.                         //flip h
  550.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rorate and H-Flip.\n", bitmapIndex);
  551.                     //return an error, cannot both rotate and flip H
  552.                     break;
  553.                    
  554.                     case 9:
  555.                         //trans + h flip
  556.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot Rotate and Flip a Trans Sprite.\n", bitmapIndex);
  557.                     //return an error, cannot rotate and flip a trans sprite
  558.                     break;
  559.                    
  560.                     case 10:
  561.                         //flip H and pivot
  562.                     //return error cannot pivot and h flip
  563.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  564.                     break;
  565.                    
  566.                     case 12:
  567.                         //vh flip
  568.                     //return an error, cannot rotate and VH flip a trans sprite
  569.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  570.                     break;
  571.                    
  572.                     case 13:
  573.                         //trans + vh flip
  574.                     //return an error, cannot rotate and VH flip a trans sprite
  575.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  576.                     break;
  577.                    
  578.                     case 14:
  579.                         //pivot and vh flip
  580.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  581.                     //return error cannot both pivot and vh flip
  582.                     break;
  583.                    
  584.                     case 16:
  585.                         //lit
  586.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);//transparent
  587.                     rotate_sprite_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  588.                     break;
  589.                    
  590.                     case 18:
  591.                         //pivot, lit
  592.                     //return an error, cannot both rotate and pivot
  593.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  594.                     break;
  595.                    
  596.                     case 20:
  597.                         //lit + vflip
  598.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);//transparent
  599.                     rotate_sprite_v_flip_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  600.                     break;
  601.                    
  602.                     case 22:
  603.                         //Pivot, vflip, lit
  604.                     //return an error, cannot both rotate and pivot
  605.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  606.                     break;
  607.                    
  608.                     case 24:
  609.                         //lit + h flip
  610.                     //return an error, cannot both rotate and H flip
  611.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and H-Flip.\n", bitmapIndex);
  612.                     break;
  613.                    
  614.                     case 26:
  615.                         //pivot + lit + hflip
  616.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Flip a Lit Sprite.\n", bitmapIndex);
  617.                     //return error cannot pivot, lit, and flip
  618.                     break;
  619.                    
  620.                     case 28:
  621.                         //lit + vh flip
  622.                     //return an error, cannot both rotate and VH flip
  623.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  624.                     break;
  625.                    
  626.                     case 32: //gouraud
  627.                         //Probably not wort supporting.
  628.                     //stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  629.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  630.                     break;
  631.                    
  632.                     case 0:
  633.                         //no effect.
  634.                     stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  635.                     rotate_sprite(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  636.                     break;
  637.                    
  638.                     default:
  639.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  640.                
  641.                 }
  642.             }
  643.            
  644.         } //end if stretched, but not masked
  645.     }
  646.     else { //not stretched
  647.        
  648.         if(masked) { //if masked, but not stretched
  649.            
  650.             if ( rot == 0 ) { //if not rotated
  651.                 switch(mode) {
  652.                     case 1:
  653.                     //transparent
  654.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  655.                     draw_trans_sprite(bmp, subBmp, dx, dy);
  656.                     break;
  657.                    
  658.                    
  659.                     case 2:
  660.                         //pivot?
  661.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  662.                     pivot_sprite(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  663.                     //Pivoting requires two more args
  664.                     break;
  665.                    
  666.                     case 3:
  667.                         //pivot + trans
  668.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  669.                     pivot_sprite_trans(bmp, subBmp, dx, dy,  cx, cy, degrees_to_fixed(rot));
  670.                     break;
  671.                    
  672.                     case 4:
  673.                         //flip v
  674.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  675.                     draw_sprite_v_flip(bmp, subBmp, dx, dy);
  676.                     break;
  677.                    
  678.                     case 5:
  679.                         //trans + v flip
  680.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  681.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_V_FLIP);
  682.                     break;
  683.                    
  684.                     case 6:
  685.                         //pivot + v flip
  686.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  687.                     pivot_sprite_v_flip(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot));
  688.                    
  689.                     case 8:
  690.                         //vlip h
  691.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  692.                     draw_sprite_h_flip(bmp, subBmp, dx, dy);
  693.                     break;
  694.                    
  695.                     case 9:
  696.                         //trans + h flip
  697.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  698.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_H_FLIP);
  699.                     break;
  700.                    
  701.                     case 10:
  702.                         //flip H and pivot
  703.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  704.                     //return error cannot pivot and h flip
  705.                     break;
  706.                    
  707.                     case 12:
  708.                         //vh flip
  709.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  710.                     draw_sprite_vh_flip(bmp, subBmp, dx, dy);
  711.                     break;
  712.                    
  713.                     case 13:
  714.                         //trans + vh flip
  715.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  716.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_VH_FLIP);
  717.                     break;
  718.                    
  719.                     case 14:
  720.                         //pivot and vh flip
  721.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  722.                     //return error cannot both pivot and vh flip
  723.                     break;
  724.                    
  725.                     case 16:
  726.                         //lit
  727.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  728.                     draw_lit_sprite(bmp, subBmp, dx, dy, litcolour);
  729.                     break;
  730.                    
  731.                     case 18:
  732.                         //pivot, lit
  733.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  734.                     pivot_sprite_lit(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot),litcolour);
  735.                     break;
  736.                    
  737.                     case 20:
  738.                         //lit + v flip
  739.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  740.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_V_FLIP);
  741.                     break;
  742.                    
  743.                     case 22:
  744.                         //Pivot, vflip, lit
  745.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  746.                     pivot_sprite_v_flip_lit(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot),litcolour);
  747.                     break;
  748.                    
  749.                     case 24:
  750.                         //lit + h flip
  751.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  752.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_H_FLIP);
  753.                     break;
  754.                    
  755.                     case 26:
  756.                         //pivot + lit + hflip
  757.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot, Flip, and Lit.\n", bitmapIndex);
  758.                     //return error cannot pivot, lit, and flip
  759.                     break;
  760.                    
  761.                     case 28:
  762.                         //lit + vh flip
  763.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  764.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_VH_FLIP);
  765.                     break;
  766.                    
  767.                     case 32: //gouraud
  768.                         //Probably not wort supporting.
  769.                     //stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  770.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  771.                     break;
  772.                    
  773.                     case 0:
  774.                         //no effect
  775.                     masked_blit(sourceBitmap, bmp, sx, sy, dx, dy, dw, dh);
  776.                     break;
  777.                    
  778.                    
  779.                     default:
  780.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  781.                    
  782.                    
  783.                 }
  784.             } //end if not rotated
  785.            
  786.             if ( rot != 0 ) { //if rotated
  787.                 switch(mode){
  788.                     case 1:
  789.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);    //transparent
  790.                     rotate_sprite_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  791.                    
  792.                     break;
  793.                    
  794.                     case 2:
  795.                         //pivot?
  796.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  797.                     //return an error, cannot both rotate and pivot
  798.                     break;
  799.                    
  800.                     case 3:
  801.                         //pivot + trans
  802.                     //return an error, cannot both rotate and pivot
  803.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  804.                     break;
  805.                    
  806.                     case 4:
  807.                         //flip v
  808.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  809.                     rotate_sprite_v_flip(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  810.                     break;
  811.                    
  812.                     case 5:
  813.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);    //trans + v flip
  814.                     rotate_sprite_v_flip_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  815.                     break;
  816.                    
  817.                     case 6:
  818.                         //pivot + v flip
  819.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  820.                     //return an error, cannot both rotate and pivot
  821.                     break;
  822.                    
  823.                     case 8:
  824.                         //flip h
  825.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rorate and H-Flip.\n", bitmapIndex);
  826.                     //return an error, cannot both rotate and flip H
  827.                     break;
  828.                    
  829.                     case 9:
  830.                         //trans + h flip
  831.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot Rotate and Flip a Trans Sprite.\n", bitmapIndex);
  832.                     //return an error, cannot rotate and flip a trans sprite
  833.                     break;
  834.                    
  835.                     case 10:
  836.                         //flip H and pivot
  837.                     //return error cannot pivot and h flip
  838.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  839.                     break;
  840.                    
  841.                     case 12:
  842.                         //vh flip
  843.                     //return an error, cannot rotate and VH flip a trans sprite
  844.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  845.                     break;
  846.                    
  847.                     case 13:
  848.                         //trans + vh flip
  849.                     //return an error, cannot rotate and VH flip a trans sprite
  850.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  851.                     break;
  852.                    
  853.                     case 14:
  854.                         //pivot and vh flip
  855.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  856.                     //return error cannot both pivot and vh flip
  857.                     break;
  858.                    
  859.                     case 16:
  860.                         //lit
  861.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  862.                     rotate_sprite_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  863.                     break;
  864.                    
  865.                     case 18:
  866.                         //pivot, lit
  867.                     //return an error, cannot both rotate and pivot
  868.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  869.                     break;
  870.                    
  871.                     case 20:
  872.                         //lit + vflip
  873.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  874.                     rotate_sprite_v_flip_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  875.                     break;
  876.                    
  877.                     case 22:
  878.                         //Pivot, vflip, lit
  879.                     //return an error, cannot both rotate and pivot
  880.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  881.                     break;
  882.                    
  883.                     case 24:
  884.                         //lit + h flip
  885.                     //return an error, cannot both rotate and H flip
  886.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and H-Flip.\n", bitmapIndex);
  887.                     break;
  888.                    
  889.                     case 26:
  890.                         //pivot + lit + hflip
  891.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Flip a Lit Sprite.\n", bitmapIndex);
  892.                     //return error cannot pivot, lit, and flip
  893.                     break;
  894.                    
  895.                     case 28:
  896.                         //lit + vh flip
  897.                     //return an error, cannot both rotate and VH flip
  898.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  899.                     break;
  900.                    
  901.                     case 32: //gouraud
  902.                         //Probably not wort supporting.
  903.                     //stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, dw, dh);
  904.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  905.                     break;
  906.                    
  907.                     case 0:
  908.                         //no effect.
  909.                     masked_blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  910.                     rotate_sprite(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  911.                     break;
  912.                    
  913.                     default:
  914.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  915.                
  916.                 }
  917.             } //end rtated, masked
  918.         } //end if masked
  919.  
  920.         else { //not masked, and not stretched; just blit
  921.            
  922.             if ( rot == 0 ) { //if not rotated
  923.                 switch(mode) {
  924.                     case 1:
  925.                     //transparent
  926.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  927.                     draw_trans_sprite(bmp, subBmp, dx, dy);
  928.                     break;
  929.                    
  930.                    
  931.                     case 2:
  932.                         //pivot?
  933.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  934.                     pivot_sprite(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  935.                     //Pivoting requires two more args
  936.                     break;
  937.                    
  938.                     case 3:
  939.                         //pivot + trans
  940.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  941.                     pivot_sprite_trans(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot));
  942.                     break;
  943.                    
  944.                     case 4:
  945.                         //flip v
  946.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  947.                     draw_sprite_v_flip(bmp, subBmp, dx, dy);
  948.                     break;
  949.                    
  950.                     case 5:
  951.                         //trans + v flip
  952.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  953.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_V_FLIP);
  954.                     break;
  955.                    
  956.                     case 6:
  957.                         //pivot + v flip
  958.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  959.                     pivot_sprite_v_flip(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot));
  960.                    
  961.                     case 8:
  962.                         //vlip h
  963.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  964.                     draw_sprite_h_flip(bmp, subBmp, dx, dy);
  965.                     break;
  966.                    
  967.                     case 9:
  968.                         //trans + h flip
  969.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  970.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_H_FLIP);
  971.                     break;
  972.                    
  973.                     case 10:
  974.                         //flip H and pivot
  975.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  976.                     //return error cannot pivot and h flip
  977.                     break;
  978.                    
  979.                     case 12:
  980.                         //vh flip
  981.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  982.                     draw_sprite_vh_flip(bmp, subBmp, dx, dy);
  983.                     break;
  984.                    
  985.                     case 13:
  986.                         //trans + vh flip
  987.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  988.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_TRANS, DRAW_SPRITE_VH_FLIP);
  989.                     break;
  990.                    
  991.                     case 14:
  992.                         //pivot and vh flip
  993.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  994.                     //return error cannot both pivot and vh flip
  995.                     break;
  996.                    
  997.                     case 16:
  998.                         //lit
  999.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1000.                     draw_lit_sprite(bmp, subBmp, dx, dy, litcolour);
  1001.                     break;
  1002.                    
  1003.                     case 18:
  1004.                         //pivot, lit
  1005.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1006.                     pivot_sprite_lit(bmp, subBmp, dx, dy, cx, cy, degrees_to_fixed(rot),litcolour);
  1007.                     break;
  1008.                    
  1009.                     case 20:
  1010.                         //lit + v flip
  1011.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1012.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_V_FLIP);
  1013.                     break;
  1014.                    
  1015.                     case 22:
  1016.                         //Pivot, vflip, lit
  1017.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1018.                     pivot_sprite_v_flip_lit(bmp, subBmp, dx, dy,  cx,  cy, degrees_to_fixed(rot),litcolour);
  1019.                     break;
  1020.                    
  1021.                     case 24:
  1022.                         //lit + h flip
  1023.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1024.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_H_FLIP);
  1025.                     break;
  1026.                    
  1027.                     case 26:
  1028.                         //pivot + lit + hflip
  1029.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot, Flip, and Lit.\n", bitmapIndex);
  1030.                     //return error cannot pivot, lit, and flip
  1031.                     break;
  1032.                    
  1033.                     case 28:
  1034.                         //lit + vh flip
  1035.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1036.                     draw_sprite_ex(bmp, subBmp, dx, dy, DRAW_SPRITE_LIT, DRAW_SPRITE_VH_FLIP);
  1037.                     break;
  1038.                    
  1039.                     case 32: //gouraud
  1040.                         //Probably not wort supporting.
  1041.                     //blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1042.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  1043.                     break;
  1044.                    
  1045.                     case 0:
  1046.                         //no effect
  1047.                     blit(sourceBitmap, bmp, sx, sy, dx, dy, dw, dh);
  1048.                     break;
  1049.                    
  1050.                    
  1051.                     default:
  1052.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  1053.                    
  1054.                    
  1055.                 }
  1056.             } //end if not rotated
  1057.            
  1058.             if ( rot != 0 ) { //if rotated
  1059.                 switch(mode){
  1060.                     case 1:
  1061.                         blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);//transparent
  1062.                     rotate_sprite_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  1063.                      
  1064.                     break;
  1065.                    
  1066.                     case 2:
  1067.                         //pivot?
  1068.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  1069.                     //return an error, cannot both rotate and pivot
  1070.                     break;
  1071.                    
  1072.                     case 3:
  1073.                         //pivot + trans
  1074.                     //return an error, cannot both rotate and pivot
  1075.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  1076.                     break;
  1077.                    
  1078.                     case 4:
  1079.                         //flip v
  1080.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1081.                     rotate_sprite_v_flip(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  1082.                     break;
  1083.                    
  1084.                     case 5:
  1085.                         //trans + v flip
  1086.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1087.                     rotate_sprite_v_flip_trans(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  1088.                     break;
  1089.                    
  1090.                     case 6:
  1091.                         //pivot + v flip
  1092.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  1093.                     //return an error, cannot both rotate and pivot
  1094.                     break;
  1095.                    
  1096.                     case 8:
  1097.                         //flip h
  1098.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rorate and H-Flip.\n", bitmapIndex);
  1099.                     //return an error, cannot both rotate and flip H
  1100.                     break;
  1101.                    
  1102.                     case 9:
  1103.                         //trans + h flip
  1104.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot Rotate and Flip a Trans Sprite.\n", bitmapIndex);
  1105.                     //return an error, cannot rotate and flip a trans sprite
  1106.                     break;
  1107.                    
  1108.                     case 10:
  1109.                         //flip H and pivot
  1110.                     //return error cannot pivot and h flip
  1111.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and H-Flip.\n", bitmapIndex);
  1112.                     break;
  1113.                    
  1114.                     case 12:
  1115.                         //vh flip
  1116.                     //return an error, cannot rotate and VH flip a trans sprite
  1117.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  1118.                     break;
  1119.                    
  1120.                     case 13:
  1121.                         //trans + vh flip
  1122.                     //return an error, cannot rotate and VH flip a trans sprite
  1123.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and VH-Flip.\n", bitmapIndex);
  1124.                     break;
  1125.                    
  1126.                     case 14:
  1127.                         //pivot and vh flip
  1128.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  1129.                     //return error cannot both pivot and vh flip
  1130.                     break;
  1131.                    
  1132.                     case 16:
  1133.                         //lit
  1134.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1135.                     rotate_sprite_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  1136.                     break;
  1137.                    
  1138.                     case 18:
  1139.                         //pivot, lit
  1140.                     //return an error, cannot both rotate and pivot
  1141.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rorate.\n", bitmapIndex);
  1142.                     break;
  1143.                    
  1144.                     case 20:
  1145.                         //lit + vflip
  1146.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1147.                     rotate_sprite_v_flip_lit(bmp, subBmp, dx, dy, degrees_to_fixed(rot),litcolour);
  1148.                     break;
  1149.                    
  1150.                     case 22:
  1151.                         //Pivot, vflip, lit
  1152.                     //return an error, cannot both rotate and pivot
  1153.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Rotate.\n", bitmapIndex);
  1154.                     break;
  1155.                    
  1156.                     case 24:
  1157.                         //lit + h flip
  1158.                     //return an error, cannot both rotate and H flip
  1159.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Rotate and H-Flip.\n", bitmapIndex);
  1160.                     break;
  1161.                    
  1162.                     case 26:
  1163.                         //pivot + lit + hflip
  1164.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and Flip a Lit Sprite.\n", bitmapIndex);
  1165.                     //return error cannot pivot, lit, and flip
  1166.                     break;
  1167.                    
  1168.                     case 28:
  1169.                         //lit + vh flip
  1170.                     //return an error, cannot both rotate and VH flip
  1171.                     Z_message("Warning: Screen->DrawBitmap(%d) cannot both Pivot and VH-Flip.\n", bitmapIndex);
  1172.                     break;
  1173.                    
  1174.                     case 32: //gouraud
  1175.                         //Probably not wort supporting.
  1176.                     //blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1177.                     //draw_gouraud_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4);
  1178.                     break;
  1179.                    
  1180.                     case 0:
  1181.                         //no effect.
  1182.                     blit(sourceBitmap, subBmp, sx, sy, 0, 0, dw, dh);
  1183.                     rotate_sprite(bmp, subBmp, dx, dy, degrees_to_fixed(rot));
  1184.                     break;
  1185.                    
  1186.                     default:
  1187.                         return Z_message("Warning: Screen->DrawBitmap(%d) mode flags not possible in this combination!\n", bitmapIndex);
  1188.                
  1189.                 }
  1190.             } //end if rotated
  1191.         } //end if not masked
  1192.     } //end if not stretched
  1193.    
  1194.     //cleanup
  1195.     if(subBmp) {
  1196.         script_drawing_commands.ReleaseSubBitmap(subBmp); //purge the temporary bitmap.
  1197.     }
  1198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement