Eliminated some tab characters in source code
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1341 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
917847cdab
commit
480c9abaab
10
buttons.c
10
buttons.c
@ -945,8 +945,8 @@ void Add_font_or_skin(const char *name)
|
|||||||
fname = name;
|
fname = name;
|
||||||
namelength = strlen(fname);
|
namelength = strlen(fname);
|
||||||
if (namelength>=10 && fname[0]!='_' && !strncasecmp(fname, "skin_", 5)
|
if (namelength>=10 && fname[0]!='_' && !strncasecmp(fname, "skin_", 5)
|
||||||
&& (!strcasecmp(fname + namelength - 4,".png")
|
&& (!strcasecmp(fname + namelength - 4,".png")
|
||||||
|| !strcasecmp(fname + namelength - 4,".gif")))
|
|| !strcasecmp(fname + namelength - 4,".gif")))
|
||||||
{
|
{
|
||||||
Add_element_to_list(&Skin_files_list, name, 0);
|
Add_element_to_list(&Skin_files_list, name, 0);
|
||||||
|
|
||||||
@ -961,7 +961,7 @@ void Add_font_or_skin(const char *name)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (namelength>=10 && !strncasecmp(fname, "font_", 5)
|
else if (namelength>=10 && !strncasecmp(fname, "font_", 5)
|
||||||
&& (!strcasecmp(fname + namelength - 4, ".png")))
|
&& (!strcasecmp(fname + namelength - 4, ".png")))
|
||||||
{
|
{
|
||||||
Add_element_to_list(&Font_files_list, name, 0);
|
Add_element_to_list(&Font_files_list, name, 0);
|
||||||
|
|
||||||
@ -972,7 +972,7 @@ void Add_font_or_skin(const char *name)
|
|||||||
strcpy(Font_files_list.First->Full_name, fname);
|
strcpy(Font_files_list.First->Full_name, fname);
|
||||||
// Reformat the short name differently
|
// Reformat the short name differently
|
||||||
strcpy(Font_files_list.First->Short_name,
|
strcpy(Font_files_list.First->Short_name,
|
||||||
Format_font_filename(Font_files_list.First->Full_name));
|
Format_font_filename(Font_files_list.First->Full_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -986,7 +986,7 @@ void Draw_one_skin_name(word x, word y, word index, byte highlighted)
|
|||||||
{
|
{
|
||||||
current_item = Get_item_by_index(&Skin_files_list, index);
|
current_item = Get_item_by_index(&Skin_files_list, index);
|
||||||
Print_in_window(x, y, current_item->Short_name, MC_Black,
|
Print_in_window(x, y, current_item->Short_name, MC_Black,
|
||||||
(highlighted)?MC_Dark:MC_Light);
|
(highlighted)?MC_Dark:MC_Light);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
110
engine.c
110
engine.c
@ -1112,22 +1112,22 @@ void Main_handler(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No event : we go asleep for a while, but we try to get waked up at constant intervals of time
|
// No event : we go asleep for a while, but we try to get waked up at constant intervals of time
|
||||||
// no matter the machine speed or system load. The time is fixed to 10ms (that should be about a cpu slice on most systems)
|
// no matter the machine speed or system load. The time is fixed to 10ms (that should be about a cpu slice on most systems)
|
||||||
// This allows nice smooth mouse movement.
|
// This allows nice smooth mouse movement.
|
||||||
const int delay = 10;
|
const int delay = 10;
|
||||||
|
|
||||||
Uint32 debut;
|
Uint32 debut;
|
||||||
debut = SDL_GetTicks();
|
debut = SDL_GetTicks();
|
||||||
// Première attente : le complément de "delay" millisecondes
|
// Première attente : le complément de "delay" millisecondes
|
||||||
SDL_Delay(delay - (debut % delay));
|
SDL_Delay(delay - (debut % delay));
|
||||||
// Si ça ne suffit pas, on complète par des attentes successives de "1ms".
|
// Si ça ne suffit pas, on complète par des attentes successives de "1ms".
|
||||||
// (Remarque, Windows arrondit généralement aux 10ms supérieures)
|
// (Remarque, Windows arrondit généralement aux 10ms supérieures)
|
||||||
while ( SDL_GetTicks()/delay <= debut/delay)
|
while ( SDL_GetTicks()/delay <= debut/delay)
|
||||||
{
|
{
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestion de la souris
|
// Gestion de la souris
|
||||||
|
|
||||||
@ -2134,59 +2134,59 @@ void Get_color_behind_window(byte * color, byte * click)
|
|||||||
Paintbrush_hidden=1;
|
Paintbrush_hidden=1;
|
||||||
c=-1; // color pointée: au début aucune, comme ça on initialise tout
|
c=-1; // color pointée: au début aucune, comme ça on initialise tout
|
||||||
if (Menu_is_visible_before_window)
|
if (Menu_is_visible_before_window)
|
||||||
Print_in_menu(Menu_tooltip[BUTTON_CHOOSE_COL],0);
|
Print_in_menu(Menu_tooltip[BUTTON_CHOOSE_COL],0);
|
||||||
|
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(!Get_input())SDL_Delay(20);
|
if(!Get_input())SDL_Delay(20);
|
||||||
|
|
||||||
if ((Mouse_X!=old_x) || (Mouse_Y!=old_y))
|
if ((Mouse_X!=old_x) || (Mouse_Y!=old_y))
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
a=Read_pixel(Mouse_X,Mouse_Y);
|
a=Read_pixel(Mouse_X,Mouse_Y);
|
||||||
if (a!=c)
|
if (a!=c)
|
||||||
{
|
{
|
||||||
c=a; // Mise à jour de la couleur pointée
|
c=a; // Mise à jour de la couleur pointée
|
||||||
if (Menu_is_visible_before_window)
|
if (Menu_is_visible_before_window)
|
||||||
{
|
{
|
||||||
sprintf(str,"%d",a);
|
sprintf(str,"%d",a);
|
||||||
d=strlen(str);
|
d=strlen(str);
|
||||||
strcat(str," (");
|
strcat(str," (");
|
||||||
sprintf(str+strlen(str),"%d",Main_palette[a].R);
|
sprintf(str+strlen(str),"%d",Main_palette[a].R);
|
||||||
strcat(str,",");
|
strcat(str,",");
|
||||||
sprintf(str+strlen(str),"%d",Main_palette[a].G);
|
sprintf(str+strlen(str),"%d",Main_palette[a].G);
|
||||||
strcat(str,",");
|
strcat(str,",");
|
||||||
sprintf(str+strlen(str),"%d",Main_palette[a].B);
|
sprintf(str+strlen(str),"%d",Main_palette[a].B);
|
||||||
strcat(str,")");
|
strcat(str,")");
|
||||||
a=24-d;
|
a=24-d;
|
||||||
for (index=strlen(str); index<a; index++)
|
for (index=strlen(str); index<a; index++)
|
||||||
str[index]=' ';
|
str[index]=' ';
|
||||||
str[a]=0;
|
str[a]=0;
|
||||||
Print_in_menu(str,strlen(Menu_tooltip[BUTTON_CHOOSE_COL]));
|
Print_in_menu(str,strlen(Menu_tooltip[BUTTON_CHOOSE_COL]));
|
||||||
|
|
||||||
Print_general((26+((d+strlen(Menu_tooltip[BUTTON_CHOOSE_COL]))<<3))*Menu_factor_X,
|
Print_general((26+((d+strlen(Menu_tooltip[BUTTON_CHOOSE_COL]))<<3))*Menu_factor_X,
|
||||||
Menu_status_Y," ",0,c);
|
Menu_status_Y," ",0,c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
old_x=Mouse_X;
|
old_x=Mouse_X;
|
||||||
old_y=Mouse_Y;
|
old_y=Mouse_Y;
|
||||||
} while (!(Mouse_K || (Key==KEY_ESC)));
|
} while (!(Mouse_K || (Key==KEY_ESC)));
|
||||||
|
|
||||||
if (Mouse_K)
|
if (Mouse_K)
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
*click=Mouse_K;
|
*click=Mouse_K;
|
||||||
*color=Read_pixel(Mouse_X,Mouse_Y);
|
*color=Read_pixel(Mouse_X,Mouse_Y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*click=0;
|
*click=0;
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
Restore_background(buffer,Window_pos_X,Window_pos_Y,Window_width,Window_height);
|
Restore_background(buffer,Window_pos_X,Window_pos_Y,Window_width,Window_height);
|
||||||
@ -2202,8 +2202,8 @@ void Get_color_behind_window(byte * color, byte * click)
|
|||||||
// ------------ Opération de déplacement de la fenêtre à l'écran -------------
|
// ------------ Opération de déplacement de la fenêtre à l'écran -------------
|
||||||
void Move_window(short dx, short dy)
|
void Move_window(short dx, short dy)
|
||||||
{
|
{
|
||||||
short new_x=Mouse_X-dx;
|
short new_x=Mouse_X-dx;
|
||||||
short new_y=Mouse_Y-dy;
|
short new_y=Mouse_Y-dy;
|
||||||
short old_x;
|
short old_x;
|
||||||
short old_y;
|
short old_y;
|
||||||
short width=Window_width*Menu_factor_X;
|
short width=Window_width*Menu_factor_X;
|
||||||
|
|||||||
352
factory.c
352
factory.c
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file factory.c
|
/*! \file factory.c
|
||||||
* \brief Brush factory - generates brush from lua scripts
|
* \brief Brush factory - generates brush from lua scripts
|
||||||
*
|
*
|
||||||
* The brush factory allows you to generate brushes with Lua code.
|
* The brush factory allows you to generate brushes with Lua code.
|
||||||
*/
|
*/
|
||||||
@ -80,54 +80,54 @@ int L_SetBrushSize(lua_State* L)
|
|||||||
{
|
{
|
||||||
return luaL_error(L, "SetBrushSize: Unreasonable arguments");
|
return luaL_error(L, "SetBrushSize: Unreasonable arguments");
|
||||||
}
|
}
|
||||||
if (Realloc_brush(w, h))
|
if (Realloc_brush(w, h))
|
||||||
{
|
{
|
||||||
return luaL_error(L, "SetBrushSize: Resize failed");
|
return luaL_error(L, "SetBrushSize: Resize failed");
|
||||||
}
|
}
|
||||||
Brush_was_altered=1;
|
Brush_was_altered=1;
|
||||||
// Fill with Back_color
|
// Fill with Back_color
|
||||||
memset(Brush,Back_color,(long)Brush_width*Brush_height);
|
memset(Brush,Back_color,(long)Brush_width*Brush_height);
|
||||||
// Center the handle
|
// Center the handle
|
||||||
Brush_offset_X=(Brush_width>>1);
|
Brush_offset_X=(Brush_width>>1);
|
||||||
Brush_offset_Y=(Brush_height>>1);
|
Brush_offset_Y=(Brush_height>>1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBrushSize(lua_State* L)
|
int L_GetBrushSize(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Brush_width);
|
lua_pushinteger(L, Brush_width);
|
||||||
lua_pushinteger(L, Brush_height);
|
lua_pushinteger(L, Brush_height);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBrushTransparentColor(lua_State* L)
|
int L_GetBrushTransparentColor(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Back_color);
|
lua_pushinteger(L, Back_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_PutBrushPixel(lua_State* L)
|
int L_PutBrushPixel(lua_State* L)
|
||||||
{
|
{
|
||||||
int x = lua_tonumber(L,1);
|
int x = lua_tonumber(L,1);
|
||||||
int y = lua_tonumber(L,2);
|
int y = lua_tonumber(L,2);
|
||||||
uint8_t c = lua_tonumber(L,3);
|
uint8_t c = lua_tonumber(L,3);
|
||||||
|
|
||||||
Brush_was_altered=1;
|
Brush_was_altered=1;
|
||||||
|
|
||||||
if (x<0 || y<0 || x>=Brush_width || y>=Brush_height)
|
if (x<0 || y<0 || x>=Brush_width || y>=Brush_height)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pixel_in_brush(x, y, c);
|
Pixel_in_brush(x, y, c);
|
||||||
}
|
}
|
||||||
return 0; // no values returned for lua
|
return 0; // no values returned for lua
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBrushPixel(lua_State* L)
|
int L_GetBrushPixel(lua_State* L)
|
||||||
{
|
{
|
||||||
int x = lua_tonumber(L,1);
|
int x = lua_tonumber(L,1);
|
||||||
int y = lua_tonumber(L,2);
|
int y = lua_tonumber(L,2);
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
if (x<0 || y<0 || x>=Brush_width || y>=Brush_height)
|
if (x<0 || y<0 || x>=Brush_width || y>=Brush_height)
|
||||||
{
|
{
|
||||||
c = Back_color; // Return 'transparent'
|
c = Back_color; // Return 'transparent'
|
||||||
@ -136,15 +136,15 @@ int L_GetBrushPixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
c = Read_pixel_from_brush(x, y);
|
c = Read_pixel_from_brush(x, y);
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, c);
|
lua_pushinteger(L, c);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBrushBackupPixel(lua_State* L)
|
int L_GetBrushBackupPixel(lua_State* L)
|
||||||
{
|
{
|
||||||
int x = lua_tonumber(L,1);
|
int x = lua_tonumber(L,1);
|
||||||
int y = lua_tonumber(L,2);
|
int y = lua_tonumber(L,2);
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
if (x<0 || y<0 || x>=Brush_backup_width || y>=Brush_backup_height)
|
if (x<0 || y<0 || x>=Brush_backup_width || y>=Brush_backup_height)
|
||||||
{
|
{
|
||||||
c = Back_color; // Return 'transparent'
|
c = Back_color; // Return 'transparent'
|
||||||
@ -153,8 +153,8 @@ int L_GetBrushBackupPixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
c = *(Brush_backup + y * Brush_backup_width + x);
|
c = *(Brush_backup + y * Brush_backup_width + x);
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, c);
|
lua_pushinteger(L, c);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_SetPictureSize(lua_State* L)
|
int L_SetPictureSize(lua_State* L)
|
||||||
@ -165,15 +165,15 @@ int L_SetPictureSize(lua_State* L)
|
|||||||
if (w<1 || h<1 || w>9999 || h>9999)
|
if (w<1 || h<1 || w>9999 || h>9999)
|
||||||
return luaL_error(L, "SetPictureSize: Unreasonable dimensions");
|
return luaL_error(L, "SetPictureSize: Unreasonable dimensions");
|
||||||
|
|
||||||
Resize_image(w, h); // TODO: a return value to catch runtime errors
|
Resize_image(w, h); // TODO: a return value to catch runtime errors
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetPictureSize(lua_State* L)
|
int L_GetPictureSize(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Main_image_width);
|
lua_pushinteger(L, Main_image_width);
|
||||||
lua_pushinteger(L, Main_image_height);
|
lua_pushinteger(L, Main_image_height);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_PutPicturePixel(lua_State* L)
|
int L_PutPicturePixel(lua_State* L)
|
||||||
@ -188,8 +188,8 @@ int L_PutPicturePixel(lua_State* L)
|
|||||||
// Silently ignored
|
// Silently ignored
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Pixel_in_current_screen(x, y, c, 0);
|
Pixel_in_current_screen(x, y, c, 0);
|
||||||
return 0; // no values returned for lua
|
return 0; // no values returned for lua
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetPicturePixel(lua_State* L)
|
int L_GetPicturePixel(lua_State* L)
|
||||||
@ -201,10 +201,10 @@ int L_GetPicturePixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, Read_pixel_from_current_screen(x,y));
|
lua_pushinteger(L, Read_pixel_from_current_screen(x,y));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBackupPixel(lua_State* L)
|
int L_GetBackupPixel(lua_State* L)
|
||||||
@ -216,10 +216,10 @@ int L_GetBackupPixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, Read_pixel_from_backup_screen(x,y));
|
lua_pushinteger(L, Read_pixel_from_backup_screen(x,y));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetLayerPixel(lua_State* L)
|
int L_GetLayerPixel(lua_State* L)
|
||||||
@ -231,19 +231,19 @@ int L_GetLayerPixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, Read_pixel_from_current_layer(x,y));
|
lua_pushinteger(L, Read_pixel_from_current_layer(x,y));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spare
|
// Spare
|
||||||
|
|
||||||
int L_GetSparePictureSize(lua_State* L)
|
int L_GetSparePictureSize(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Spare_image_width);
|
lua_pushinteger(L, Spare_image_width);
|
||||||
lua_pushinteger(L, Spare_image_height);
|
lua_pushinteger(L, Spare_image_height);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetSpareLayerPixel(lua_State* L)
|
int L_GetSpareLayerPixel(lua_State* L)
|
||||||
@ -255,10 +255,10 @@ int L_GetSpareLayerPixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, *(Spare_backups->Pages->Image[Spare_current_layer] + y*Spare_image_width + x));
|
lua_pushinteger(L, *(Spare_backups->Pages->Image[Spare_current_layer] + y*Spare_image_width + x));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetSparePicturePixel(lua_State* L)
|
int L_GetSparePicturePixel(lua_State* L)
|
||||||
@ -270,26 +270,26 @@ int L_GetSparePicturePixel(lua_State* L)
|
|||||||
{
|
{
|
||||||
// Silently return the image's transparent color
|
// Silently return the image's transparent color
|
||||||
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pushinteger(L, Read_pixel_from_spare_screen(x,y));
|
lua_pushinteger(L, Read_pixel_from_spare_screen(x,y));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetSpareColor(lua_State* L)
|
int L_GetSpareColor(lua_State* L)
|
||||||
{
|
{
|
||||||
byte c=lua_tonumber(L,1);
|
byte c=lua_tonumber(L,1);
|
||||||
|
|
||||||
lua_pushinteger(L, Spare_palette[c].R);
|
lua_pushinteger(L, Spare_palette[c].R);
|
||||||
lua_pushinteger(L, Spare_palette[c].G);
|
lua_pushinteger(L, Spare_palette[c].G);
|
||||||
lua_pushinteger(L, Spare_palette[c].B);
|
lua_pushinteger(L, Spare_palette[c].B);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetSpareTransColor(lua_State* L)
|
int L_GetSpareTransColor(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Spare_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -305,29 +305,29 @@ int L_SetColor(lua_State* L)
|
|||||||
Main_palette[c].R=Round_palette_component(r);
|
Main_palette[c].R=Round_palette_component(r);
|
||||||
Main_palette[c].G=Round_palette_component(g);
|
Main_palette[c].G=Round_palette_component(g);
|
||||||
Main_palette[c].B=Round_palette_component(b);
|
Main_palette[c].B=Round_palette_component(b);
|
||||||
// Set_color(c, r, g, b); Not needed. Update screen when script is finished
|
// Set_color(c, r, g, b); Not needed. Update screen when script is finished
|
||||||
Palette_has_changed=1;
|
Palette_has_changed=1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetColor(lua_State* L)
|
int L_GetColor(lua_State* L)
|
||||||
{
|
{
|
||||||
byte c=lua_tonumber(L,1);
|
byte c=lua_tonumber(L,1);
|
||||||
|
|
||||||
lua_pushinteger(L, Main_palette[c].R);
|
lua_pushinteger(L, Main_palette[c].R);
|
||||||
lua_pushinteger(L, Main_palette[c].G);
|
lua_pushinteger(L, Main_palette[c].G);
|
||||||
lua_pushinteger(L, Main_palette[c].B);
|
lua_pushinteger(L, Main_palette[c].B);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBackupColor(lua_State* L)
|
int L_GetBackupColor(lua_State* L)
|
||||||
{
|
{
|
||||||
byte c=lua_tonumber(L,1);
|
byte c=lua_tonumber(L,1);
|
||||||
|
|
||||||
lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].R);
|
lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].R);
|
||||||
lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].G);
|
lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].G);
|
||||||
lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].B);
|
lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].B);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_MatchColor(lua_State* L)
|
int L_MatchColor(lua_State* L)
|
||||||
@ -343,20 +343,20 @@ int L_MatchColor(lua_State* L)
|
|||||||
|
|
||||||
int L_GetForeColor(lua_State* L)
|
int L_GetForeColor(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Fore_color);
|
lua_pushinteger(L, Fore_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetBackColor(lua_State* L)
|
int L_GetBackColor(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Back_color);
|
lua_pushinteger(L, Back_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int L_GetTransColor(lua_State* L)
|
int L_GetTransColor(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ int L_MessageBox(lua_State* L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Verbose_message(caption, message);
|
Verbose_message(caption, message);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -601,23 +601,23 @@ T_Fileselector Scripts_list;
|
|||||||
// Callback to display a skin name in the list
|
// Callback to display a skin name in the list
|
||||||
void Draw_script_name(word x, word y, word index, byte highlighted)
|
void Draw_script_name(word x, word y, word index, byte highlighted)
|
||||||
{
|
{
|
||||||
T_Fileselector_item * current_item;
|
T_Fileselector_item * current_item;
|
||||||
|
|
||||||
if (Scripts_list.Nb_elements)
|
if (Scripts_list.Nb_elements)
|
||||||
{
|
{
|
||||||
short name_size;
|
short name_size;
|
||||||
|
|
||||||
current_item = Get_item_by_index(&Scripts_list, index);
|
current_item = Get_item_by_index(&Scripts_list, index);
|
||||||
|
|
||||||
Print_in_window_limited(x, y, current_item->Full_name, NAME_WIDTH, MC_Black,
|
Print_in_window_limited(x, y, current_item->Full_name, NAME_WIDTH, MC_Black,
|
||||||
(highlighted)?MC_Dark:MC_Light);
|
(highlighted)?MC_Dark:MC_Light);
|
||||||
name_size=strlen(current_item->Full_name);
|
name_size=strlen(current_item->Full_name);
|
||||||
// Clear remaining area on the right
|
// Clear remaining area on the right
|
||||||
if (name_size<NAME_WIDTH)
|
if (name_size<NAME_WIDTH)
|
||||||
Window_rectangle(x+name_size*8,y,(NAME_WIDTH-name_size)*8,8,(highlighted)?MC_Dark:MC_Light);
|
Window_rectangle(x+name_size*8,y,(NAME_WIDTH-name_size)*8,8,(highlighted)?MC_Dark:MC_Light);
|
||||||
|
|
||||||
Update_window_area(x,y,NAME_WIDTH*8,8);
|
Update_window_area(x,y,NAME_WIDTH*8,8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -630,13 +630,13 @@ void Draw_script_information(T_Fileselector_item * script_item)
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
// Blank the target area
|
// Blank the target area
|
||||||
Window_rectangle(7, FILESEL_Y + 89, (NAME_WIDTH+2)*8+2, 3*8, MC_Black);
|
Window_rectangle(7, FILESEL_Y + 89, (NAME_WIDTH+2)*8+2, 3*8, MC_Black);
|
||||||
|
|
||||||
if (script_item && script_item->Full_name && script_item->Full_name[0]!='\0')
|
if (script_item && script_item->Full_name && script_item->Full_name[0]!='\0')
|
||||||
{
|
{
|
||||||
strcpy(full_name, Data_directory);
|
strcpy(full_name, Data_directory);
|
||||||
strcat(full_name, "scripts/");
|
strcat(full_name, "scripts/");
|
||||||
strcat(full_name, script_item->Full_name);
|
strcat(full_name, script_item->Full_name);
|
||||||
|
|
||||||
|
|
||||||
x=0;
|
x=0;
|
||||||
@ -691,71 +691,71 @@ void Draw_script_information(T_Fileselector_item * script_item)
|
|||||||
// Add a script to the list
|
// Add a script to the list
|
||||||
void Add_script(const char *name)
|
void Add_script(const char *name)
|
||||||
{
|
{
|
||||||
Add_element_to_list(&Scripts_list, Find_last_slash(name)+1, 0);
|
Add_element_to_list(&Scripts_list, Find_last_slash(name)+1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button_Brush_Factory(void)
|
void Button_Brush_Factory(void)
|
||||||
{
|
{
|
||||||
short clicked_button;
|
short clicked_button;
|
||||||
T_List_button* scriptlist;
|
T_List_button* scriptlist;
|
||||||
T_Scroller_button* scriptscroll;
|
T_Scroller_button* scriptscroll;
|
||||||
char scriptdir[MAX_PATH_CHARACTERS];
|
char scriptdir[MAX_PATH_CHARACTERS];
|
||||||
|
|
||||||
Open_window(33+8*NAME_WIDTH, 162, "Brush Factory");
|
Open_window(33+8*NAME_WIDTH, 162, "Brush Factory");
|
||||||
|
|
||||||
// Here we use the same data container as the fileselectors.
|
// Here we use the same data container as the fileselectors.
|
||||||
// Reinitialize the list
|
// Reinitialize the list
|
||||||
Free_fileselector_list(&Scripts_list);
|
Free_fileselector_list(&Scripts_list);
|
||||||
strcpy(scriptdir, Data_directory);
|
strcpy(scriptdir, Data_directory);
|
||||||
strcat(scriptdir, "scripts/");
|
strcat(scriptdir, "scripts/");
|
||||||
// Add each found file to the list
|
// Add each found file to the list
|
||||||
For_each_file(scriptdir, Add_script);
|
For_each_file(scriptdir, Add_script);
|
||||||
// Sort it
|
// Sort it
|
||||||
Sort_list_of_files(&Scripts_list);
|
Sort_list_of_files(&Scripts_list);
|
||||||
|
|
||||||
Window_set_normal_button(85, 141, 67, 14, "Cancel", 0, 1, KEY_ESC); // 1
|
Window_set_normal_button(85, 141, 67, 14, "Cancel", 0, 1, KEY_ESC); // 1
|
||||||
Window_set_normal_button(10, 141, 67, 14, "Run", 0, 1, 0); // 2
|
Window_set_normal_button(10, 141, 67, 14, "Run", 0, 1, 0); // 2
|
||||||
|
|
||||||
Window_display_frame_in(6, FILESEL_Y - 2, NAME_WIDTH*8+4, 84); // File selector
|
Window_display_frame_in(6, FILESEL_Y - 2, NAME_WIDTH*8+4, 84); // File selector
|
||||||
scriptlist = Window_set_list_button(
|
scriptlist = Window_set_list_button(
|
||||||
// Fileselector
|
// Fileselector
|
||||||
Window_set_special_button(8, FILESEL_Y + 1, NAME_WIDTH*8, 80), // 3
|
Window_set_special_button(8, FILESEL_Y + 1, NAME_WIDTH*8, 80), // 3
|
||||||
// Scroller for the fileselector
|
// Scroller for the fileselector
|
||||||
(scriptscroll = Window_set_scroller_button(NAME_WIDTH*8+14, FILESEL_Y - 1, 82,
|
(scriptscroll = Window_set_scroller_button(NAME_WIDTH*8+14, FILESEL_Y - 1, 82,
|
||||||
Scripts_list.Nb_elements, 10, 0)), // 4
|
Scripts_list.Nb_elements, 10, 0)), // 4
|
||||||
Draw_script_name); // 5
|
Draw_script_name); // 5
|
||||||
|
|
||||||
Window_display_frame_in(6, FILESEL_Y + 88, (NAME_WIDTH+2)*8+4, 3*8+2); // Descr.
|
Window_display_frame_in(6, FILESEL_Y + 88, (NAME_WIDTH+2)*8+4, 3*8+2); // Descr.
|
||||||
|
|
||||||
Window_redraw_list(scriptlist);
|
Window_redraw_list(scriptlist);
|
||||||
Draw_script_information(Get_item_by_index(&Scripts_list,
|
Draw_script_information(Get_item_by_index(&Scripts_list,
|
||||||
scriptlist->List_start + scriptlist->Cursor_position));
|
scriptlist->List_start + scriptlist->Cursor_position));
|
||||||
|
|
||||||
Update_window_area(0, 0, Window_width, Window_height);
|
Update_window_area(0, 0, Window_width, Window_height);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
clicked_button = Window_clicked_button();
|
clicked_button = Window_clicked_button();
|
||||||
|
|
||||||
switch (clicked_button)
|
switch (clicked_button)
|
||||||
{
|
{
|
||||||
case 5:
|
case 5:
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Draw_script_information(Get_item_by_index(&Scripts_list,
|
Draw_script_information(Get_item_by_index(&Scripts_list,
|
||||||
scriptlist->List_start + scriptlist->Cursor_position));
|
scriptlist->List_start + scriptlist->Cursor_position));
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (clicked_button <= 0 || clicked_button >= 3);
|
} while (clicked_button <= 0 || clicked_button >= 3);
|
||||||
|
|
||||||
if (clicked_button == 2) // Run the script
|
if (clicked_button == 2) // Run the script
|
||||||
{
|
{
|
||||||
lua_State* L;
|
lua_State* L;
|
||||||
const char* message;
|
const char* message;
|
||||||
|
|
||||||
// Some scripts are slow
|
// Some scripts are slow
|
||||||
@ -767,24 +767,24 @@ void Button_Brush_Factory(void)
|
|||||||
|
|
||||||
L = lua_open();
|
L = lua_open();
|
||||||
|
|
||||||
lua_register(L,"putbrushpixel",L_PutBrushPixel);
|
lua_register(L,"putbrushpixel",L_PutBrushPixel);
|
||||||
lua_register(L,"getbrushpixel",L_GetBrushPixel);
|
lua_register(L,"getbrushpixel",L_GetBrushPixel);
|
||||||
lua_register(L,"getbrushbackuppixel",L_GetBrushBackupPixel);
|
lua_register(L,"getbrushbackuppixel",L_GetBrushBackupPixel);
|
||||||
lua_register(L,"putpicturepixel",L_PutPicturePixel);
|
lua_register(L,"putpicturepixel",L_PutPicturePixel);
|
||||||
lua_register(L,"getpicturepixel",L_GetPicturePixel);
|
lua_register(L,"getpicturepixel",L_GetPicturePixel);
|
||||||
lua_register(L,"getlayerpixel",L_GetLayerPixel);
|
lua_register(L,"getlayerpixel",L_GetLayerPixel);
|
||||||
lua_register(L,"getbackuppixel",L_GetBackupPixel);
|
lua_register(L,"getbackuppixel",L_GetBackupPixel);
|
||||||
lua_register(L,"setbrushsize",L_SetBrushSize);
|
lua_register(L,"setbrushsize",L_SetBrushSize);
|
||||||
lua_register(L,"setpicturesize",L_SetPictureSize);
|
lua_register(L,"setpicturesize",L_SetPictureSize);
|
||||||
lua_register(L,"getbrushsize",L_GetBrushSize);
|
lua_register(L,"getbrushsize",L_GetBrushSize);
|
||||||
lua_register(L,"getpicturesize",L_GetPictureSize);
|
lua_register(L,"getpicturesize",L_GetPictureSize);
|
||||||
lua_register(L,"setcolor",L_SetColor);
|
lua_register(L,"setcolor",L_SetColor);
|
||||||
lua_register(L,"getcolor",L_GetColor);
|
lua_register(L,"getcolor",L_GetColor);
|
||||||
lua_register(L,"getbackupcolor",L_GetBackupColor);
|
lua_register(L,"getbackupcolor",L_GetBackupColor);
|
||||||
lua_register(L,"matchcolor",L_MatchColor);
|
lua_register(L,"matchcolor",L_MatchColor);
|
||||||
lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor);
|
lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor);
|
||||||
lua_register(L,"inputbox",L_InputBox);
|
lua_register(L,"inputbox",L_InputBox);
|
||||||
lua_register(L,"messagebox",L_MessageBox);
|
lua_register(L,"messagebox",L_MessageBox);
|
||||||
lua_register(L,"getforecolor",L_GetForeColor);
|
lua_register(L,"getforecolor",L_GetForeColor);
|
||||||
lua_register(L,"getbackcolor",L_GetBackColor);
|
lua_register(L,"getbackcolor",L_GetBackColor);
|
||||||
lua_register(L,"gettranscolor",L_GetTransColor);
|
lua_register(L,"gettranscolor",L_GetTransColor);
|
||||||
@ -795,14 +795,14 @@ void Button_Brush_Factory(void)
|
|||||||
lua_register(L,"getsparetranscolor",L_GetSpareTransColor);
|
lua_register(L,"getsparetranscolor",L_GetSpareTransColor);
|
||||||
|
|
||||||
|
|
||||||
// For debug only
|
// For debug only
|
||||||
// luaL_openlibs(L);
|
// luaL_openlibs(L);
|
||||||
|
|
||||||
luaopen_math(L);
|
luaopen_math(L);
|
||||||
|
|
||||||
strcat(scriptdir, Get_item_by_index(&Scripts_list,
|
strcat(scriptdir, Get_item_by_index(&Scripts_list,
|
||||||
scriptlist->List_start + scriptlist->Cursor_position)
|
scriptlist->List_start + scriptlist->Cursor_position)
|
||||||
-> Full_name);
|
-> Full_name);
|
||||||
|
|
||||||
// TODO The script may modify the picture, so we do a backup here.
|
// TODO The script may modify the picture, so we do a backup here.
|
||||||
// If the script is only touching the brush, this isn't needed...
|
// If the script is only touching the brush, this isn't needed...
|
||||||
@ -822,24 +822,24 @@ void Button_Brush_Factory(void)
|
|||||||
{
|
{
|
||||||
Verbose_message("Error!", "Out of memory!");
|
Verbose_message("Error!", "Out of memory!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(Brush_backup, Brush, ((long)Brush_height)*Brush_width);
|
memcpy(Brush_backup, Brush, ((long)Brush_height)*Brush_width);
|
||||||
|
|
||||||
if (luaL_loadfile(L,scriptdir) != 0)
|
if (luaL_loadfile(L,scriptdir) != 0)
|
||||||
{
|
{
|
||||||
message = lua_tostring(L, 1);
|
message = lua_tostring(L, 1);
|
||||||
if(message)
|
if(message)
|
||||||
Verbose_message("Error!", message);
|
Verbose_message("Error!", message);
|
||||||
else
|
else
|
||||||
Warning_message("Unknown error loading script!");
|
Warning_message("Unknown error loading script!");
|
||||||
}
|
}
|
||||||
else if (lua_pcall(L, 0, 0, 0) != 0)
|
else if (lua_pcall(L, 0, 0, 0) != 0)
|
||||||
{
|
{
|
||||||
int stack_size;
|
int stack_size;
|
||||||
stack_size= lua_gettop(L);
|
stack_size= lua_gettop(L);
|
||||||
if (stack_size>0 && (message = lua_tostring(L, stack_size))!=NULL)
|
if (stack_size>0 && (message = lua_tostring(L, stack_size))!=NULL)
|
||||||
Verbose_message("Error running script", message);
|
Verbose_message("Error running script", message);
|
||||||
else
|
else
|
||||||
Warning_message("Unknown error running script!");
|
Warning_message("Unknown error running script!");
|
||||||
}
|
}
|
||||||
@ -854,15 +854,15 @@ void Button_Brush_Factory(void)
|
|||||||
}
|
}
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
|
|
||||||
lua_close(L);
|
lua_close(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
Close_window();
|
Close_window();
|
||||||
if (Brush_was_altered)
|
if (Brush_was_altered)
|
||||||
Change_paintbrush_shape(PAINTBRUSH_SHAPE_COLOR_BRUSH);
|
Change_paintbrush_shape(PAINTBRUSH_SHAPE_COLOR_BRUSH);
|
||||||
Unselect_button(BUTTON_BRUSH_EFFECTS);
|
Unselect_button(BUTTON_BRUSH_EFFECTS);
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // NOLUA
|
#else // NOLUA
|
||||||
|
|||||||
46
graph.c
46
graph.c
@ -517,10 +517,10 @@ try_again:
|
|||||||
case 0: // Always smallest possible
|
case 0: // Always smallest possible
|
||||||
Menu_factor_X=1;
|
Menu_factor_X=1;
|
||||||
Menu_factor_Y=1;
|
Menu_factor_Y=1;
|
||||||
break;
|
break;
|
||||||
default: // Stay below some reasonable size
|
default: // Stay below some reasonable size
|
||||||
Menu_factor_X=Min(factor,abs(Config.Ratio));
|
Menu_factor_X=Min(factor,abs(Config.Ratio));
|
||||||
Menu_factor_Y=Min(factor,abs(Config.Ratio));
|
Menu_factor_Y=Min(factor,abs(Config.Ratio));
|
||||||
}
|
}
|
||||||
if (Pixel_height>Pixel_width && Screen_width>=Menu_factor_X*2*320)
|
if (Pixel_height>Pixel_width && Screen_width>=Menu_factor_X*2*320)
|
||||||
Menu_factor_X*=2;
|
Menu_factor_X*=2;
|
||||||
@ -529,7 +529,7 @@ try_again:
|
|||||||
|
|
||||||
free(Horizontal_line_buffer);
|
free(Horizontal_line_buffer);
|
||||||
Horizontal_line_buffer=(byte *)malloc(Pixel_width *
|
Horizontal_line_buffer=(byte *)malloc(Pixel_width *
|
||||||
((Screen_width>Main_image_width)?Screen_width:Main_image_width));
|
((Screen_width>Main_image_width)?Screen_width:Main_image_width));
|
||||||
|
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main_palette);
|
||||||
|
|
||||||
@ -1444,7 +1444,7 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
|||||||
dx = *bx-ax;
|
dx = *bx-ax;
|
||||||
dy = *by-ay;
|
dy = *by-ay;
|
||||||
|
|
||||||
// No mouse move: no need to clamp anything
|
// No mouse move: no need to clamp anything
|
||||||
if (dx==0 || dy == 0) return;
|
if (dx==0 || dy == 0) return;
|
||||||
|
|
||||||
// Determine angle (heading)
|
// Determine angle (heading)
|
||||||
@ -1454,39 +1454,39 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
|||||||
//dx=abs(dx);
|
//dx=abs(dx);
|
||||||
//dy=abs(dy);
|
//dy=abs(dy);
|
||||||
|
|
||||||
// Negative Y
|
// Negative Y
|
||||||
if (angle < M_PI*(-15.0/16.0) || angle > M_PI*(15.0/16.0))
|
if (angle < M_PI*(-15.0/16.0) || angle > M_PI*(15.0/16.0))
|
||||||
{
|
{
|
||||||
*bx=ax;
|
*bx=ax;
|
||||||
*by=ay + dy;
|
*by=ay + dy;
|
||||||
}
|
}
|
||||||
// Iso close to negative Y
|
// Iso close to negative Y
|
||||||
else if (angle < M_PI*(-13.0/16.0))
|
else if (angle < M_PI*(-13.0/16.0))
|
||||||
{
|
{
|
||||||
dy=dy | 1; // Round up to next odd number
|
dy=dy | 1; // Round up to next odd number
|
||||||
*bx=ax + dy/2;
|
*bx=ax + dy/2;
|
||||||
*by=ay + dy;
|
*by=ay + dy;
|
||||||
}
|
}
|
||||||
// 45deg
|
// 45deg
|
||||||
else if (angle < M_PI*(-11.0/16.0))
|
else if (angle < M_PI*(-11.0/16.0))
|
||||||
{
|
{
|
||||||
*by = (*by + ay + dx)/2;
|
*by = (*by + ay + dx)/2;
|
||||||
*bx = ax - ay + *by;
|
*bx = ax - ay + *by;
|
||||||
}
|
}
|
||||||
// Iso close to negative X
|
// Iso close to negative X
|
||||||
else if (angle < M_PI*(-9.0/16.0))
|
else if (angle < M_PI*(-9.0/16.0))
|
||||||
{
|
{
|
||||||
dx=dx | 1; // Round up to next odd number
|
dx=dx | 1; // Round up to next odd number
|
||||||
*bx=ax + dx;
|
*bx=ax + dx;
|
||||||
*by=ay + dx/2;
|
*by=ay + dx/2;
|
||||||
}
|
}
|
||||||
// Negative X
|
// Negative X
|
||||||
else if (angle < M_PI*(-7.0/16.0))
|
else if (angle < M_PI*(-7.0/16.0))
|
||||||
{
|
{
|
||||||
*bx=ax + dx;
|
*bx=ax + dx;
|
||||||
*by=ay;
|
*by=ay;
|
||||||
}
|
}
|
||||||
// Iso close to negative X
|
// Iso close to negative X
|
||||||
else if (angle < M_PI*(-5.0/16.0))
|
else if (angle < M_PI*(-5.0/16.0))
|
||||||
{
|
{
|
||||||
dx=dx | 1; // Round up to next odd number
|
dx=dx | 1; // Round up to next odd number
|
||||||
@ -1505,7 +1505,7 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
|||||||
dy=dy | 1; // Round up to next odd number
|
dy=dy | 1; // Round up to next odd number
|
||||||
*bx=ax - dy/2;
|
*bx=ax - dy/2;
|
||||||
*by=ay + dy;
|
*by=ay + dy;
|
||||||
}
|
}
|
||||||
// Positive Y
|
// Positive Y
|
||||||
else if (angle < M_PI*(1.0/16.0))
|
else if (angle < M_PI*(1.0/16.0))
|
||||||
{
|
{
|
||||||
@ -1518,7 +1518,7 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
|||||||
dy=dy | 1; // Round up to next odd number
|
dy=dy | 1; // Round up to next odd number
|
||||||
*bx=ax + dy/2;
|
*bx=ax + dy/2;
|
||||||
*by=ay + dy;
|
*by=ay + dy;
|
||||||
}
|
}
|
||||||
// 45 degrees
|
// 45 degrees
|
||||||
else if (angle < M_PI*(5.0/16.0))
|
else if (angle < M_PI*(5.0/16.0))
|
||||||
{
|
{
|
||||||
@ -1531,13 +1531,13 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
|||||||
dx=dx | 1; // Round up to next odd number
|
dx=dx | 1; // Round up to next odd number
|
||||||
*bx=ax + dx;
|
*bx=ax + dx;
|
||||||
*by=ay + dx/2;
|
*by=ay + dx/2;
|
||||||
}
|
}
|
||||||
// Positive X
|
// Positive X
|
||||||
else if (angle < M_PI*(9.0/16.0))
|
else if (angle < M_PI*(9.0/16.0))
|
||||||
{
|
{
|
||||||
*bx=ax + dx;
|
*bx=ax + dx;
|
||||||
*by=ay;
|
*by=ay;
|
||||||
}
|
}
|
||||||
// Iso close to positive X
|
// Iso close to positive X
|
||||||
else if (angle < M_PI*(11.0/16.0))
|
else if (angle < M_PI*(11.0/16.0))
|
||||||
{
|
{
|
||||||
@ -1557,7 +1557,7 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
|
|||||||
dy=dy | 1; // Round up to next odd number
|
dy=dy | 1; // Round up to next odd number
|
||||||
*bx=ax - dy/2;
|
*bx=ax - dy/2;
|
||||||
*by=ay + dy;
|
*by=ay + dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2925,7 +2925,7 @@ void Pixel_in_current_screen (word x,word y,byte color,int with_preview)
|
|||||||
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer])=color;
|
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer])=color;
|
||||||
if (with_preview)
|
if (with_preview)
|
||||||
Pixel_preview(x,y,color);
|
Pixel_preview(x,y,color);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixel_in_current_layer(word x,word y, byte color)
|
void Pixel_in_current_layer(word x,word y, byte color)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user