GUi skin elements are allocated on the heap

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@871 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-06-16 19:43:37 +00:00
parent 62738a1526
commit 1b2fa69f6a
11 changed files with 350 additions and 327 deletions

View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include <sys/stat.h>
#include <SDL.h> #include <SDL.h>
#include "const.h" #include "const.h"
@ -137,7 +138,7 @@ void Button_Message_initial(void)
Menu_factor_X*237,Menu_factor_Y*60,MC_Black); Menu_factor_X*237,Menu_factor_Y*60,MC_Black);
for (y=23,offs_y=0; y<79; offs_y+=231,y++) for (y=23,offs_y=0; y<79; offs_y+=231,y++)
for (x=14,x_pos=0; x_pos<231; x_pos++,x++) for (x=14,x_pos=0; x_pos<231; x_pos++,x++)
Pixel_in_window(x,y,GFX_logo_grafx2[offs_y+x_pos]); Pixel_in_window(x,y,Gfx->Logo_grafx2[offs_y+x_pos]);
Print_in_window(130-4*26,88,"Copyright (c) 2007-2009 by",MC_Dark,MC_Light); Print_in_window(130-4*26,88,"Copyright (c) 2007-2009 by",MC_Dark,MC_Light);
Print_in_window(130-4*23,96,"the Grafx2 project team",MC_Black,MC_Light); Print_in_window(130-4*23,96,"the Grafx2 project team",MC_Black,MC_Light);
@ -958,9 +959,9 @@ void Button_Settings(void)
// Font selection // Font selection
if (Config.Font) if (Config.Font)
Menu_font=GFX_fun_font; Menu_font=Gfx->Fun_font;
else else
Menu_font=GFX_system_font; Menu_font=Gfx->System_font;
if (config_is_reloaded) if (config_is_reloaded)
Compute_optimal_menu_colors(Main_palette); Compute_optimal_menu_colors(Main_palette);
@ -1257,7 +1258,7 @@ void Button_Skins(void)
strcpy(skinsdir,"skins/"); strcpy(skinsdir,"skins/");
Get_selected_item(Main_fileselector_position,Main_fileselector_offset,skinsdir+6,NULL); Get_selected_item(Main_fileselector_position,Main_fileselector_offset,skinsdir+6,NULL);
Load_graphics(skinsdir); Load_graphics(Gfx, skinsdir);
Close_window(); Close_window();
Unselect_button(BUTTON_SETTINGS); Unselect_button(BUTTON_SETTINGS);
@ -2519,15 +2520,15 @@ void Button_Paintbrush_menu(void)
if (clicked_button!=1) // pas Cancel if (clicked_button!=1) // pas Cancel
{ {
index=clicked_button-2; index=clicked_button-2;
Paintbrush_shape=Paintbrush_type[index]; Paintbrush_shape=Gfx->Paintbrush_type[index];
Paintbrush_width=Preset_paintbrush_width[index]; Paintbrush_width=Gfx->Preset_paintbrush_width[index];
Paintbrush_height=Preset_paintbrush_height[index]; Paintbrush_height=Gfx->Preset_paintbrush_height[index];
Paintbrush_offset_X=Preset_paintbrush_offset_X[index]; Paintbrush_offset_X=Gfx->Preset_paintbrush_offset_X[index];
Paintbrush_offset_Y=Preset_paintbrush_offset_Y[index]; Paintbrush_offset_Y=Gfx->Preset_paintbrush_offset_Y[index];
for (y_pos=0; y_pos<Paintbrush_height; y_pos++) for (y_pos=0; y_pos<Paintbrush_height; y_pos++)
for (x_pos=0; x_pos<Paintbrush_width; x_pos++) for (x_pos=0; x_pos<Paintbrush_width; x_pos++)
Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=GFX_paintbrush_sprite[index][y_pos][x_pos]; Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos]=Gfx->Paintbrush_sprite[index][y_pos][x_pos];
Change_paintbrush_shape(Paintbrush_type[index]); Change_paintbrush_shape(Gfx->Paintbrush_type[index]);
} }
Unselect_button(BUTTON_PAINTBRUSHES); Unselect_button(BUTTON_PAINTBRUSHES);
@ -4617,7 +4618,7 @@ void Draw_preset_sieve_patterns(void)
for (i=0; i<16*Menu_factor_X/Zoom; i++) for (i=0; i<16*Menu_factor_X/Zoom; i++)
Block(((index*23+10)*Menu_factor_X)+i*Zoom+Window_pos_X, Block(((index*23+10)*Menu_factor_X)+i*Zoom+Window_pos_X,
(22*Menu_factor_Y)+j*Zoom+Window_pos_Y,Zoom,Zoom, (22*Menu_factor_Y)+j*Zoom+Window_pos_Y,Zoom,Zoom,
((GFX_sieve_pattern[index][j&0xF]>>(15-(i&0xF)))&1)?MC_White:MC_Black); ((Gfx->Sieve_pattern[index][j&0xF]>>(15-(i&0xF)))&1)?MC_White:MC_Black);
Update_rect(ToWinX(10),ToWinY(22),ToWinL(12*23+16),ToWinH(16)); Update_rect(ToWinX(10),ToWinY(22),ToWinL(12*23+16),ToWinH(16));
} }
@ -4629,7 +4630,7 @@ void Copy_preset_sieve(byte index)
for (j=0; j<16; j++) for (j=0; j<16; j++)
for (i=0; i<16; i++) for (i=0; i<16; i++)
Sieve[i][j]=(GFX_sieve_pattern[index][j]>>(15-i))&1; Sieve[i][j]=(Gfx->Sieve_pattern[index][j]>>(15-i))&1;
Sieve_width=16; Sieve_width=16;
Sieve_height=16; Sieve_height=16;
} }
@ -5057,7 +5058,7 @@ void Display_effect_sprite(short sprite_number, short start_x, short start_y)
for (y=0,y_pos=start_y;y<MENU_SPRITE_HEIGHT;y++,y_pos++) for (y=0,y_pos=start_y;y<MENU_SPRITE_HEIGHT;y++,y_pos++)
for (x=0,x_pos=start_x;x<MENU_SPRITE_WIDTH;x++,x_pos++) for (x=0,x_pos=start_x;x<MENU_SPRITE_WIDTH;x++,x_pos++)
Pixel_in_window(x_pos,y_pos,GFX_effect_sprite[sprite_number][y][x]); Pixel_in_window(x_pos,y_pos,Gfx->Effect_sprite[sprite_number][y][x]);
Update_rect(ToWinX(start_x),ToWinY(start_y),MENU_SPRITE_WIDTH*Menu_factor_X,MENU_SPRITE_HEIGHT*Menu_factor_Y); Update_rect(ToWinX(start_x),ToWinY(start_y),MENU_SPRITE_WIDTH*Menu_factor_X,MENU_SPRITE_HEIGHT*Menu_factor_Y);
} }

View File

@ -58,9 +58,9 @@
#define DEFAULT_ZOOM_FACTOR 4 ///< Initial zoom factor for the magnifier. #define DEFAULT_ZOOM_FACTOR 4 ///< Initial zoom factor for the magnifier.
#define MAX_PATH_CHARACTERS 260 ///< Number of characters for a file+complete path. Adapt to your OS... #define MAX_PATH_CHARACTERS 260 ///< Number of characters for a file+complete path. Adapt to your OS...
#define NB_BOOKMARKS 4 ///< Number of bookmark buttons in Save/Load screen. #define NB_BOOKMARKS 4 ///< Number of bookmark buttons in Save/Load screen.
// Character to show a right arrow, used when editing long strings. It's present in ::GFX_system_font // Character to show a right arrow, used when editing long strings. It's present in ::Gfx->System_font
#define RIGHT_TRIANGLE_CHARACTER 16 #define RIGHT_TRIANGLE_CHARACTER 16
// Character to show a left arrow, used when editing long strings. It's present in ::GFX_system_font // Character to show a left arrow, used when editing long strings. It's present in ::Gfx->System_font
#define LEFT_TRIANGLE_CHARACTER 17 #define LEFT_TRIANGLE_CHARACTER 17
/// Character to display in menus for an ellipsis. /// Character to display in menus for an ellipsis.
#define ELLIPSIS_CHARACTER '…' #define ELLIPSIS_CHARACTER '…'
@ -241,7 +241,7 @@ enum CHUNKS_CFG
CHUNK_MAX CHUNK_MAX
}; };
/// Identifiers for the 8x8 icons of ::GFX_icon_sprite (these are unused now) /// Identifiers for the 8x8 icons of ::Gfx->Icon_sprite (most are unused now)
enum ICON_TYPES enum ICON_TYPES
{ {
ICON_FLOPPY_3_5=0, ///< 3½" Floppy disk ICON_FLOPPY_3_5=0, ///< 3½" Floppy disk

View File

@ -210,74 +210,74 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
case BUTTON_SHAPE_RECTANGLE : case BUTTON_SHAPE_RECTANGLE :
// On colorie le point haut droit // On colorie le point haut droit
Pixel_in_menu(end_x,start_y,color_diagonal); Pixel_in_menu(end_x,start_y,color_diagonal);
GFX_menu_block[start_y][end_x]=color_diagonal; Gfx->Menu_block[start_y][end_x]=color_diagonal;
// On colorie le point bas gauche // On colorie le point bas gauche
Pixel_in_menu(start_x,end_y,color_diagonal); Pixel_in_menu(start_x,end_y,color_diagonal);
GFX_menu_block[end_y][start_x]=color_diagonal; Gfx->Menu_block[end_y][start_x]=color_diagonal;
// On colorie la partie haute // On colorie la partie haute
for (x_pos=start_x;x_pos<=end_x-1;x_pos++) for (x_pos=start_x;x_pos<=end_x-1;x_pos++)
{ {
Pixel_in_menu(x_pos,start_y,color_top_left); Pixel_in_menu(x_pos,start_y,color_top_left);
GFX_menu_block[start_y][x_pos]=color_top_left; Gfx->Menu_block[start_y][x_pos]=color_top_left;
} }
for (y_pos=start_y+1;y_pos<=end_y-1;y_pos++) for (y_pos=start_y+1;y_pos<=end_y-1;y_pos++)
{ {
// On colorie la partie gauche // On colorie la partie gauche
Pixel_in_menu(start_x,y_pos,color_top_left); Pixel_in_menu(start_x,y_pos,color_top_left);
GFX_menu_block[y_pos][start_x]=color_top_left; Gfx->Menu_block[y_pos][start_x]=color_top_left;
// On colorie la partie droite // On colorie la partie droite
Pixel_in_menu(end_x,y_pos,color_bottom_right); Pixel_in_menu(end_x,y_pos,color_bottom_right);
GFX_menu_block[y_pos][end_x]=color_bottom_right; Gfx->Menu_block[y_pos][end_x]=color_bottom_right;
} }
// On colorie la partie basse // On colorie la partie basse
for (x_pos=start_x+1;x_pos<=end_x;x_pos++) for (x_pos=start_x+1;x_pos<=end_x;x_pos++)
{ {
Pixel_in_menu(x_pos,end_y,color_bottom_right); Pixel_in_menu(x_pos,end_y,color_bottom_right);
GFX_menu_block[end_y][x_pos]=color_bottom_right; Gfx->Menu_block[end_y][x_pos]=color_bottom_right;
} }
break; break;
case BUTTON_SHAPE_TRIANGLE_TOP_LEFT: case BUTTON_SHAPE_TRIANGLE_TOP_LEFT:
// On colorie le point haut droit // On colorie le point haut droit
Pixel_in_menu(end_x,start_y,color_diagonal); Pixel_in_menu(end_x,start_y,color_diagonal);
GFX_menu_block[start_y][end_x]=color_diagonal; Gfx->Menu_block[start_y][end_x]=color_diagonal;
// On colorie le point bas gauche // On colorie le point bas gauche
Pixel_in_menu(start_x,end_y,color_diagonal); Pixel_in_menu(start_x,end_y,color_diagonal);
GFX_menu_block[end_y][start_x]=color_diagonal; Gfx->Menu_block[end_y][start_x]=color_diagonal;
// On colorie le coin haut gauche // On colorie le coin haut gauche
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++) for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{ {
Pixel_in_menu(start_x+x_pos,start_y,color_top_left); Pixel_in_menu(start_x+x_pos,start_y,color_top_left);
GFX_menu_block[start_y][start_x+x_pos]=color_top_left; Gfx->Menu_block[start_y][start_x+x_pos]=color_top_left;
Pixel_in_menu(start_x,start_y+x_pos,color_top_left); Pixel_in_menu(start_x,start_y+x_pos,color_top_left);
GFX_menu_block[start_y+x_pos][start_x]=color_top_left; Gfx->Menu_block[start_y+x_pos][start_x]=color_top_left;
} }
// On colorie la diagonale // On colorie la diagonale
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++) for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{ {
Pixel_in_menu(start_x+x_pos,end_y-x_pos,color_bottom_right); Pixel_in_menu(start_x+x_pos,end_y-x_pos,color_bottom_right);
GFX_menu_block[end_y-x_pos][start_x+x_pos]=color_bottom_right; Gfx->Menu_block[end_y-x_pos][start_x+x_pos]=color_bottom_right;
} }
break; break;
case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT: case BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT:
// On colorie le point haut droit // On colorie le point haut droit
Pixel_in_menu(end_x,start_y,color_diagonal); Pixel_in_menu(end_x,start_y,color_diagonal);
GFX_menu_block[start_y][end_x]=color_diagonal; Gfx->Menu_block[start_y][end_x]=color_diagonal;
// On colorie le point bas gauche // On colorie le point bas gauche
Pixel_in_menu(start_x,end_y,color_diagonal); Pixel_in_menu(start_x,end_y,color_diagonal);
GFX_menu_block[end_y][start_x]=color_diagonal; Gfx->Menu_block[end_y][start_x]=color_diagonal;
// On colorie la diagonale // On colorie la diagonale
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++) for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{ {
Pixel_in_menu(start_x+x_pos,end_y-x_pos,color_top_left); Pixel_in_menu(start_x+x_pos,end_y-x_pos,color_top_left);
GFX_menu_block[end_y-x_pos][start_x+x_pos]=color_top_left; Gfx->Menu_block[end_y-x_pos][start_x+x_pos]=color_top_left;
} }
// On colorie le coin bas droite // On colorie le coin bas droite
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++) for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{ {
Pixel_in_menu(end_x-x_pos,end_y,color_bottom_right); Pixel_in_menu(end_x-x_pos,end_y,color_bottom_right);
GFX_menu_block[end_y][end_x-x_pos]=color_bottom_right; Gfx->Menu_block[end_y][end_x-x_pos]=color_bottom_right;
Pixel_in_menu(end_x,end_y-x_pos,color_bottom_right); Pixel_in_menu(end_x,end_y-x_pos,color_bottom_right);
GFX_menu_block[end_y-x_pos][end_x]=color_bottom_right; Gfx->Menu_block[end_y-x_pos][end_x]=color_bottom_right;
} }
} }
if (Menu_is_visible) if (Menu_is_visible)

View File

@ -63,9 +63,6 @@ GFX2_GLOBAL T_Video_mode Video_mode[MAX_VIDEO_MODES];
/// Actual number of video modes in ::Video_mode. /// Actual number of video modes in ::Video_mode.
GFX2_GLOBAL int Nb_video_modes; GFX2_GLOBAL int Nb_video_modes;
/// A default 256-color palette.
GFX2_GLOBAL T_Palette Default_palette;
// -- Menu colors // -- Menu colors
GFX2_GLOBAL byte MC_Black; ///< Index of color to use as "black" in the GUI menus. GFX2_GLOBAL byte MC_Black; ///< Index of color to use as "black" in the GUI menus.
@ -139,12 +136,6 @@ GFX2_GLOBAL byte Cursor_hidden;
GFX2_GLOBAL byte Cursor_in_menu; GFX2_GLOBAL byte Cursor_in_menu;
/// Boolean, means the cursor was hovering over a menu GUI element. /// Boolean, means the cursor was hovering over a menu GUI element.
GFX2_GLOBAL byte Cursor_in_menu_previous; GFX2_GLOBAL byte Cursor_in_menu_previous;
/// X coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_WIDTH
GFX2_GLOBAL word Cursor_offset_X[NB_CURSOR_SPRITES];
/// Y coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_HEIGHT
GFX2_GLOBAL word Cursor_offset_Y[NB_CURSOR_SPRITES];
/// Graphic resources for the mouse cursor.
GFX2_GLOBAL byte GFX_cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
/// Storage for the graphics under the mouse cursor. Used by ::Hide_cursor and ::Display_cursor /// Storage for the graphics under the mouse cursor. Used by ::Hide_cursor and ::Display_cursor
GFX2_GLOBAL byte CURSOR_BACKGROUND[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH]; GFX2_GLOBAL byte CURSOR_BACKGROUND[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
@ -164,18 +155,6 @@ GFX2_GLOBAL byte Paintbrush_hidden;
GFX2_GLOBAL short Paintbrush_X; GFX2_GLOBAL short Paintbrush_X;
/// Cordinate of the preview paintbrush in image space. /// Cordinate of the preview paintbrush in image space.
GFX2_GLOBAL short Paintbrush_Y; GFX2_GLOBAL short Paintbrush_Y;
/// Graphic resources for the preset paintbrushes.
GFX2_GLOBAL byte GFX_paintbrush_sprite [NB_PAINTBRUSH_SPRITES][PAINTBRUSH_HEIGHT][PAINTBRUSH_WIDTH];
/// Width of the preset paintbrushes.
GFX2_GLOBAL word Preset_paintbrush_width[NB_PAINTBRUSH_SPRITES];
/// Height of the preset paintbrushes.
GFX2_GLOBAL word Preset_paintbrush_height[NB_PAINTBRUSH_SPRITES];
/// Type of the preset paintbrush: index in enum PAINTBRUSH_SHAPES
GFX2_GLOBAL byte Paintbrush_type[NB_PAINTBRUSH_SPRITES];
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_width[]/2
GFX2_GLOBAL word Preset_paintbrush_offset_X[NB_PAINTBRUSH_SPRITES];
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_height[]/2
GFX2_GLOBAL word Preset_paintbrush_offset_Y[NB_PAINTBRUSH_SPRITES];
/// Pixel data of the current brush /// Pixel data of the current brush
GFX2_GLOBAL byte * Paintbrush_sprite; GFX2_GLOBAL byte * Paintbrush_sprite;
/// Current paintbrush's width /// Current paintbrush's width
@ -675,8 +654,6 @@ GFX2_GLOBAL word Snap_offset_Y;
GFX2_GLOBAL byte Sieve_mode; GFX2_GLOBAL byte Sieve_mode;
/// Sprite of the sieve pattern. It's actually an array of booleans. /// Sprite of the sieve pattern. It's actually an array of booleans.
GFX2_GLOBAL byte Sieve[16][16]; GFX2_GLOBAL byte Sieve[16][16];
/// Preset sieve patterns, stored as binary (one word per line)
GFX2_GLOBAL word GFX_sieve_pattern[12][16];
/// Width of the sieve pattern, in Sieve mode. /// Width of the sieve pattern, in Sieve mode.
GFX2_GLOBAL short Sieve_width; GFX2_GLOBAL short Sieve_width;
/// Height of the sieve pattern, in Sieve mode. /// Height of the sieve pattern, in Sieve mode.
@ -810,40 +787,14 @@ GFX2_GLOBAL byte File_in_command_line;
/// Boolean, true if Grafx2 was run with a command-line argument to set a resolution on startup (overrides config) /// Boolean, true if Grafx2 was run with a command-line argument to set a resolution on startup (overrides config)
GFX2_GLOBAL byte Resolution_in_command_line; GFX2_GLOBAL byte Resolution_in_command_line;
// - Graphic skin data // - Graphic
/// Bitmap data for the menu, a single rectangle. /// Pointer to the font selected for menus. It's either ::Gfx->System_font or ::Gfx->Fun_font
GFX2_GLOBAL byte GFX_menu_block[MENU_HEIGHT][MENU_WIDTH];
/// Bitmap data for the icons that are displayed over the menu.
GFX2_GLOBAL byte GFX_menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
/// Bitmap data for the different "effects" icons.
GFX2_GLOBAL byte GFX_effect_sprite[NB_EFFECTS_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
/// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed.
GFX2_GLOBAL byte * GFX_logo_grafx2;
/// Bitmap data for the classic 8x8 font used in menus etc.
GFX2_GLOBAL byte GFX_system_font[256*8*8];
/// Bitmap data for the "fun" 8x8 font used in menus etc.
GFX2_GLOBAL byte GFX_fun_font [256*8*8];
/// Bitmap data for the 6x8 font used in help screens.
GFX2_GLOBAL byte GFX_help_font_norm [256][6][8];
/// Bitmap data for the 6x8 font used in help screens ("bold" verstion).
GFX2_GLOBAL byte GFX_bold_font [256][6][8];
// 12
// 34
/// Bitmap data for the title font used in help screens. Top-left quarter.
GFX2_GLOBAL byte GFX_help_font_t1 [64][6][8];
/// Bitmap data for the title font used in help screens. Top-right quarter.
GFX2_GLOBAL byte GFX_help_font_t2 [64][6][8];
/// Bitmap data for the title font used in help screens. Bottom-left quarter.
GFX2_GLOBAL byte GFX_help_font_t3 [64][6][8];
/// Bitmap data for the title font used in help screens. Bottom-right quarter.
GFX2_GLOBAL byte GFX_help_font_t4 [64][6][8];
/// Bitmap data for the small 8x8 icons.
GFX2_GLOBAL byte GFX_icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH];
/// Pointer to the font selected for menus. It's either ::GFX_system_font or ::GFX_fun_font
GFX2_GLOBAL byte * Menu_font; GFX2_GLOBAL byte * Menu_font;
/// Pointer to the current active skin.
GFX2_GLOBAL T_Gui_skin * Gfx;
// -- Help data // -- Help data
/// Index of the ::Help_section shown by the Help screen. /// Index of the ::Help_section shown by the Help screen.

18
help.c
View File

@ -323,27 +323,27 @@ void Display_help(void)
if (line_type=='T') if (line_type=='T')
{ {
if (line[char_index/2]>'_' || line[char_index/2]<' ') if (line[char_index/2]>'_' || line[char_index/2]<' ')
char_pixel=&(GFX_help_font_norm['!'][0][0]); // Caractère pas géré char_pixel=&(Gfx->Help_font_norm['!'][0][0]); // Caractère pas géré
else if (char_index & 1) else if (char_index & 1)
char_pixel=&(GFX_help_font_t2[(unsigned char)(line[char_index/2])-' '][0][0]); char_pixel=&(Gfx->Help_font_t2[(unsigned char)(line[char_index/2])-' '][0][0]);
else else
char_pixel=&(GFX_help_font_t1[(unsigned char)(line[char_index/2])-' '][0][0]); char_pixel=&(Gfx->Help_font_t1[(unsigned char)(line[char_index/2])-' '][0][0]);
} }
else if (line_type=='-') else if (line_type=='-')
{ {
if (line[char_index/2]>'_' || line[char_index/2]<' ') if (line[char_index/2]>'_' || line[char_index/2]<' ')
char_pixel=&(GFX_help_font_norm['!'][0][0]); // Caractère pas géré char_pixel=&(Gfx->Help_font_norm['!'][0][0]); // Caractère pas géré
else if (char_index & 1) else if (char_index & 1)
char_pixel=&(GFX_help_font_t4[(unsigned char)(line[char_index/2])-' '][0][0]); char_pixel=&(Gfx->Help_font_t4[(unsigned char)(line[char_index/2])-' '][0][0]);
else else
char_pixel=&(GFX_help_font_t3[(unsigned char)(line[char_index/2])-' '][0][0]); char_pixel=&(Gfx->Help_font_t3[(unsigned char)(line[char_index/2])-' '][0][0]);
} }
else if (line_type=='S') else if (line_type=='S')
char_pixel=&(GFX_bold_font[(unsigned char)(line[char_index])][0][0]); char_pixel=&(Gfx->Bold_font[(unsigned char)(line[char_index])][0][0]);
else if (line_type=='N' || line_type=='K') else if (line_type=='N' || line_type=='K')
char_pixel=&(GFX_help_font_norm[(unsigned char)(line[char_index])][0][0]); char_pixel=&(Gfx->Help_font_norm[(unsigned char)(line[char_index])][0][0]);
else else
char_pixel=&(GFX_help_font_norm['!'][0][0]); // Un garde-fou en cas de probleme char_pixel=&(Gfx->Help_font_norm['!'][0][0]); // Un garde-fou en cas de probleme
for (x=0;x<6;x++) for (x=0;x<6;x++)
for (repeat_menu_x_factor=0;repeat_menu_x_factor<Menu_factor_X;repeat_menu_x_factor++) for (repeat_menu_x_factor=0;repeat_menu_x_factor<Menu_factor_X;repeat_menu_x_factor++)

347
init.c
View File

@ -189,11 +189,8 @@ void Read_GUI_pattern(SDL_Surface *gui, int start_x, int start_y, word *dest, ch
} }
} }
void Center_GUI_cursor(byte *cursor_buffer, int cursor_number) void Center_GUI_cursor(T_Gui_skin *gfx, byte *cursor_buffer, int cursor_number)
{ {
// GFX_cursor_sprite[i]
//Cursor_offset_X[CURSOR_SHAPE_ARROW]=0;
//Cursor_offset_Y[CURSOR_SHAPE_ARROW]=0;
int x,y; int x,y;
int start_x, start_y; int start_x, start_y;
byte found; byte found;
@ -228,15 +225,15 @@ void Center_GUI_cursor(byte *cursor_buffer, int cursor_number)
if (found) if (found)
break; break;
} }
Cursor_offset_X[cursor_number]=14-start_x; gfx->Cursor_offset_X[cursor_number]=14-start_x;
Cursor_offset_Y[cursor_number]=14-start_y; gfx->Cursor_offset_Y[cursor_number]=14-start_y;
for (y=0;y<CURSOR_SPRITE_HEIGHT;y++) for (y=0;y<CURSOR_SPRITE_HEIGHT;y++)
for (x=0;x<CURSOR_SPRITE_WIDTH;x++) for (x=0;x<CURSOR_SPRITE_WIDTH;x++)
GFX_cursor_sprite[cursor_number][y][x]=cursor_buffer[(start_y+y)*29+start_x+x]; gfx->Cursor_sprite[cursor_number][y][x]=cursor_buffer[(start_y+y)*29+start_x+x];
} }
void Load_graphics(const char * skin_file) void Load_graphics(T_Gui_skin *gfx, const char * skin_file)
{ {
int index; int index;
char filename[MAX_PATH_CHARACTERS]; char filename[MAX_PATH_CHARACTERS];
@ -275,9 +272,9 @@ void Load_graphics(const char * skin_file)
// Lecture de la palette par défaut // Lecture de la palette par défaut
for (i=0; i<256; i++) for (i=0; i<256; i++)
{ {
Default_palette[i].R=SDLPal->colors[i].r; gfx->Default_palette[i].R=SDLPal->colors[i].r;
Default_palette[i].G=SDLPal->colors[i].g; gfx->Default_palette[i].G=SDLPal->colors[i].g;
Default_palette[i].B=SDLPal->colors[i].b; gfx->Default_palette[i].B=SDLPal->colors[i].b;
} }
// Carré "noir" // Carré "noir"
@ -353,7 +350,7 @@ void Load_graphics(const char * skin_file)
// Menu // Menu
GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu"); GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu");
Read_GUI_block(gui, cursor_x, cursor_y, GFX_menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0); Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0);
cursor_y+=MENU_HEIGHT; cursor_y+=MENU_HEIGHT;
// Effets // Effets
@ -363,7 +360,7 @@ void Load_graphics(const char * skin_file)
GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "effect sprite"); GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "effect sprite");
else else
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite");
Read_GUI_block(gui, cursor_x, cursor_y, GFX_effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0); Read_GUI_block(gui, cursor_x, cursor_y, gfx->Effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0);
cursor_x+=MENU_SPRITE_WIDTH; cursor_x+=MENU_SPRITE_WIDTH;
} }
cursor_y+=MENU_SPRITE_HEIGHT; cursor_y+=MENU_SPRITE_HEIGHT;
@ -376,7 +373,7 @@ void Load_graphics(const char * skin_file)
else else
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "mouse cursor"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "mouse cursor");
Read_GUI_block(gui, cursor_x, cursor_y, mouse_cursor_area, 29, 29, "mouse cursor",1); Read_GUI_block(gui, cursor_x, cursor_y, mouse_cursor_area, 29, 29, "mouse cursor",1);
Center_GUI_cursor((byte *)mouse_cursor_area,i); Center_GUI_cursor(gfx, (byte *)mouse_cursor_area,i);
cursor_x+=29; cursor_x+=29;
} }
cursor_y+=29; cursor_y+=29;
@ -388,7 +385,7 @@ void Load_graphics(const char * skin_file)
GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu sprite"); GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu sprite");
else else
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite");
Read_GUI_block(gui, cursor_x, cursor_y, GFX_menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1); Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1);
cursor_x+=MENU_SPRITE_WIDTH; cursor_x+=MENU_SPRITE_WIDTH;
} }
cursor_y+=MENU_SPRITE_HEIGHT; cursor_y+=MENU_SPRITE_HEIGHT;
@ -407,7 +404,7 @@ void Load_graphics(const char * skin_file)
{ {
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon");
} }
Read_GUI_block(gui, cursor_x, cursor_y, GFX_paintbrush_sprite[i], PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2); Read_GUI_block(gui, cursor_x, cursor_y, gfx->Paintbrush_sprite[i], PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2);
cursor_x+=PAINTBRUSH_WIDTH; cursor_x+=PAINTBRUSH_WIDTH;
} }
cursor_y+=PAINTBRUSH_HEIGHT; cursor_y+=PAINTBRUSH_HEIGHT;
@ -419,17 +416,17 @@ void Load_graphics(const char * skin_file)
GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sprite drive"); GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sprite drive");
else else
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sprite drive"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sprite drive");
Read_GUI_block(gui, cursor_x, cursor_y, GFX_icon_sprite[i], ICON_SPRITE_WIDTH, ICON_SPRITE_HEIGHT, "sprite drive",1); Read_GUI_block(gui, cursor_x, cursor_y, gfx->Icon_sprite[i], ICON_SPRITE_WIDTH, ICON_SPRITE_HEIGHT, "sprite drive",1);
cursor_x+=ICON_SPRITE_WIDTH; cursor_x+=ICON_SPRITE_WIDTH;
} }
cursor_y+=ICON_SPRITE_HEIGHT; cursor_y+=ICON_SPRITE_HEIGHT;
// Logo splash screen // Logo splash screen
if (!(GFX_logo_grafx2=(byte *)malloc(231*56))) if (!(gfx->Logo_grafx2=(byte *)malloc(231*56)))
Error(ERROR_MEMORY); Error(ERROR_MEMORY);
GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "logo menu"); GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "logo menu");
Read_GUI_block(gui, cursor_x, cursor_y, GFX_logo_grafx2, 231, 56, "logo menu",3); Read_GUI_block(gui, cursor_x, cursor_y, gfx->Logo_grafx2, 231, 56, "logo menu",3);
cursor_y+=56; cursor_y+=56;
// Trames // Trames
@ -439,7 +436,7 @@ void Load_graphics(const char * skin_file)
GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sieve pattern"); GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sieve pattern");
else else
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sieve pattern"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sieve pattern");
Read_GUI_pattern(gui, cursor_x, cursor_y, GFX_sieve_pattern[i],"sieve pattern"); Read_GUI_pattern(gui, cursor_x, cursor_y, gfx->Sieve_pattern[i],"sieve pattern");
cursor_x+=16; cursor_x+=16;
} }
cursor_y+=16; cursor_y+=16;
@ -458,11 +455,11 @@ void Load_graphics(const char * skin_file)
{ {
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "system font"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "system font");
} }
Read_GUI_block(gui, cursor_x, cursor_y, &GFX_system_font[i*64], 8, 8, "system font",2); Read_GUI_block(gui, cursor_x, cursor_y, &gfx->System_font[i*64], 8, 8, "system font",2);
cursor_x+=8; cursor_x+=8;
} }
cursor_y+=8; cursor_y+=8;
Menu_font=GFX_system_font; Menu_font=gfx->System_font;
// Font Fun // Font Fun
for (i=0; i<256; i++) for (i=0; i<256; i++)
@ -478,7 +475,7 @@ void Load_graphics(const char * skin_file)
{ {
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "fun font"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "fun font");
} }
Read_GUI_block(gui, cursor_x, cursor_y, &GFX_fun_font[i*64], 8, 8, "fun font",2); Read_GUI_block(gui, cursor_x, cursor_y, &gfx->Fun_font[i*64], 8, 8, "fun font",2);
cursor_x+=8; cursor_x+=8;
} }
cursor_y+=8; cursor_y+=8;
@ -497,7 +494,7 @@ void Load_graphics(const char * skin_file)
{ {
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (norm)"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (norm)");
} }
Read_GUI_block(gui, cursor_x, cursor_y, &(GFX_help_font_norm[i][0][0]), 6, 8, "help font (norm)",0); Read_GUI_block(gui, cursor_x, cursor_y, &(gfx->Help_font_norm[i][0][0]), 6, 8, "help font (norm)",0);
cursor_x+=6; cursor_x+=6;
} }
cursor_y+=8; cursor_y+=8;
@ -516,7 +513,7 @@ void Load_graphics(const char * skin_file)
{ {
GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (bold)"); GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (bold)");
} }
Read_GUI_block(gui, cursor_x, cursor_y, &(GFX_bold_font[i][0][0]), 6, 8, "help font (bold)",0); Read_GUI_block(gui, cursor_x, cursor_y, &(gfx->Bold_font[i][0][0]), 6, 8, "help font (bold)",0);
cursor_x+=6; cursor_x+=6;
} }
cursor_y+=8; cursor_y+=8;
@ -539,14 +536,14 @@ void Load_graphics(const char * skin_file)
if (i&1) if (i&1)
if (i&64) if (i&64)
dest=&(GFX_help_font_t4[char_4++][0][0]); dest=&(gfx->Help_font_t4[char_4++][0][0]);
else else
dest=&(GFX_help_font_t2[char_2++][0][0]); dest=&(gfx->Help_font_t2[char_2++][0][0]);
else else
if (i&64) if (i&64)
dest=&(GFX_help_font_t3[char_3++][0][0]); dest=&(gfx->Help_font_t3[char_3++][0][0]);
else else
dest=&(GFX_help_font_t1[char_1++][0][0]); dest=&(gfx->Help_font_t1[char_1++][0][0]);
Read_GUI_block(gui, cursor_x, cursor_y, dest, 6, 8, "help font (title)",0); Read_GUI_block(gui, cursor_x, cursor_y, dest, 6, 8, "help font (title)",0);
cursor_x+=6; cursor_x+=6;
@ -559,202 +556,202 @@ void Load_graphics(const char * skin_file)
Current_help_section=0; Current_help_section=0;
Help_position=0; Help_position=0;
Preset_paintbrush_width[ 0]= 1; gfx->Preset_paintbrush_width [ 0]= 1;
Preset_paintbrush_height[ 0]= 1; gfx->Preset_paintbrush_height[ 0]= 1;
Paintbrush_type [ 0]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 0]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 1]= 2; gfx->Preset_paintbrush_width [ 1]= 2;
Preset_paintbrush_height[ 1]= 2; gfx->Preset_paintbrush_height[ 1]= 2;
Paintbrush_type [ 1]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 1]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 2]= 3; gfx->Preset_paintbrush_width [ 2]= 3;
Preset_paintbrush_height[ 2]= 3; gfx->Preset_paintbrush_height[ 2]= 3;
Paintbrush_type [ 2]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 2]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 3]= 4; gfx->Preset_paintbrush_width [ 3]= 4;
Preset_paintbrush_height[ 3]= 4; gfx->Preset_paintbrush_height[ 3]= 4;
Paintbrush_type [ 3]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 3]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 4]= 5; gfx->Preset_paintbrush_width [ 4]= 5;
Preset_paintbrush_height[ 4]= 5; gfx->Preset_paintbrush_height[ 4]= 5;
Paintbrush_type [ 4]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 4]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 5]= 7; gfx->Preset_paintbrush_width [ 5]= 7;
Preset_paintbrush_height[ 5]= 7; gfx->Preset_paintbrush_height[ 5]= 7;
Paintbrush_type [ 5]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 5]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 6]= 8; gfx->Preset_paintbrush_width [ 6]= 8;
Preset_paintbrush_height[ 6]= 8; gfx->Preset_paintbrush_height[ 6]= 8;
Paintbrush_type [ 6]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 6]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 7]=12; gfx->Preset_paintbrush_width [ 7]=12;
Preset_paintbrush_height[ 7]=12; gfx->Preset_paintbrush_height[ 7]=12;
Paintbrush_type [ 7]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 7]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 8]=16; gfx->Preset_paintbrush_width [ 8]=16;
Preset_paintbrush_height[ 8]=16; gfx->Preset_paintbrush_height[ 8]=16;
Paintbrush_type [ 8]=PAINTBRUSH_SHAPE_SQUARE; gfx->Paintbrush_type [ 8]=PAINTBRUSH_SHAPE_SQUARE;
Preset_paintbrush_width[ 9]=16; gfx->Preset_paintbrush_width [ 9]=16;
Preset_paintbrush_height[ 9]=16; gfx->Preset_paintbrush_height[ 9]=16;
Paintbrush_type [ 9]=PAINTBRUSH_SHAPE_SIEVE_SQUARE; gfx->Paintbrush_type [ 9]=PAINTBRUSH_SHAPE_SIEVE_SQUARE;
Preset_paintbrush_width[10]=15; gfx->Preset_paintbrush_width [10]=15;
Preset_paintbrush_height[10]=15; gfx->Preset_paintbrush_height[10]=15;
Paintbrush_type [10]=PAINTBRUSH_SHAPE_DIAMOND; gfx->Paintbrush_type [10]=PAINTBRUSH_SHAPE_DIAMOND;
Preset_paintbrush_width[11]= 5; gfx->Preset_paintbrush_width [11]= 5;
Preset_paintbrush_height[11]= 5; gfx->Preset_paintbrush_height[11]= 5;
Paintbrush_type [11]=PAINTBRUSH_SHAPE_DIAMOND; gfx->Paintbrush_type [11]=PAINTBRUSH_SHAPE_DIAMOND;
Preset_paintbrush_width[12]= 3; gfx->Preset_paintbrush_width [12]= 3;
Preset_paintbrush_height[12]= 3; gfx->Preset_paintbrush_height[12]= 3;
Paintbrush_type [12]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [12]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[13]= 4; gfx->Preset_paintbrush_width [13]= 4;
Preset_paintbrush_height[13]= 4; gfx->Preset_paintbrush_height[13]= 4;
Paintbrush_type [13]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [13]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[14]= 5; gfx->Preset_paintbrush_width [14]= 5;
Preset_paintbrush_height[14]= 5; gfx->Preset_paintbrush_height[14]= 5;
Paintbrush_type [14]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [14]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[15]= 6; gfx->Preset_paintbrush_width [15]= 6;
Preset_paintbrush_height[15]= 6; gfx->Preset_paintbrush_height[15]= 6;
Paintbrush_type [15]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [15]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[16]= 8; gfx->Preset_paintbrush_width [16]= 8;
Preset_paintbrush_height[16]= 8; gfx->Preset_paintbrush_height[16]= 8;
Paintbrush_type [16]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [16]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[17]=10; gfx->Preset_paintbrush_width [17]=10;
Preset_paintbrush_height[17]=10; gfx->Preset_paintbrush_height[17]=10;
Paintbrush_type [17]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [17]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[18]=12; gfx->Preset_paintbrush_width [18]=12;
Preset_paintbrush_height[18]=12; gfx->Preset_paintbrush_height[18]=12;
Paintbrush_type [18]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [18]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[19]=14; gfx->Preset_paintbrush_width [19]=14;
Preset_paintbrush_height[19]=14; gfx->Preset_paintbrush_height[19]=14;
Paintbrush_type [19]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [19]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[20]=16; gfx->Preset_paintbrush_width [20]=16;
Preset_paintbrush_height[20]=16; gfx->Preset_paintbrush_height[20]=16;
Paintbrush_type [20]=PAINTBRUSH_SHAPE_ROUND; gfx->Paintbrush_type [20]=PAINTBRUSH_SHAPE_ROUND;
Preset_paintbrush_width[21]=15; gfx->Preset_paintbrush_width [21]=15;
Preset_paintbrush_height[21]=15; gfx->Preset_paintbrush_height[21]=15;
Paintbrush_type [21]=PAINTBRUSH_SHAPE_SIEVE_ROUND; gfx->Paintbrush_type [21]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
Preset_paintbrush_width[22]=11; gfx->Preset_paintbrush_width [22]=11;
Preset_paintbrush_height[22]=11; gfx->Preset_paintbrush_height[22]=11;
Paintbrush_type [22]=PAINTBRUSH_SHAPE_SIEVE_ROUND; gfx->Paintbrush_type [22]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
Preset_paintbrush_width[23]= 5; gfx->Preset_paintbrush_width [23]= 5;
Preset_paintbrush_height[23]= 5; gfx->Preset_paintbrush_height[23]= 5;
Paintbrush_type [23]=PAINTBRUSH_SHAPE_SIEVE_ROUND; gfx->Paintbrush_type [23]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
Preset_paintbrush_width[24]= 2; gfx->Preset_paintbrush_width [24]= 2;
Preset_paintbrush_height[24]= 1; gfx->Preset_paintbrush_height[24]= 1;
Paintbrush_type [24]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR; gfx->Paintbrush_type [24]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
Preset_paintbrush_width[25]= 3; gfx->Preset_paintbrush_width [25]= 3;
Preset_paintbrush_height[25]= 1; gfx->Preset_paintbrush_height[25]= 1;
Paintbrush_type [25]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR; gfx->Paintbrush_type [25]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
Preset_paintbrush_width[26]= 4; gfx->Preset_paintbrush_width [26]= 4;
Preset_paintbrush_height[26]= 1; gfx->Preset_paintbrush_height[26]= 1;
Paintbrush_type [26]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR; gfx->Paintbrush_type [26]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
Preset_paintbrush_width[27]= 8; gfx->Preset_paintbrush_width [27]= 8;
Preset_paintbrush_height[27]= 1; gfx->Preset_paintbrush_height[27]= 1;
Paintbrush_type [27]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR; gfx->Paintbrush_type [27]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
Preset_paintbrush_width[28]= 1; gfx->Preset_paintbrush_width [28]= 1;
Preset_paintbrush_height[28]= 2; gfx->Preset_paintbrush_height[28]= 2;
Paintbrush_type [28]=PAINTBRUSH_SHAPE_VERTICAL_BAR; gfx->Paintbrush_type [28]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
Preset_paintbrush_width[29]= 1; gfx->Preset_paintbrush_width [29]= 1;
Preset_paintbrush_height[29]= 3; gfx->Preset_paintbrush_height[29]= 3;
Paintbrush_type [29]=PAINTBRUSH_SHAPE_VERTICAL_BAR; gfx->Paintbrush_type [29]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
Preset_paintbrush_width[30]= 1; gfx->Preset_paintbrush_width [30]= 1;
Preset_paintbrush_height[30]= 4; gfx->Preset_paintbrush_height[30]= 4;
Paintbrush_type [30]=PAINTBRUSH_SHAPE_VERTICAL_BAR; gfx->Paintbrush_type [30]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
Preset_paintbrush_width[31]= 1; gfx->Preset_paintbrush_width [31]= 1;
Preset_paintbrush_height[31]= 8; gfx->Preset_paintbrush_height[31]= 8;
Paintbrush_type [31]=PAINTBRUSH_SHAPE_VERTICAL_BAR; gfx->Paintbrush_type [31]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
Preset_paintbrush_width[32]= 3; gfx->Preset_paintbrush_width [32]= 3;
Preset_paintbrush_height[32]= 3; gfx->Preset_paintbrush_height[32]= 3;
Paintbrush_type [32]=PAINTBRUSH_SHAPE_CROSS; gfx->Paintbrush_type [32]=PAINTBRUSH_SHAPE_CROSS;
Preset_paintbrush_width[33]= 5; gfx->Preset_paintbrush_width [33]= 5;
Preset_paintbrush_height[33]= 5; gfx->Preset_paintbrush_height[33]= 5;
Paintbrush_type [33]=PAINTBRUSH_SHAPE_CROSS; gfx->Paintbrush_type [33]=PAINTBRUSH_SHAPE_CROSS;
Preset_paintbrush_width[34]= 5; gfx->Preset_paintbrush_width [34]= 5;
Preset_paintbrush_height[34]= 5; gfx->Preset_paintbrush_height[34]= 5;
Paintbrush_type [34]=PAINTBRUSH_SHAPE_PLUS; gfx->Paintbrush_type [34]=PAINTBRUSH_SHAPE_PLUS;
Preset_paintbrush_width[35]=15; gfx->Preset_paintbrush_width [35]=15;
Preset_paintbrush_height[35]=15; gfx->Preset_paintbrush_height[35]=15;
Paintbrush_type [35]=PAINTBRUSH_SHAPE_PLUS; gfx->Paintbrush_type [35]=PAINTBRUSH_SHAPE_PLUS;
Preset_paintbrush_width[36]= 2; gfx->Preset_paintbrush_width [36]= 2;
Preset_paintbrush_height[36]= 2; gfx->Preset_paintbrush_height[36]= 2;
Paintbrush_type [36]=PAINTBRUSH_SHAPE_SLASH; gfx->Paintbrush_type [36]=PAINTBRUSH_SHAPE_SLASH;
Preset_paintbrush_width[37]= 4; gfx->Preset_paintbrush_width [37]= 4;
Preset_paintbrush_height[37]= 4; gfx->Preset_paintbrush_height[37]= 4;
Paintbrush_type [37]=PAINTBRUSH_SHAPE_SLASH; gfx->Paintbrush_type [37]=PAINTBRUSH_SHAPE_SLASH;
Preset_paintbrush_width[38]= 8; gfx->Preset_paintbrush_width [38]= 8;
Preset_paintbrush_height[38]= 8; gfx->Preset_paintbrush_height[38]= 8;
Paintbrush_type [38]=PAINTBRUSH_SHAPE_SLASH; gfx->Paintbrush_type [38]=PAINTBRUSH_SHAPE_SLASH;
Preset_paintbrush_width[39]= 2; gfx->Preset_paintbrush_width [39]= 2;
Preset_paintbrush_height[39]= 2; gfx->Preset_paintbrush_height[39]= 2;
Paintbrush_type [39]=PAINTBRUSH_SHAPE_ANTISLASH; gfx->Paintbrush_type [39]=PAINTBRUSH_SHAPE_ANTISLASH;
Preset_paintbrush_width[40]= 4; gfx->Preset_paintbrush_width [40]= 4;
Preset_paintbrush_height[40]= 4; gfx->Preset_paintbrush_height[40]= 4;
Paintbrush_type [40]=PAINTBRUSH_SHAPE_ANTISLASH; gfx->Paintbrush_type [40]=PAINTBRUSH_SHAPE_ANTISLASH;
Preset_paintbrush_width[41]= 8; gfx->Preset_paintbrush_width [41]= 8;
Preset_paintbrush_height[41]= 8; gfx->Preset_paintbrush_height[41]= 8;
Paintbrush_type [41]=PAINTBRUSH_SHAPE_ANTISLASH; gfx->Paintbrush_type [41]=PAINTBRUSH_SHAPE_ANTISLASH;
Preset_paintbrush_width[42]= 4; gfx->Preset_paintbrush_width [42]= 4;
Preset_paintbrush_height[42]= 4; gfx->Preset_paintbrush_height[42]= 4;
Paintbrush_type [42]=PAINTBRUSH_SHAPE_RANDOM; gfx->Paintbrush_type [42]=PAINTBRUSH_SHAPE_RANDOM;
Preset_paintbrush_width[43]= 8; gfx->Preset_paintbrush_width [43]= 8;
Preset_paintbrush_height[43]= 8; gfx->Preset_paintbrush_height[43]= 8;
Paintbrush_type [43]=PAINTBRUSH_SHAPE_RANDOM; gfx->Paintbrush_type [43]=PAINTBRUSH_SHAPE_RANDOM;
Preset_paintbrush_width[44]=13; gfx->Preset_paintbrush_width [44]=13;
Preset_paintbrush_height[44]=13; gfx->Preset_paintbrush_height[44]=13;
Paintbrush_type [44]=PAINTBRUSH_SHAPE_RANDOM; gfx->Paintbrush_type [44]=PAINTBRUSH_SHAPE_RANDOM;
Preset_paintbrush_width[45]= 3; gfx->Preset_paintbrush_width [45]= 3;
Preset_paintbrush_height[45]= 3; gfx->Preset_paintbrush_height[45]= 3;
Paintbrush_type [45]=PAINTBRUSH_SHAPE_MISC; gfx->Paintbrush_type [45]=PAINTBRUSH_SHAPE_MISC;
Preset_paintbrush_width[46]= 3; gfx->Preset_paintbrush_width [46]= 3;
Preset_paintbrush_height[46]= 3; gfx->Preset_paintbrush_height[46]= 3;
Paintbrush_type [46]=PAINTBRUSH_SHAPE_MISC; gfx->Paintbrush_type [46]=PAINTBRUSH_SHAPE_MISC;
Preset_paintbrush_width[47]= 7; gfx->Preset_paintbrush_width [47]= 7;
Preset_paintbrush_height[47]= 7; gfx->Preset_paintbrush_height[47]= 7;
Paintbrush_type [47]=PAINTBRUSH_SHAPE_MISC; gfx->Paintbrush_type [47]=PAINTBRUSH_SHAPE_MISC;
for (index=0;index<NB_PAINTBRUSH_SPRITES;index++) for (index=0;index<NB_PAINTBRUSH_SPRITES;index++)
{ {
Preset_paintbrush_offset_X[index]=(Preset_paintbrush_width[index]>>1); gfx->Preset_paintbrush_offset_X[index]=(gfx->Preset_paintbrush_width [index]>>1);
Preset_paintbrush_offset_Y[index]=(Preset_paintbrush_height[index]>>1); gfx->Preset_paintbrush_offset_Y[index]=(gfx->Preset_paintbrush_height[index]>>1);
} }
} }

2
init.h
View File

@ -22,7 +22,7 @@
/// Initialization (and some de-initialization) functions. /// Initialization (and some de-initialization) functions.
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void Load_graphics(const char * skin_file); void Load_graphics(T_Gui_skin *gfx, const char * skin_file);
void Init_buttons(void); void Init_buttons(void);
void Init_operations(void); void Init_operations(void);
int Load_CFG(int reload_all); int Load_CFG(int reload_all);

25
main.c
View File

@ -532,8 +532,11 @@ int Init_program(int argc,char * argv[])
Analyze_command_line(argc,argv); Analyze_command_line(argc,argv);
// Charger les sprites et la palette // Load sprites, palette etc.
Load_graphics(Gui_skin_file); Gfx = (T_Gui_skin *)malloc(sizeof(T_Gui_skin));
if (Gfx == NULL)
Error(ERROR_MEMORY);
Load_graphics(Gfx, Gui_skin_file);
// Infos sur les trames (Sieve) // Infos sur les trames (Sieve)
Sieve_mode=0; Sieve_mode=0;
@ -541,21 +544,21 @@ int Init_program(int argc,char * argv[])
// Transfert des valeurs du .INI qui ne changent pas dans des variables // Transfert des valeurs du .INI qui ne changent pas dans des variables
// plus accessibles: // plus accessibles:
Default_palette[MC_Black]=Fav_menu_colors[0]=Config.Fav_menu_colors[0]; Gfx->Default_palette[MC_Black]=Fav_menu_colors[0]=Config.Fav_menu_colors[0];
Default_palette[MC_Dark] =Fav_menu_colors[1]=Config.Fav_menu_colors[1]; Gfx->Default_palette[MC_Dark] =Fav_menu_colors[1]=Config.Fav_menu_colors[1];
Default_palette[MC_Light]=Fav_menu_colors[2]=Config.Fav_menu_colors[2]; Gfx->Default_palette[MC_Light]=Fav_menu_colors[2]=Config.Fav_menu_colors[2];
Default_palette[MC_White]=Fav_menu_colors[3]=Config.Fav_menu_colors[3]; Gfx->Default_palette[MC_White]=Fav_menu_colors[3]=Config.Fav_menu_colors[3];
Compute_optimal_menu_colors(Default_palette); Compute_optimal_menu_colors(Gfx->Default_palette);
Fore_color=MC_White; Fore_color=MC_White;
Back_color=MC_Black; Back_color=MC_Black;
// Prise en compte de la fonte // Prise en compte de la fonte
if (Config.Font) if (Config.Font)
Menu_font=GFX_fun_font; Menu_font=Gfx->Fun_font;
else else
Menu_font=GFX_system_font; Menu_font=Gfx->System_font;
memcpy(Main_palette,Default_palette,sizeof(T_Palette)); memcpy(Main_palette, Gfx->Default_palette, sizeof(T_Palette));
// Allocation de mémoire pour la brosse // Allocation de mémoire pour la brosse
if (!(Brush =(byte *)malloc( 1* 1))) Error(ERROR_MEMORY); if (!(Brush =(byte *)malloc( 1* 1))) Error(ERROR_MEMORY);
@ -755,7 +758,7 @@ int main(int argc,char * argv[])
{ {
if (Config.Opening_message && (!File_in_command_line)) if (Config.Opening_message && (!File_in_command_line))
Button_Message_initial(); Button_Message_initial();
free(GFX_logo_grafx2); // Pas encore utilisé dans le About free(Gfx->Logo_grafx2); // Not yet used in the About screen
if (File_in_command_line) if (File_in_command_line)
{ {

View File

@ -1227,9 +1227,9 @@ void Button_Palette(void)
case 5 : // Default case 5 : // Default
memcpy(backup_palette,working_palette,sizeof(T_Palette)); memcpy(backup_palette,working_palette,sizeof(T_Palette));
memcpy(working_palette,Default_palette,sizeof(T_Palette)); memcpy(working_palette,Gfx->Default_palette,sizeof(T_Palette));
memcpy(temp_palette,Default_palette,sizeof(T_Palette)); memcpy(temp_palette,Gfx->Default_palette,sizeof(T_Palette));
Set_palette(Default_palette); Set_palette(Gfx->Default_palette);
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end); Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
// On prépare la "modifiabilité" des nouvelles couleurs // On prépare la "modifiabilité" des nouvelles couleurs
memcpy(temp_palette,working_palette,sizeof(T_Palette)); memcpy(temp_palette,working_palette,sizeof(T_Palette));

View File

@ -305,5 +305,76 @@ typedef struct
} T_List_of_pages; } T_List_of_pages;
/// GUI skin data
typedef struct
{
// Mouse
/// X coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_WIDTH
word Cursor_offset_X[NB_CURSOR_SPRITES];
/// Y coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_HEIGHT
word Cursor_offset_Y[NB_CURSOR_SPRITES];
/// Graphic resources for the mouse cursor.
byte Cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH];
// Preset paintbrushes
/// Graphic resources for the preset paintbrushes.
byte Paintbrush_sprite [NB_PAINTBRUSH_SPRITES][PAINTBRUSH_HEIGHT][PAINTBRUSH_WIDTH];
/// Width of the preset paintbrushes.
word Preset_paintbrush_width[NB_PAINTBRUSH_SPRITES];
/// Height of the preset paintbrushes.
word Preset_paintbrush_height[NB_PAINTBRUSH_SPRITES];
/// Type of the preset paintbrush: index in enum PAINTBRUSH_SHAPES
byte Paintbrush_type[NB_PAINTBRUSH_SPRITES];
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_width[]/2
word Preset_paintbrush_offset_X[NB_PAINTBRUSH_SPRITES];
/// Brush handle for the preset brushes. Generally ::Preset_paintbrush_height[]/2
word Preset_paintbrush_offset_Y[NB_PAINTBRUSH_SPRITES];
// Sieve patterns
/// Preset sieve patterns, stored as binary (one word per line)
word Sieve_pattern[12][16];
// Menu and other graphics
/// Bitmap data for the menu, a single rectangle.
byte Menu_block[MENU_HEIGHT][MENU_WIDTH];
/// Bitmap data for the icons that are displayed over the menu.
byte Menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
/// Bitmap data for the different "effects" icons.
byte Effect_sprite[NB_EFFECTS_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
/// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed.
byte * Logo_grafx2;
/// Bitmap data for the 6x8 font used in help screens.
byte Help_font_norm [256][6][8];
/// Bitmap data for the 6x8 font used in help screens ("bold" verstion).
byte Bold_font [256][6][8];
// 12
// 34
/// Bitmap data for the title font used in help screens. Top-left quarter.
byte Help_font_t1 [64][6][8];
/// Bitmap data for the title font used in help screens. Top-right quarter.
byte Help_font_t2 [64][6][8];
/// Bitmap data for the title font used in help screens. Bottom-left quarter.
byte Help_font_t3 [64][6][8];
/// Bitmap data for the title font used in help screens. Bottom-right quarter.
byte Help_font_t4 [64][6][8];
/// Bitmap data for the small 8x8 icons.
byte Icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH];
// 8x8 fonts
/// Bitmap data for the classic 8x8 font used in menus etc.
byte System_font[256*8*8];
/// Bitmap data for the "fun" 8x8 font used in menus etc.
byte Fun_font [256*8*8];
/// A default 256-color palette.
T_Palette Default_palette;
} T_Gui_skin;
#endif #endif

View File

@ -423,7 +423,7 @@ void Display_menu(void)
// Affichage du sprite du menu // Affichage du sprite du menu
for (y_pos=0;y_pos<MENU_HEIGHT;y_pos++) for (y_pos=0;y_pos<MENU_HEIGHT;y_pos++)
for (x_pos=0;x_pos<MENU_WIDTH;x_pos++) for (x_pos=0;x_pos<MENU_WIDTH;x_pos++)
Pixel_in_menu(x_pos,y_pos,GFX_menu_block[y_pos][x_pos]); Pixel_in_menu(x_pos,y_pos,Gfx->Menu_block[y_pos][x_pos]);
// Affichage de la bande grise sous la palette // Affichage de la bande grise sous la palette
Block(MENU_WIDTH*Menu_factor_X,Menu_status_Y-Menu_factor_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),9*Menu_factor_Y,MC_Light); Block(MENU_WIDTH*Menu_factor_X,Menu_status_Y-Menu_factor_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),9*Menu_factor_Y,MC_Light);
@ -883,9 +883,9 @@ void Display_sprite_in_menu(int btn_number,int sprite_number)
for (y_pos=0;y_pos<MENU_SPRITE_HEIGHT;y_pos++) for (y_pos=0;y_pos<MENU_SPRITE_HEIGHT;y_pos++)
for (x_pos=0;x_pos<MENU_SPRITE_WIDTH;x_pos++) for (x_pos=0;x_pos<MENU_SPRITE_WIDTH;x_pos++)
{ {
color=GFX_menu_sprite[sprite_number][y_pos][x_pos]; color=Gfx->Menu_sprite[sprite_number][y_pos][x_pos];
Pixel_in_menu(menu_x_pos+x_pos,menu_y_pos+y_pos,color); Pixel_in_menu(menu_x_pos+x_pos,menu_y_pos+y_pos,color);
GFX_menu_block[menu_y_pos+y_pos][menu_x_pos+x_pos]=color; Gfx->Menu_block[menu_y_pos+y_pos][menu_x_pos+x_pos]=color;
} }
Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset+1), Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset+1),
(Buttons_Pool[btn_number].Y_offset+1)*Menu_factor_Y+Menu_Y, (Buttons_Pool[btn_number].Y_offset+1)*Menu_factor_Y+Menu_Y,
@ -909,9 +909,9 @@ void Display_paintbrush_in_menu(void)
for (menu_y_pos=2,y_pos=0;y_pos<MENU_SPRITE_HEIGHT;menu_y_pos++,y_pos++) for (menu_y_pos=2,y_pos=0;y_pos<MENU_SPRITE_HEIGHT;menu_y_pos++,y_pos++)
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++) for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
{ {
color=GFX_menu_sprite[4][y_pos][x_pos]; color=Gfx->Menu_sprite[4][y_pos][x_pos];
Pixel_in_menu(menu_x_pos,menu_y_pos,color); Pixel_in_menu(menu_x_pos,menu_y_pos,color);
GFX_menu_block[menu_y_pos][menu_x_pos]=color; Gfx->Menu_block[menu_y_pos][menu_x_pos]=color;
} }
break; break;
default : // Pinceau default : // Pinceau
@ -920,7 +920,7 @@ void Display_paintbrush_in_menu(void)
for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++) for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
{ {
Pixel_in_menu(menu_x_pos,menu_y_pos,MC_Light); Pixel_in_menu(menu_x_pos,menu_y_pos,MC_Light);
GFX_menu_block[menu_y_pos][menu_x_pos]=MC_Light; Gfx->Menu_block[menu_y_pos][menu_x_pos]=MC_Light;
} }
// On affiche le nouveau // On affiche le nouveau
menu_start_x=8-Paintbrush_offset_X; menu_start_x=8-Paintbrush_offset_X;
@ -946,7 +946,7 @@ void Display_paintbrush_in_menu(void)
{ {
color=(Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])?MC_Black:MC_Light; color=(Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])?MC_Black:MC_Light;
Pixel_in_menu(menu_x_pos,menu_y_pos,color); Pixel_in_menu(menu_x_pos,menu_y_pos,color);
GFX_menu_block[menu_y_pos][menu_x_pos]=color; Gfx->Menu_block[menu_y_pos][menu_x_pos]=color;
} }
} }
Update_rect(0,Menu_Y,MENU_SPRITE_WIDTH*Menu_factor_X+3,MENU_SPRITE_HEIGHT*Menu_factor_Y+3); Update_rect(0,Menu_Y,MENU_SPRITE_WIDTH*Menu_factor_X+3,MENU_SPRITE_HEIGHT*Menu_factor_Y+3);
@ -973,18 +973,18 @@ void Display_paintbrush_in_window(word x,word y,int number)
if (y_size<1) if (y_size<1)
y_size=1; y_size=1;
origin_x = (x + 8)*Menu_factor_X - (Preset_paintbrush_offset_X[number])*x_size+Window_pos_X; origin_x = (x + 8)*Menu_factor_X - (Gfx->Preset_paintbrush_offset_X[number])*x_size+Window_pos_X;
origin_y = (y + 8)*Menu_factor_Y - (Preset_paintbrush_offset_Y[number])*y_size+Window_pos_Y; origin_y = (y + 8)*Menu_factor_Y - (Gfx->Preset_paintbrush_offset_Y[number])*y_size+Window_pos_Y;
for (window_y_pos=0,y_pos=0; y_pos<Preset_paintbrush_height[number]; window_y_pos++,y_pos++) for (window_y_pos=0,y_pos=0; y_pos<Gfx->Preset_paintbrush_height[number]; window_y_pos++,y_pos++)
for (window_x_pos=0,x_pos=0; x_pos<Preset_paintbrush_width[number]; window_x_pos++,x_pos++) for (window_x_pos=0,x_pos=0; x_pos<Gfx->Preset_paintbrush_width[number]; window_x_pos++,x_pos++)
Block(origin_x+window_x_pos*x_size,origin_y+window_y_pos*y_size,x_size,y_size,(GFX_paintbrush_sprite[number][y_pos][x_pos])?MC_Black:MC_Light); Block(origin_x+window_x_pos*x_size,origin_y+window_y_pos*y_size,x_size,y_size,(Gfx->Paintbrush_sprite[number][y_pos][x_pos])?MC_Black:MC_Light);
// On n'utilise pas Pixel_in_window() car on ne dessine pas // On n'utilise pas Pixel_in_window() car on ne dessine pas
// forcément avec la même taille de pixel. // forcément avec la même taille de pixel.
Update_rect( ToWinX(origin_x), ToWinY(origin_y), Update_rect( ToWinX(origin_x), ToWinY(origin_y),
ToWinL(Preset_paintbrush_width[number]), ToWinL(Gfx->Preset_paintbrush_width[number]),
ToWinH(Preset_paintbrush_height[number]) ToWinH(Gfx->Preset_paintbrush_height[number])
); );
} }
@ -1041,7 +1041,7 @@ void Window_display_icon_sprite(word x_pos,word y_pos,byte type)
for (j=0; j<ICON_SPRITE_HEIGHT; j++) for (j=0; j<ICON_SPRITE_HEIGHT; j++)
for (i=0; i<ICON_SPRITE_WIDTH; i++) for (i=0; i<ICON_SPRITE_WIDTH; i++)
Pixel_in_window(x_pos+i,y_pos+j,GFX_icon_sprite[type][j][i]); Pixel_in_window(x_pos+i,y_pos+j,Gfx->Icon_sprite[type][j][i]);
Update_rect(ToWinX(x_pos),ToWinY(y_pos),ToWinL(ICON_SPRITE_WIDTH),ToWinH(ICON_SPRITE_HEIGHT)); Update_rect(ToWinX(x_pos),ToWinY(y_pos),ToWinL(ICON_SPRITE_WIDTH),ToWinH(ICON_SPRITE_HEIGHT));
} }
@ -1567,8 +1567,8 @@ void Display_cursor(void)
else else
{ {
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_TARGET:CURSOR_SHAPE_TARGET; temp=(Config.Cursor)?CURSOR_SHAPE_THIN_TARGET:CURSOR_SHAPE_TARGET;
start_x=Mouse_X-Cursor_offset_X[temp]; start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
start_y=Mouse_Y-Cursor_offset_Y[temp]; start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
for (x_pos=start_x,counter_x=0;counter_x<15 && x_pos < Screen_width;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15 && x_pos < Screen_width;x_pos++,counter_x++)
{ {
@ -1576,7 +1576,7 @@ void Display_cursor(void)
for (y_pos=start_y,counter_y=0;counter_y<15 && y_pos < Screen_height;y_pos++,counter_y++) for (y_pos=start_y,counter_y=0;counter_y<15 && y_pos < Screen_height;y_pos++,counter_y++)
{ {
if( y_pos < 0 || y_pos >= Screen_height) continue; if( y_pos < 0 || y_pos >= Screen_height) continue;
color=GFX_cursor_sprite[temp][counter_y][counter_x]; color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos); CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
if (color!=MC_Trans) if (color!=MC_Trans)
Pixel(x_pos,y_pos,color); Pixel(x_pos,y_pos,color);
@ -1636,8 +1636,8 @@ void Display_cursor(void)
{ {
DEBUG("B",0); DEBUG("B",0);
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER; temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER;
start_x=Mouse_X-Cursor_offset_X[temp]; start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
start_y=Mouse_Y-Cursor_offset_Y[temp]; start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
{ {
@ -1647,7 +1647,7 @@ void Display_cursor(void)
{ {
if(y_pos<0) continue; if(y_pos<0) continue;
if(y_pos>=Screen_height) break; if(y_pos>=Screen_height) break;
color=GFX_cursor_sprite[temp][counter_y][counter_x]; color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard // On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos); CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
if (color!=MC_Trans) if (color!=MC_Trans)
@ -1666,8 +1666,8 @@ void Display_cursor(void)
case CURSOR_SHAPE_ARROW : case CURSOR_SHAPE_ARROW :
case CURSOR_SHAPE_HOURGLASS : case CURSOR_SHAPE_HOURGLASS :
start_x=Mouse_X-Cursor_offset_X[shape]; start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
start_y=Mouse_Y-Cursor_offset_Y[shape]; start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
{ {
if(x_pos<0) continue; if(x_pos<0) continue;
@ -1676,7 +1676,7 @@ void Display_cursor(void)
{ {
if(y_pos<0) continue; if(y_pos<0) continue;
if(y_pos>=Screen_height) break; if(y_pos>=Screen_height) break;
color=GFX_cursor_sprite[shape][counter_y][counter_x]; color=Gfx->Cursor_sprite[shape][counter_y][counter_x];
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard // On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos); CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
if (color!=MC_Trans) if (color!=MC_Trans)
@ -1873,8 +1873,8 @@ void Hide_cursor(void)
else else
{ {
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_TARGET:CURSOR_SHAPE_TARGET; temp=(Config.Cursor)?CURSOR_SHAPE_THIN_TARGET:CURSOR_SHAPE_TARGET;
start_x=Mouse_X-Cursor_offset_X[temp]; start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
start_y=Mouse_Y-Cursor_offset_Y[temp]; start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++) for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
{ {
@ -1941,8 +1941,8 @@ void Hide_cursor(void)
else else
{ {
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER; temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER;
start_x=Mouse_X-Cursor_offset_X[temp]; start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
start_y=Mouse_Y-Cursor_offset_Y[temp]; start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
{ {
@ -1969,8 +1969,8 @@ void Hide_cursor(void)
case CURSOR_SHAPE_ARROW : case CURSOR_SHAPE_ARROW :
case CURSOR_SHAPE_HOURGLASS : case CURSOR_SHAPE_HOURGLASS :
start_x=Mouse_X-Cursor_offset_X[shape]; start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
start_y=Mouse_Y-Cursor_offset_Y[shape]; start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
{ {
@ -2492,52 +2492,52 @@ void Compute_optimal_menu_colors(T_Components * palette)
for (k=0; k<NB_CURSOR_SPRITES; k++) for (k=0; k<NB_CURSOR_SPRITES; k++)
for (j=0; j<CURSOR_SPRITE_HEIGHT; j++) for (j=0; j<CURSOR_SPRITE_HEIGHT; j++)
for (i=0; i<CURSOR_SPRITE_WIDTH; i++) for (i=0; i<CURSOR_SPRITE_WIDTH; i++)
Remap_pixel(&GFX_cursor_sprite[k][j][i]); Remap_pixel(&Gfx->Cursor_sprite[k][j][i]);
// Le menu // Le menu
for (j=0; j<MENU_HEIGHT; j++) for (j=0; j<MENU_HEIGHT; j++)
for (i=0; i<MENU_WIDTH; i++) for (i=0; i<MENU_WIDTH; i++)
Remap_pixel(&GFX_menu_block[j][i]); Remap_pixel(&Gfx->Menu_block[j][i]);
// Sprites du menu // Sprites du menu
for (k=0; k<NB_MENU_SPRITES; k++) for (k=0; k<NB_MENU_SPRITES; k++)
for (j=0; j<MENU_SPRITE_HEIGHT; j++) for (j=0; j<MENU_SPRITE_HEIGHT; j++)
for (i=0; i<MENU_SPRITE_WIDTH; i++) for (i=0; i<MENU_SPRITE_WIDTH; i++)
Remap_pixel(&GFX_menu_sprite[k][j][i]); Remap_pixel(&Gfx->Menu_sprite[k][j][i]);
// Sprites d'effets // Sprites d'effets
for (k=0; k<NB_EFFECTS_SPRITES; k++) for (k=0; k<NB_EFFECTS_SPRITES; k++)
for (j=0; j<MENU_SPRITE_HEIGHT; j++) for (j=0; j<MENU_SPRITE_HEIGHT; j++)
for (i=0; i<MENU_SPRITE_WIDTH; i++) for (i=0; i<MENU_SPRITE_WIDTH; i++)
Remap_pixel(&GFX_effect_sprite[k][j][i]); Remap_pixel(&Gfx->Effect_sprite[k][j][i]);
// Fontes de l'aide // Fontes de l'aide
for (k=0; k<256; k++) for (k=0; k<256; k++)
for (j=0; j<8; j++) for (j=0; j<8; j++)
for (i=0; i<6; i++) for (i=0; i<6; i++)
Remap_pixel(&GFX_help_font_norm[k][i][j]); Remap_pixel(&Gfx->Help_font_norm[k][i][j]);
for (k=0; k<256; k++) for (k=0; k<256; k++)
for (j=0; j<8; j++) for (j=0; j<8; j++)
for (i=0; i<6; i++) for (i=0; i<6; i++)
Remap_pixel(&GFX_bold_font[k][i][j]); Remap_pixel(&Gfx->Bold_font[k][i][j]);
for (k=0; k<64; k++) for (k=0; k<64; k++)
for (j=0; j<8; j++) for (j=0; j<8; j++)
for (i=0; i<6; i++) for (i=0; i<6; i++)
Remap_pixel(&GFX_help_font_t1[k][i][j]); Remap_pixel(&Gfx->Help_font_t1[k][i][j]);
for (k=0; k<64; k++) for (k=0; k<64; k++)
for (j=0; j<8; j++) for (j=0; j<8; j++)
for (i=0; i<6; i++) for (i=0; i<6; i++)
Remap_pixel(&GFX_help_font_t2[k][i][j]); Remap_pixel(&Gfx->Help_font_t2[k][i][j]);
for (k=0; k<64; k++) for (k=0; k<64; k++)
for (j=0; j<8; j++) for (j=0; j<8; j++)
for (i=0; i<6; i++) for (i=0; i<6; i++)
Remap_pixel(&GFX_help_font_t3[k][i][j]); Remap_pixel(&Gfx->Help_font_t3[k][i][j]);
for (k=0; k<64; k++) for (k=0; k<64; k++)
for (j=0; j<8; j++) for (j=0; j<8; j++)
for (i=0; i<6; i++) for (i=0; i<6; i++)
Remap_pixel(&GFX_help_font_t4[k][i][j]); Remap_pixel(&Gfx->Help_font_t4[k][i][j]);
// Sprites de lecteurs (drives) // Sprites de lecteurs (drives)
for (k=0; k<NB_ICON_SPRITES; k++) for (k=0; k<NB_ICON_SPRITES; k++)
for (j=0; j<ICON_SPRITE_HEIGHT; j++) for (j=0; j<ICON_SPRITE_HEIGHT; j++)
for (i=0; i<ICON_SPRITE_WIDTH; i++) for (i=0; i<ICON_SPRITE_WIDTH; i++)
Remap_pixel(&GFX_icon_sprite[k][j][i]); Remap_pixel(&Gfx->Icon_sprite[k][j][i]);
} }
Clear_border(MC_Black); Clear_border(MC_Black);
} }