Fixed Brush grab and Lasso grab tools to work with tilemap (when right-clicking to clear)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1868 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2011-11-12 16:26:36 +00:00
parent eb4bab6d67
commit 1fd7b42fcc

View File

@ -35,6 +35,7 @@
#include "windows.h" #include "windows.h"
#include "sdlscreen.h" #include "sdlscreen.h"
#include "brush.h" #include "brush.h"
#include "tiles.h"
// Data used during brush rotation operation // Data used during brush rotation operation
static byte * Brush_rotate_buffer; static byte * Brush_rotate_buffer;
@ -879,7 +880,17 @@ void Capture_brush(short start_x,short start_y,short end_x,short end_y,short cle
Copy_image_to_brush(start_x,start_y,Brush_width,Brush_height,Main_image_width); Copy_image_to_brush(start_x,start_y,Brush_width,Brush_height,Main_image_width);
// On regarde s'il faut effacer quelque chose: // On regarde s'il faut effacer quelque chose:
if (clear != 0) if (clear)
{
if (Main_tilemap_mode)
{
for (y_pos=start_y;y_pos<start_y+Brush_height;y_pos++)
for (x_pos=start_x;x_pos<start_x+Brush_width;x_pos++)
{
Tilemap_draw(x_pos,y_pos, Back_color);
}
}
else
{ {
for (y_pos=start_y;y_pos<start_y+Brush_height;y_pos++) for (y_pos=start_y;y_pos<start_y+Brush_height;y_pos++)
for (x_pos=start_x;x_pos<start_x+Brush_width;x_pos++) for (x_pos=start_x;x_pos<start_x+Brush_width;x_pos++)
@ -888,6 +899,7 @@ void Capture_brush(short start_x,short start_y,short end_x,short end_y,short cle
} }
Update_part_of_screen(start_x,start_y,Brush_width,Brush_height); Update_part_of_screen(start_x,start_y,Brush_width,Brush_height);
} }
}
// Grab palette // Grab palette
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette)); memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
// Remap (no change) // Remap (no change)
@ -1276,8 +1288,17 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
Pixel_in_brush(x_pos-start_x,y_pos-start_y,Read_pixel_from_current_layer(x_pos,y_pos)); Pixel_in_brush(x_pos-start_x,y_pos-start_y,Read_pixel_from_current_layer(x_pos,y_pos));
// On regarde s'il faut effacer quelque chose: // On regarde s'il faut effacer quelque chose:
if (clear) if (clear)
{
if (Main_tilemap_mode)
{
Tilemap_draw(x_pos,y_pos,Back_color);
}
else
{
Pixel_in_current_screen(x_pos,y_pos,Back_color,0); Pixel_in_current_screen(x_pos,y_pos,Back_color,0);
} }
}
}
// Grab palette // Grab palette
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette)); memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
// Init colormap // Init colormap