diff --git a/engine.c b/engine.c index b3dd0200..82b9af99 100644 --- a/engine.c +++ b/engine.c @@ -58,48 +58,6 @@ Func_effect Effect_function_before_cancel; ///This table holds pointers to the saved window backgrounds. We can have up to 8 windows open at a time. byte* Window_background[8]; -///Disables all the effects -void Cancel_effects(void) -{ - Shade_mode_before_cancel=Shade_mode; - Shade_mode=0; - - Quick_shade_mode_before_cancel=Quick_shade_mode; - Quick_shade_mode=0; - - Stencil_mode_before_cancel=Stencil_mode; - Stencil_mode=0; - - Sieve_mode_before_cancel=Sieve_mode; - Sieve_mode=0; - - Colorize_mode_before_cancel=Colorize_mode; - Colorize_mode=0; - - Smooth_mode_before_cancel=Smooth_mode; - Smooth_mode=0; - - Tiling_mode_before_cancel=Tiling_mode; - Tiling_mode=0; - - Effect_function_before_cancel=Effect_function; - Effect_function=No_effect; -} - - -///Get the effects and drawing modes back -void Restore_effects(void) -{ - Shade_mode =Shade_mode_before_cancel; - Quick_shade_mode=Quick_shade_mode_before_cancel; - Stencil_mode =Stencil_mode_before_cancel; - Sieve_mode =Sieve_mode_before_cancel; - Colorize_mode =Colorize_mode_before_cancel; - Smooth_mode =Smooth_mode_before_cancel; - Tiling_mode =Tiling_mode_before_cancel; - Effect_function =Effect_function_before_cancel; -} - ///Table of tooltip texts for menu buttons char * Menu_tooltip[NB_BUTTONS]= diff --git a/engine.h b/engine.h index 5fbe8990..855c361a 100644 --- a/engine.h +++ b/engine.h @@ -22,17 +22,15 @@ /// Utility functions for the menu and all windows. ////////////////////////////////////////////////////////////////////////////// -void Main_handler (void); +void Main_handler (void); void Draw_menu_button_frame(byte btn_number,byte pressed); -void Unselect_button (int btn_number); -void Select_button (int btn_number,byte click); -void Cancel_effects (void); -void Restore_effects (void); -void Open_window (word width,word height, char * title); -void Close_window (void); +void Unselect_button (int btn_number); +void Select_button (int btn_number,byte click); +void Open_window (word width,word height, char * title); +void Close_window (void); -void Open_popup (word x_pos, word y_pos, word width, word height); -void Close_popup (void); +void Open_popup (word x_pos, word y_pos, word width, word height); +void Close_popup (void); void Window_draw_normal_bouton(word x_pos,word y_pos,word width,word height, char * title,byte undersc_letter,byte clickable); diff --git a/io.c b/io.c index fb1b568f..fe210fb6 100644 --- a/io.c +++ b/io.c @@ -39,23 +39,6 @@ #include "io.h" #include "realpath.h" -word Endian_magic16(word x) -{ - #if SDL_BYTEORDER == SDL_LIL_ENDIAN - return x; - #else - return SDL_Swap16(x); - #endif -} -dword Endian_magic32(dword x) -{ - #if SDL_BYTEORDER == SDL_LIL_ENDIAN - return x; - #else - return SDL_Swap32(x); - #endif -} - // Lit un octet // Renvoie -1 si OK, 0 en cas d'erreur int Read_byte(FILE *file, byte *dest) diff --git a/io.h b/io.h index 17508393..f63aa54f 100644 --- a/io.h +++ b/io.h @@ -31,11 +31,6 @@ /// If you don't, you break another platform. ////////////////////////////////////////////////////////////////////////////// -/// Returns x, swapped if the current target is low-endian. Deprecated, please don't use it. -word Endian_magic16(word x); -/// Returns x, swapped if the current target is low-endian. Deprecated, please don't use it. -dword Endian_magic32(dword x); - /// Reads a single byte from an open file. Returns true if OK, false if a file i/o error occurred. int Read_byte(FILE *file, byte *dest); /// Writes a single byte to an open file. Returns true if OK, false if a file i/o error occurred. diff --git a/loadsave.c b/loadsave.c index d0127e7c..356399af 100644 --- a/loadsave.c +++ b/loadsave.c @@ -5528,20 +5528,8 @@ void Save_PC1(void) } } -/****************************************************************************************** - Functions from op_c.c : load raw 24B (for testing) and load_tga (broken ? incomplete ?) - Saving would be nice as well. -******************************************************************************************/ -void Load_RAW_24b(int width,int height,T_Bitmap24B source) -{ - FILE* file; - - file=fopen("TEST.RAW","rb"); - if (Read_bytes(file,source,width*height*sizeof(T_Components))) - exit(3); - fclose(file); -} +/// UNUSED and UNTESTED function to load a TGA file. void Load_TGA(char * fname,T_Bitmap24B * dest,int * width,int * height) { FILE* fichier; diff --git a/misc.c b/misc.c index fb3b9f2e..111d3d16 100644 --- a/misc.c +++ b/misc.c @@ -774,22 +774,6 @@ void Num2str(dword number,char * str,byte nb_char) str[nb_char]='\0'; } -// Transformer une chaîne en un entier naturel (renvoie -1 si ch. invalide) -int Str2num(char * str) -{ - int value=0; - - for (;*str;str++) - { - if ( (*str>='0') && (*str<='9') ) - value=(value*10)+(*str-'0'); - else - return -1; - } - return value; -} - - // Arrondir un nombre réel à la valeur entière la plus proche short Round(float value) { diff --git a/misc.h b/misc.h index 696e9edf..b12ff1b5 100644 --- a/misc.h +++ b/misc.h @@ -143,7 +143,6 @@ byte New_preview_is_needed; // Bool unsigned long Memory_free(void); void Num2str(dword number,char * str,byte nb_char); -int Str2num(char * str); short Round(float value); short Round_div_max(short numerator,short divisor); diff --git a/op_c.c b/op_c.c index 7d5dff5b..687dc260 100644 --- a/op_c.c +++ b/op_c.c @@ -304,17 +304,6 @@ int OT_get(T_Occurrence_table * t,int r,int g,int b) return t->table[index]; } -void OT_set(T_Occurrence_table * t,int r,int g,int b,int i) -{ - int index; - - r=(r>>t->red_r); - g=(g>>t->red_g); - b=(b>>t->red_b); - index=(r<dec_r) | (g<dec_g) | (b<dec_b); - t->table[index]=i; -} - void OT_inc(T_Occurrence_table * t,int r,int g,int b) { int index; diff --git a/op_c.h b/op_c.h index 21ebc59c..ebd943fe 100644 --- a/op_c.h +++ b/op_c.h @@ -165,7 +165,6 @@ void OT_init(T_Occurrence_table * t); T_Occurrence_table * OT_new(int nbb_r,int nbb_g,int nbb_b); void OT_delete(T_Occurrence_table * t); int OT_get(T_Occurrence_table * t,int r,int g,int b); -void OT_set(T_Occurrence_table * t,int r,int g,int b,int i); void OT_inc(T_Occurrence_table * t,int r,int g,int b); void OT_count_occurrences(T_Occurrence_table * t,T_Bitmap24B image,int size); diff --git a/pages.c b/pages.c index f52f3129..66407e95 100644 --- a/pages.c +++ b/pages.c @@ -228,30 +228,6 @@ void Download_infos_backup(T_List_of_pages * list) FX_feedback_screen=list->Pages[1].Image; } -int Allocate_page(T_Page * page,int width,int height) -{ - // Important: la T_Page ne doit pas déjà désigner une page allouée auquel - // cas celle-ci serait perdue. - - /* Debug : if (page->Image!=NULL) exit(666); */ - - // On alloue la mémoire pour le bitmap - page->Image=(byte *)malloc(width*height); - - // On vérifie que l'allocation se soit bien passée - if (page->Image==NULL) - return 0; // Echec - else - { - page->Width=width; - page->Height=height; - // Important: La mise à jour des autres infos est du ressort de - // l'appelant. - - return 1; // Succès - } -} - void Free_a_page(T_Page * page) { // On peut appeler cette fonction sur une page non allouée. @@ -730,23 +706,6 @@ int Init_all_backup_lists(int size,int width,int height) return return_code; } -void Free_all_backup_lists(void) -{ - // On commence par supprimer les pages une à une dans chacune des listes - // Liste de la page principale - while (Main_backups->Nb_pages_allocated>0) - Free_last_page_of_list(Main_backups); - // Liste de la page de brouillon - while (Spare_backups->Nb_pages_allocated>0) - Free_last_page_of_list(Spare_backups); - - // Puis on peut détruire les structures de liste elles-mêmes - Free_a_list_of_pages(Main_backups); - Free_a_list_of_pages(Spare_backups); - free(Main_backups); - free(Spare_backups); -} - void Set_number_of_backups(int nb_backups) { Change_page_number_of_list(Main_backups,nb_backups+1); diff --git a/pages.h b/pages.h index 288bb249..efc816e5 100644 --- a/pages.h +++ b/pages.h @@ -41,7 +41,6 @@ void Upload_infos_page_main(T_Page * page); void Download_infos_page_spare(T_Page * page); void Upload_infos_page_spare(T_Page * page); void Download_infos_backup(T_List_of_pages * list); -int Allocate_page(T_Page * page,int width,int height); void Free_a_page(T_Page * page); void Copy_S_page(T_Page * dest,T_Page * source); int Size_of_a_page(T_Page * page); @@ -71,7 +70,6 @@ void Free_page_of_a_list(T_List_of_pages * list); /// int Init_all_backup_lists(int size,int width,int height); -void Free_all_backup_lists(void); void Set_number_of_backups(int nb_backups); int Backup_with_new_dimensions(int upload,int width,int height); int Backup_and_resize_the_spare(int width,int height); diff --git a/sdlscreen.c b/sdlscreen.c index d45da51e..6dd348d4 100644 --- a/sdlscreen.c +++ b/sdlscreen.c @@ -191,12 +191,6 @@ byte Get_SDL_pixel_8(SDL_Surface *bmp, int x, int y) return ((byte *)(bmp->pixels))[(y*bmp->pitch+x)]; } -void Clear_screen(byte color) -{ - memset(Screen_SDL->pixels,color,Screen_SDL->pitch*Screen_SDL->h); - Update_rect(0,0,0,0); -} - void Clear_border(byte color) { int width; diff --git a/sdlscreen.h b/sdlscreen.h index cffd48c8..de674193 100644 --- a/sdlscreen.h +++ b/sdlscreen.h @@ -46,9 +46,6 @@ byte * Surface_to_bytefield(SDL_Surface *source, byte * dest); SDL_Color Color_to_SDL_color(byte); byte Get_SDL_pixel_8(SDL_Surface *bmp, int x, int y); -/// Fills the SDL screen with a given color -void Clear_screen(byte color); - /// /// Clears the parts of screen that are outside of the editing area. /// There is such area only if the screen mode is not a multiple of the pixel diff --git a/windows.c b/windows.c index 000e70bc..e6a32213 100644 --- a/windows.c +++ b/windows.c @@ -462,8 +462,7 @@ void Print_general(short x,short y,const char * str,byte text_color,byte backgro } } - // -- Afficher un caractère dans une fenêtre -- - +/// Draws a char in a window void Print_char_in_window(short x_pos,short y_pos,const unsigned char c,byte text_color,byte background_color) { short x,y; @@ -480,28 +479,7 @@ void Print_char_in_window(short x_pos,short y_pos,const unsigned char c,byte tex (*(pixel++)?text_color:background_color)); } - // -- Afficher un caractère sans fond dans une fenêtre -- - -void Print_transparent_char_in_window(short x_pos,short y_pos,const unsigned char c,byte color) -{ - short x,y; - byte *pixel; - x_pos=(x_pos*Menu_factor_X)+Window_pos_X; - y_pos=(y_pos*Menu_factor_Y)+Window_pos_Y; - // Premier pixel du caractère - pixel=Menu_font + (c<<6); - - for (y=0;y<8;y++) - for (x=0;x<8;x++) - { - if (*(pixel++)) - Block(x_pos+(x*Menu_factor_X), y_pos+(y*Menu_factor_Y), - Menu_factor_X, Menu_factor_Y, color); - } -} - - // -- Afficher une chaîne dans une fenêtre, avec taille maxi -- - +///Draws a char in a window, checking for bounds void Print_in_window_limited(short x,short y,const char * str,byte size,byte text_color,byte background_color) { char display_string[256]; @@ -515,8 +493,7 @@ void Print_in_window_limited(short x,short y,const char * str,byte size,byte tex Print_in_window(x, y, display_string, text_color, background_color); } - // -- Afficher une chaîne dans une fenêtre -- - +/// Draws a string in a window void Print_in_window(short x,short y,const char * str,byte text_color,byte background_color) { Print_general((x*Menu_factor_X)+Window_pos_X, @@ -525,17 +502,15 @@ void Print_in_window(short x,short y,const char * str,byte text_color,byte backg Update_rect(x*Menu_factor_X+Window_pos_X,y*Menu_factor_Y+Window_pos_Y,8*Menu_factor_X*strlen(str),8*Menu_factor_Y); } - // -- Afficher une chaîne dans le menu -- - +// Draws a string in the menu's status bar void Print_in_menu(const char * str, short position) { Print_general((18+(position<<3))*Menu_factor_X,Menu_status_Y,str,MC_Black,MC_Light); Update_rect((18+(position<<3))*Menu_factor_X,Menu_status_Y,strlen(str)*8*Menu_factor_X,8*Menu_factor_Y); } - // -- Afficher les coordonnées du pinceau dans le menu -- - -// Note : cette fonction n'affiche que les chiffres, pas les X: Y: qui sont dans la gestion principale, car elle est apellée très souvent. +/// Draws the mouse coordinates on the menu +/// Only update the digits and doesn't refresh the "X: Y:" labels. This function needs to be fast as it is called each time the mouse moves. void Print_coordinates(void) { char temp[5]; diff --git a/windows.h b/windows.h index 24b6527f..6a291eb1 100644 --- a/windows.h +++ b/windows.h @@ -61,7 +61,6 @@ void Print_general(short x,short y,const char * str,byte text_color,byte backgro void Print_in_window(short x,short y,const char * str,byte text_color,byte background_color); void Print_in_window_limited(short x,short y,const char * str,byte size,byte text_color,byte background_color); void Print_char_in_window(short x_pos,short y_pos,const unsigned char c,byte text_color,byte background_color); -void Print_transparent_char_in_window(short x_pos,short y_pos,const unsigned char c,byte color); void Print_in_menu(const char * str, short position); void Print_coordinates(void); void Print_filename(void);