Advertisement
ZoriaRPG

F5 Key Function

Oct 1st, 2018
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.53 KB | None | 0 0
  1. int onSaveMapPic()
  2.  
  3. {
  4.  
  5.     BITMAP* mappic = NULL;
  6.  
  7.     int mapres2 = 0;
  8.  
  9.     char buf[20];
  10.  
  11.     int num=0;
  12.  
  13.     set_clip_state(temp_buf,1);
  14.  
  15.     set_clip_rect(temp_buf,0,0,temp_buf->w, temp_buf->h);
  16.  
  17.    
  18.  
  19.     do
  20.  
  21.     {
  22.  
  23. #ifdef ALLEGRO_MACOSX
  24.  
  25.         sprintf(buf, "../../../zelda%03d.png", ++num);
  26.  
  27. #else
  28.  
  29.         sprintf(buf, "zelda%03d.png", ++num);
  30.  
  31. #endif
  32.  
  33.     }
  34.  
  35.     while(num<999 && exists(buf));
  36.  
  37.    
  38.  
  39.     //  if(!mappic) {
  40.  
  41.     mappic = create_bitmap_ex(8,(256*16)>>mapres2,(176*8)>>mapres2);
  42.  
  43.    
  44.  
  45.     if(!mappic)
  46.  
  47.     {
  48.  
  49.         system_pal();
  50.  
  51.         jwin_alert("Save Map Picture","Not enough memory.",NULL,NULL,"OK",NULL,13,27,lfont);
  52.  
  53.         game_pal();
  54.  
  55.         return D_O_K;
  56.  
  57.     }
  58.  
  59.    
  60.  
  61.     //  }
  62.  
  63.    
  64.  
  65.     int layermap, layerscreen;
  66.  
  67.     int x2=0;
  68.  
  69.    
  70.  
  71.     // draw the map
  72.  
  73.     for(int y=0; y<8; y++)
  74.  
  75.     {
  76.  
  77.         for(int x=0; x<16; x++)
  78.  
  79.         {
  80.  
  81.             int s = (y<<4) + x;
  82.  
  83.            
  84.  
  85.             if(!displayOnMap(x, y))
  86.  
  87.             {
  88.  
  89.                 rectfill(temp_buf, 0, 0, 255, 223, WHITE);
  90.  
  91.             }
  92.  
  93.             else
  94.  
  95.             {
  96.  
  97.                 loadscr(1,currdmap,s,-1,false);
  98.  
  99.                 putscr(temp_buf, 0, 0, tmpscr+1);
  100.  
  101.                
  102.  
  103.                 for(int k=0; k<4; k++)
  104.  
  105.                 {
  106.  
  107.                     if(k==2)
  108.  
  109.                     {
  110.  
  111.                         putscrdoors(temp_buf, 0, 0, tmpscr+1);
  112.  
  113.                     }
  114.  
  115.                    
  116.  
  117.                     layermap=TheMaps[currmap*MAPSCRS+s].layermap[k]-1;
  118.  
  119.                    
  120.  
  121.                     if(layermap>-1)
  122.  
  123.                     {
  124.  
  125.                         layerscreen=layermap*MAPSCRS+TheMaps[currmap*MAPSCRS+s].layerscreen[k];
  126.  
  127.                        
  128.  
  129.                         if(TheMaps[currmap*MAPSCRS+s].layeropacity[k]==255)
  130.  
  131.                         {
  132.  
  133.                             for(int i=0; i<176; i++)
  134.  
  135.                             {
  136.  
  137.                                 overcombo(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i]);
  138.  
  139.                             }
  140.  
  141.                         }
  142.  
  143.                         else
  144.  
  145.                         {
  146.  
  147.                             for(int i=0; i<176; i++)
  148.  
  149.                             {
  150.  
  151.                                 overcombotranslucent(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i],TheMaps[currmap*MAPSCRS+s].layeropacity[k]);
  152.  
  153.                             }
  154.  
  155.                         }
  156.  
  157.                     }
  158.  
  159.                 }
  160.  
  161.                
  162.  
  163.                 for(int i=0; i<176; i++)
  164.  
  165.                 {
  166.  
  167. //          if (COMBOTYPE((i&15)<<4,i&0xF0)==cOLD_OVERHEAD)
  168.  
  169.                     if(combo_class_buf[COMBOTYPE((i&15)<<4,i&0xF0)].overhead)
  170.  
  171.                     {
  172.  
  173.                         overcombo(temp_buf,((i&15)<<4)+x2,(i&0xF0),MAPCOMBO((i&15)<<4,i&0xF0),MAPCSET((i&15)<<4,i&0xF0));
  174.  
  175.                     }
  176.  
  177.                 }
  178.  
  179.                
  180.  
  181.                 for(int k=4; k<6; k++)
  182.  
  183.                 {
  184.  
  185.                     layermap=TheMaps[currmap*MAPSCRS+s].layermap[k]-1;
  186.  
  187.                    
  188.  
  189.                     if(layermap>-1)
  190.  
  191.                     {
  192.  
  193.                         layerscreen=layermap*MAPSCRS+TheMaps[currmap*MAPSCRS+s].layerscreen[k];
  194.  
  195.                        
  196.  
  197.                         if(TheMaps[currmap*MAPSCRS+s].layeropacity[k]==255)
  198.  
  199.                         {
  200.  
  201.                             for(int i=0; i<176; i++)
  202.  
  203.                             {
  204.  
  205.                                 overcombo(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i]);
  206.  
  207.                             }
  208.  
  209.                         }
  210.  
  211.                         else
  212.  
  213.                         {
  214.  
  215.                             for(int i=0; i<176; i++)
  216.  
  217.                             {
  218.  
  219.                                 overcombotranslucent(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i],TheMaps[currmap*MAPSCRS+s].layeropacity[k]);
  220.  
  221.                             }
  222.  
  223.                         }
  224.  
  225.                     }
  226.  
  227.                 }
  228.  
  229.             }
  230.  
  231.            
  232.  
  233.             stretch_blit(temp_buf, mappic, 0, 0, 256, 176,
  234.  
  235.                          x<<(8-mapres2), (y*176)>>mapres2, 256>>mapres2, 176>>mapres2);
  236.  
  237.         }
  238.  
  239.        
  240.  
  241.     }
  242.  
  243.    
  244.  
  245.     save_bitmap(buf,mappic,RAMpal);
  246.  
  247.     destroy_bitmap(mappic);
  248.  
  249.     return D_O_K;
  250.  
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement