Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int onSaveMapPic()
- {
- BITMAP* mappic = NULL;
- int mapres2 = 0;
- char buf[20];
- int num=0;
- set_clip_state(temp_buf,1);
- set_clip_rect(temp_buf,0,0,temp_buf->w, temp_buf->h);
- do
- {
- #ifdef ALLEGRO_MACOSX
- sprintf(buf, "../../../zelda%03d.png", ++num);
- #else
- sprintf(buf, "zelda%03d.png", ++num);
- #endif
- }
- while(num<999 && exists(buf));
- // if(!mappic) {
- mappic = create_bitmap_ex(8,(256*16)>>mapres2,(176*8)>>mapres2);
- if(!mappic)
- {
- system_pal();
- jwin_alert("Save Map Picture","Not enough memory.",NULL,NULL,"OK",NULL,13,27,lfont);
- game_pal();
- return D_O_K;
- }
- // }
- int layermap, layerscreen;
- int x2=0;
- // draw the map
- for(int y=0; y<8; y++)
- {
- for(int x=0; x<16; x++)
- {
- int s = (y<<4) + x;
- if(!displayOnMap(x, y))
- {
- rectfill(temp_buf, 0, 0, 255, 223, WHITE);
- }
- else
- {
- loadscr(1,currdmap,s,-1,false);
- putscr(temp_buf, 0, 0, tmpscr+1);
- for(int k=0; k<4; k++)
- {
- if(k==2)
- {
- putscrdoors(temp_buf, 0, 0, tmpscr+1);
- }
- layermap=TheMaps[currmap*MAPSCRS+s].layermap[k]-1;
- if(layermap>-1)
- {
- layerscreen=layermap*MAPSCRS+TheMaps[currmap*MAPSCRS+s].layerscreen[k];
- if(TheMaps[currmap*MAPSCRS+s].layeropacity[k]==255)
- {
- for(int i=0; i<176; i++)
- {
- overcombo(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i]);
- }
- }
- else
- {
- for(int i=0; i<176; i++)
- {
- overcombotranslucent(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i],TheMaps[currmap*MAPSCRS+s].layeropacity[k]);
- }
- }
- }
- }
- for(int i=0; i<176; i++)
- {
- // if (COMBOTYPE((i&15)<<4,i&0xF0)==cOLD_OVERHEAD)
- if(combo_class_buf[COMBOTYPE((i&15)<<4,i&0xF0)].overhead)
- {
- overcombo(temp_buf,((i&15)<<4)+x2,(i&0xF0),MAPCOMBO((i&15)<<4,i&0xF0),MAPCSET((i&15)<<4,i&0xF0));
- }
- }
- for(int k=4; k<6; k++)
- {
- layermap=TheMaps[currmap*MAPSCRS+s].layermap[k]-1;
- if(layermap>-1)
- {
- layerscreen=layermap*MAPSCRS+TheMaps[currmap*MAPSCRS+s].layerscreen[k];
- if(TheMaps[currmap*MAPSCRS+s].layeropacity[k]==255)
- {
- for(int i=0; i<176; i++)
- {
- overcombo(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i]);
- }
- }
- else
- {
- for(int i=0; i<176; i++)
- {
- overcombotranslucent(temp_buf,((i&15)<<4)+x2,(i&0xF0),TheMaps[layerscreen].data[i],TheMaps[layerscreen].cset[i],TheMaps[currmap*MAPSCRS+s].layeropacity[k]);
- }
- }
- }
- }
- }
- stretch_blit(temp_buf, mappic, 0, 0, 256, 176,
- x<<(8-mapres2), (y*176)>>mapres2, 256>>mapres2, 176>>mapres2);
- }
- }
- save_bitmap(buf,mappic,RAMpal);
- destroy_bitmap(mappic);
- return D_O_K;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement