diff --git a/buttons.c b/buttons.c index 42462141..be3f32b6 100644 --- a/buttons.c +++ b/buttons.c @@ -945,8 +945,8 @@ void Add_font_or_skin(const char *name) fname = name; namelength = strlen(fname); if (namelength>=10 && fname[0]!='_' && !strncasecmp(fname, "skin_", 5) - && (!strcasecmp(fname + namelength - 4,".png") - || !strcasecmp(fname + namelength - 4,".gif"))) + && (!strcasecmp(fname + namelength - 4,".png") + || !strcasecmp(fname + namelength - 4,".gif"))) { 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) - && (!strcasecmp(fname + namelength - 4, ".png"))) + && (!strcasecmp(fname + namelength - 4, ".png"))) { 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); // Reformat the short name differently 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); Print_in_window(x, y, current_item->Short_name, MC_Black, - (highlighted)?MC_Dark:MC_Light); + (highlighted)?MC_Dark:MC_Light); } } diff --git a/engine.c b/engine.c index 766b902b..d02cb7b8 100644 --- a/engine.c +++ b/engine.c @@ -1112,22 +1112,22 @@ void Main_handler(void) } else { - // 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) - // This allows nice smooth mouse movement. - const int delay = 10; + // 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) + // This allows nice smooth mouse movement. + const int delay = 10; - Uint32 debut; - debut = SDL_GetTicks(); - // Première attente : le complément de "delay" millisecondes - SDL_Delay(delay - (debut % delay)); - // Si ça ne suffit pas, on complète par des attentes successives de "1ms". - // (Remarque, Windows arrondit généralement aux 10ms supérieures) - while ( SDL_GetTicks()/delay <= debut/delay) - { - SDL_Delay(1); - } - } + Uint32 debut; + debut = SDL_GetTicks(); + // Première attente : le complément de "delay" millisecondes + SDL_Delay(delay - (debut % delay)); + // Si ça ne suffit pas, on complète par des attentes successives de "1ms". + // (Remarque, Windows arrondit généralement aux 10ms supérieures) + while ( SDL_GetTicks()/delay <= debut/delay) + { + SDL_Delay(1); + } + } // Gestion de la souris @@ -2134,59 +2134,59 @@ void Get_color_behind_window(byte * color, byte * click) Paintbrush_hidden=1; c=-1; // color pointée: au début aucune, comme ça on initialise tout 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(); do { - if(!Get_input())SDL_Delay(20); + if(!Get_input())SDL_Delay(20); - if ((Mouse_X!=old_x) || (Mouse_Y!=old_y)) - { - Hide_cursor(); - a=Read_pixel(Mouse_X,Mouse_Y); - if (a!=c) - { - c=a; // Mise à jour de la couleur pointée - if (Menu_is_visible_before_window) - { - sprintf(str,"%d",a); - d=strlen(str); - strcat(str," ("); - sprintf(str+strlen(str),"%d",Main_palette[a].R); - strcat(str,","); - sprintf(str+strlen(str),"%d",Main_palette[a].G); - strcat(str,","); - sprintf(str+strlen(str),"%d",Main_palette[a].B); - strcat(str,")"); - a=24-d; - for (index=strlen(str); index>1); Brush_offset_Y=(Brush_height>>1); - return 0; + return 0; } int L_GetBrushSize(lua_State* L) { - lua_pushinteger(L, Brush_width); - lua_pushinteger(L, Brush_height); - return 2; + lua_pushinteger(L, Brush_width); + lua_pushinteger(L, Brush_height); + return 2; } int L_GetBrushTransparentColor(lua_State* L) { - lua_pushinteger(L, Back_color); - return 1; + lua_pushinteger(L, Back_color); + return 1; } int L_PutBrushPixel(lua_State* L) { int x = lua_tonumber(L,1); int y = lua_tonumber(L,2); - uint8_t c = lua_tonumber(L,3); - - Brush_was_altered=1; - + uint8_t c = lua_tonumber(L,3); + + Brush_was_altered=1; + if (x<0 || y<0 || x>=Brush_width || y>=Brush_height) ; else { 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 x = lua_tonumber(L,1); int y = lua_tonumber(L,2); - uint8_t c; + uint8_t c; if (x<0 || y<0 || x>=Brush_width || y>=Brush_height) { c = Back_color; // Return 'transparent' @@ -136,15 +136,15 @@ int L_GetBrushPixel(lua_State* L) { c = Read_pixel_from_brush(x, y); } - lua_pushinteger(L, c); - return 1; + lua_pushinteger(L, c); + return 1; } int L_GetBrushBackupPixel(lua_State* L) { int x = lua_tonumber(L,1); 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) { c = Back_color; // Return 'transparent' @@ -153,8 +153,8 @@ int L_GetBrushBackupPixel(lua_State* L) { c = *(Brush_backup + y * Brush_backup_width + x); } - lua_pushinteger(L, c); - return 1; + lua_pushinteger(L, c); + return 1; } 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) return luaL_error(L, "SetPictureSize: Unreasonable dimensions"); - Resize_image(w, h); // TODO: a return value to catch runtime errors - return 0; + Resize_image(w, h); // TODO: a return value to catch runtime errors + return 0; } int L_GetPictureSize(lua_State* L) { - lua_pushinteger(L, Main_image_width); - lua_pushinteger(L, Main_image_height); - return 2; + lua_pushinteger(L, Main_image_width); + lua_pushinteger(L, Main_image_height); + return 2; } int L_PutPicturePixel(lua_State* L) @@ -188,8 +188,8 @@ int L_PutPicturePixel(lua_State* L) // Silently ignored return 0; } - Pixel_in_current_screen(x, y, c, 0); - return 0; // no values returned for lua + Pixel_in_current_screen(x, y, c, 0); + return 0; // no values returned for lua } int L_GetPicturePixel(lua_State* L) @@ -201,10 +201,10 @@ int L_GetPicturePixel(lua_State* L) { // Silently return the image's transparent color lua_pushinteger(L, Main_backups->Pages->Transparent_color); - return 1; + return 1; } - lua_pushinteger(L, Read_pixel_from_current_screen(x,y)); - return 1; + lua_pushinteger(L, Read_pixel_from_current_screen(x,y)); + return 1; } int L_GetBackupPixel(lua_State* L) @@ -216,10 +216,10 @@ int L_GetBackupPixel(lua_State* L) { // Silently return the image's transparent color lua_pushinteger(L, Main_backups->Pages->Transparent_color); - return 1; + return 1; } - lua_pushinteger(L, Read_pixel_from_backup_screen(x,y)); - return 1; + lua_pushinteger(L, Read_pixel_from_backup_screen(x,y)); + return 1; } int L_GetLayerPixel(lua_State* L) @@ -231,19 +231,19 @@ int L_GetLayerPixel(lua_State* L) { // Silently return the image's transparent color lua_pushinteger(L, Main_backups->Pages->Transparent_color); - return 1; + return 1; } - lua_pushinteger(L, Read_pixel_from_current_layer(x,y)); - return 1; + lua_pushinteger(L, Read_pixel_from_current_layer(x,y)); + return 1; } // Spare int L_GetSparePictureSize(lua_State* L) { - lua_pushinteger(L, Spare_image_width); - lua_pushinteger(L, Spare_image_height); - return 2; + lua_pushinteger(L, Spare_image_width); + lua_pushinteger(L, Spare_image_height); + return 2; } int L_GetSpareLayerPixel(lua_State* L) @@ -255,10 +255,10 @@ int L_GetSpareLayerPixel(lua_State* L) { // Silently return the image's 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)); - return 1; + lua_pushinteger(L, *(Spare_backups->Pages->Image[Spare_current_layer] + y*Spare_image_width + x)); + return 1; } int L_GetSparePicturePixel(lua_State* L) @@ -270,26 +270,26 @@ int L_GetSparePicturePixel(lua_State* L) { // Silently return the image's transparent color lua_pushinteger(L, Spare_backups->Pages->Transparent_color); - return 1; + return 1; } - lua_pushinteger(L, Read_pixel_from_spare_screen(x,y)); - return 1; + lua_pushinteger(L, Read_pixel_from_spare_screen(x,y)); + return 1; } 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].G); - lua_pushinteger(L, Spare_palette[c].B); - return 3; + lua_pushinteger(L, Spare_palette[c].R); + lua_pushinteger(L, Spare_palette[c].G); + lua_pushinteger(L, Spare_palette[c].B); + return 3; } int L_GetSpareTransColor(lua_State* L) { - lua_pushinteger(L, Spare_backups->Pages->Transparent_color); - return 1; + lua_pushinteger(L, Spare_backups->Pages->Transparent_color); + return 1; } @@ -305,29 +305,29 @@ int L_SetColor(lua_State* L) Main_palette[c].R=Round_palette_component(r); Main_palette[c].G=Round_palette_component(g); Main_palette[c].B=Round_palette_component(b); - // Set_color(c, r, g, b); Not needed. Update screen when script is finished - Palette_has_changed=1; - return 0; + // Set_color(c, r, g, b); Not needed. Update screen when script is finished + Palette_has_changed=1; + return 0; } 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].G); - lua_pushinteger(L, Main_palette[c].B); - return 3; + lua_pushinteger(L, Main_palette[c].R); + lua_pushinteger(L, Main_palette[c].G); + lua_pushinteger(L, Main_palette[c].B); + return 3; } 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].G); - lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].B); - return 3; + 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].B); + return 3; } int L_MatchColor(lua_State* L) @@ -343,20 +343,20 @@ int L_MatchColor(lua_State* L) int L_GetForeColor(lua_State* L) { - lua_pushinteger(L, Fore_color); - return 1; + lua_pushinteger(L, Fore_color); + return 1; } int L_GetBackColor(lua_State* L) { - lua_pushinteger(L, Back_color); - return 1; + lua_pushinteger(L, Back_color); + return 1; } int L_GetTransColor(lua_State* L) { - lua_pushinteger(L, Main_backups->Pages->Transparent_color); - return 1; + lua_pushinteger(L, Main_backups->Pages->Transparent_color); + return 1; } @@ -591,7 +591,7 @@ int L_MessageBox(lua_State* L) } 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 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) - { - short name_size; - - current_item = Get_item_by_index(&Scripts_list, index); + if (Scripts_list.Nb_elements) + { + short name_size; + + current_item = Get_item_by_index(&Scripts_list, index); - Print_in_window_limited(x, y, current_item->Full_name, NAME_WIDTH, MC_Black, - (highlighted)?MC_Dark:MC_Light); - name_size=strlen(current_item->Full_name); - // Clear remaining area on the right - if (name_sizeFull_name, NAME_WIDTH, MC_Black, + (highlighted)?MC_Dark:MC_Light); + name_size=strlen(current_item->Full_name); + // Clear remaining area on the right + if (name_sizeFull_name && script_item->Full_name[0]!='\0') { strcpy(full_name, Data_directory); - strcat(full_name, "scripts/"); - strcat(full_name, script_item->Full_name); + strcat(full_name, "scripts/"); + strcat(full_name, script_item->Full_name); x=0; @@ -691,71 +691,71 @@ void Draw_script_information(T_Fileselector_item * script_item) // Add a script to the list 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) { - short clicked_button; - T_List_button* scriptlist; - T_Scroller_button* scriptscroll; - char scriptdir[MAX_PATH_CHARACTERS]; + short clicked_button; + T_List_button* scriptlist; + T_Scroller_button* scriptscroll; + char scriptdir[MAX_PATH_CHARACTERS]; Open_window(33+8*NAME_WIDTH, 162, "Brush Factory"); - // Here we use the same data container as the fileselectors. - // Reinitialize the list - Free_fileselector_list(&Scripts_list); - strcpy(scriptdir, Data_directory); - strcat(scriptdir, "scripts/"); - // Add each found file to the list - For_each_file(scriptdir, Add_script); - // Sort it - Sort_list_of_files(&Scripts_list); + // Here we use the same data container as the fileselectors. + // Reinitialize the list + Free_fileselector_list(&Scripts_list); + strcpy(scriptdir, Data_directory); + strcat(scriptdir, "scripts/"); + // Add each found file to the list + For_each_file(scriptdir, Add_script); + // Sort it + Sort_list_of_files(&Scripts_list); - 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(85, 141, 67, 14, "Cancel", 0, 1, KEY_ESC); // 1 + 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 - scriptlist = Window_set_list_button( - // Fileselector - Window_set_special_button(8, FILESEL_Y + 1, NAME_WIDTH*8, 80), // 3 - // Scroller for the fileselector - (scriptscroll = Window_set_scroller_button(NAME_WIDTH*8+14, FILESEL_Y - 1, 82, - Scripts_list.Nb_elements, 10, 0)), // 4 - Draw_script_name); // 5 - - Window_display_frame_in(6, FILESEL_Y + 88, (NAME_WIDTH+2)*8+4, 3*8+2); // Descr. - - Window_redraw_list(scriptlist); + Window_display_frame_in(6, FILESEL_Y - 2, NAME_WIDTH*8+4, 84); // File selector + scriptlist = Window_set_list_button( + // Fileselector + Window_set_special_button(8, FILESEL_Y + 1, NAME_WIDTH*8, 80), // 3 + // Scroller for the fileselector + (scriptscroll = Window_set_scroller_button(NAME_WIDTH*8+14, FILESEL_Y - 1, 82, + Scripts_list.Nb_elements, 10, 0)), // 4 + Draw_script_name); // 5 + + Window_display_frame_in(6, FILESEL_Y + 88, (NAME_WIDTH+2)*8+4, 3*8+2); // Descr. + + Window_redraw_list(scriptlist); Draw_script_information(Get_item_by_index(&Scripts_list, scriptlist->List_start + scriptlist->Cursor_position)); - Update_window_area(0, 0, Window_width, Window_height); - Display_cursor(); + Update_window_area(0, 0, Window_width, Window_height); + Display_cursor(); - do { - clicked_button = Window_clicked_button(); + do { + clicked_button = Window_clicked_button(); - switch (clicked_button) - { - case 5: + switch (clicked_button) + { + case 5: Hide_cursor(); Draw_script_information(Get_item_by_index(&Scripts_list, scriptlist->List_start + scriptlist->Cursor_position)); Display_cursor(); - break; - - - default: - break; - } - - } while (clicked_button <= 0 || clicked_button >= 3); + break; + + + default: + break; + } + + } while (clicked_button <= 0 || clicked_button >= 3); - if (clicked_button == 2) // Run the script - { - lua_State* L; + if (clicked_button == 2) // Run the script + { + lua_State* L; const char* message; // Some scripts are slow @@ -767,24 +767,24 @@ void Button_Brush_Factory(void) L = lua_open(); - lua_register(L,"putbrushpixel",L_PutBrushPixel); - lua_register(L,"getbrushpixel",L_GetBrushPixel); - lua_register(L,"getbrushbackuppixel",L_GetBrushBackupPixel); - lua_register(L,"putpicturepixel",L_PutPicturePixel); - lua_register(L,"getpicturepixel",L_GetPicturePixel); - lua_register(L,"getlayerpixel",L_GetLayerPixel); - lua_register(L,"getbackuppixel",L_GetBackupPixel); - lua_register(L,"setbrushsize",L_SetBrushSize); - lua_register(L,"setpicturesize",L_SetPictureSize); - lua_register(L,"getbrushsize",L_GetBrushSize); - lua_register(L,"getpicturesize",L_GetPictureSize); - lua_register(L,"setcolor",L_SetColor); - lua_register(L,"getcolor",L_GetColor); - lua_register(L,"getbackupcolor",L_GetBackupColor); - lua_register(L,"matchcolor",L_MatchColor); - lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor); - lua_register(L,"inputbox",L_InputBox); - lua_register(L,"messagebox",L_MessageBox); + lua_register(L,"putbrushpixel",L_PutBrushPixel); + lua_register(L,"getbrushpixel",L_GetBrushPixel); + lua_register(L,"getbrushbackuppixel",L_GetBrushBackupPixel); + lua_register(L,"putpicturepixel",L_PutPicturePixel); + lua_register(L,"getpicturepixel",L_GetPicturePixel); + lua_register(L,"getlayerpixel",L_GetLayerPixel); + lua_register(L,"getbackuppixel",L_GetBackupPixel); + lua_register(L,"setbrushsize",L_SetBrushSize); + lua_register(L,"setpicturesize",L_SetPictureSize); + lua_register(L,"getbrushsize",L_GetBrushSize); + lua_register(L,"getpicturesize",L_GetPictureSize); + lua_register(L,"setcolor",L_SetColor); + lua_register(L,"getcolor",L_GetColor); + lua_register(L,"getbackupcolor",L_GetBackupColor); + lua_register(L,"matchcolor",L_MatchColor); + lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor); + lua_register(L,"inputbox",L_InputBox); + lua_register(L,"messagebox",L_MessageBox); lua_register(L,"getforecolor",L_GetForeColor); lua_register(L,"getbackcolor",L_GetBackColor); lua_register(L,"gettranscolor",L_GetTransColor); @@ -795,14 +795,14 @@ void Button_Brush_Factory(void) lua_register(L,"getsparetranscolor",L_GetSpareTransColor); - // For debug only - // luaL_openlibs(L); + // For debug only + // luaL_openlibs(L); luaopen_math(L); - strcat(scriptdir, Get_item_by_index(&Scripts_list, - scriptlist->List_start + scriptlist->Cursor_position) - -> Full_name); + strcat(scriptdir, Get_item_by_index(&Scripts_list, + scriptlist->List_start + scriptlist->Cursor_position) + -> Full_name); // 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... @@ -822,24 +822,24 @@ void Button_Brush_Factory(void) { Verbose_message("Error!", "Out of memory!"); } - else - { - memcpy(Brush_backup, Brush, ((long)Brush_height)*Brush_width); - - if (luaL_loadfile(L,scriptdir) != 0) + else + { + memcpy(Brush_backup, Brush, ((long)Brush_height)*Brush_width); + + if (luaL_loadfile(L,scriptdir) != 0) { message = lua_tostring(L, 1); if(message) - Verbose_message("Error!", message); + Verbose_message("Error!", message); else 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; stack_size= lua_gettop(L); if (stack_size>0 && (message = lua_tostring(L, stack_size))!=NULL) - Verbose_message("Error running script", message); + Verbose_message("Error running script", message); else Warning_message("Unknown error running script!"); } @@ -854,15 +854,15 @@ void Button_Brush_Factory(void) } End_of_modification(); - lua_close(L); - } + lua_close(L); + } - Close_window(); - if (Brush_was_altered) - Change_paintbrush_shape(PAINTBRUSH_SHAPE_COLOR_BRUSH); - Unselect_button(BUTTON_BRUSH_EFFECTS); + Close_window(); + if (Brush_was_altered) + Change_paintbrush_shape(PAINTBRUSH_SHAPE_COLOR_BRUSH); + Unselect_button(BUTTON_BRUSH_EFFECTS); Display_all_screen(); - Display_cursor(); + Display_cursor(); } #else // NOLUA diff --git a/graph.c b/graph.c index fe5a880b..b85f6695 100644 --- a/graph.c +++ b/graph.c @@ -517,10 +517,10 @@ try_again: case 0: // Always smallest possible Menu_factor_X=1; Menu_factor_Y=1; - break; - default: // Stay below some reasonable size - Menu_factor_X=Min(factor,abs(Config.Ratio)); - Menu_factor_Y=Min(factor,abs(Config.Ratio)); + break; + default: // Stay below some reasonable size + Menu_factor_X=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) Menu_factor_X*=2; @@ -529,7 +529,7 @@ try_again: free(Horizontal_line_buffer); 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); @@ -1444,7 +1444,7 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by) dx = *bx-ax; 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; // Determine angle (heading) @@ -1454,39 +1454,39 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by) //dx=abs(dx); //dy=abs(dy); - // Negative Y + // Negative Y if (angle < M_PI*(-15.0/16.0) || angle > M_PI*(15.0/16.0)) { *bx=ax; *by=ay + dy; - } - // Iso close to negative Y + } + // Iso close to negative Y else if (angle < M_PI*(-13.0/16.0)) { dy=dy | 1; // Round up to next odd number *bx=ax + dy/2; *by=ay + dy; - } - // 45deg + } + // 45deg else if (angle < M_PI*(-11.0/16.0)) { *by = (*by + ay + dx)/2; *bx = ax - ay + *by; - } - // Iso close to negative X + } + // Iso close to negative X else if (angle < M_PI*(-9.0/16.0)) { dx=dx | 1; // Round up to next odd number *bx=ax + dx; *by=ay + dx/2; - } - // Negative X + } + // Negative X else if (angle < M_PI*(-7.0/16.0)) { *bx=ax + dx; *by=ay; - } - // Iso close to negative X + } + // Iso close to negative X else if (angle < M_PI*(-5.0/16.0)) { 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 *bx=ax - dy/2; *by=ay + dy; - } + } // Positive Y 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 *bx=ax + dy/2; *by=ay + dy; - } + } // 45 degrees 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 *bx=ax + dx; *by=ay + dx/2; - } + } // Positive X else if (angle < M_PI*(9.0/16.0)) { *bx=ax + dx; *by=ay; - } + } // Iso close to positive X 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 *bx=ax - dy/2; *by=ay + dy; - } + } 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; if (with_preview) Pixel_preview(x,y,color); - #endif + #endif } void Pixel_in_current_layer(word x,word y, byte color)