1 /* vim:expandtab:ts=2 sw=2: 2 */ 3 /* Grafx2 - The Ultimate 256-color bitmap paint program 4 5 Copyright owned by various GrafX2 authors, see COPYRIGHT.txt for details. 6 7 Grafx2 is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License 9 as published by the Free Software Foundation; version 2 10 of the License. 11 12 Grafx2 is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with Grafx2; if not, see <http://www.gnu.org/licenses/> 19 */ 20 21 ////////////////////////////////////////////////////////////////////////////// 22 ///@file struct.h 23 /// Structures that can be used in the whole program. 24 ////////////////////////////////////////////////////////////////////////////// 25 #ifndef _STRUCT_H_ 26 #define _STRUCT_H_ 27 28 #if defined(__BEOS__) || defined(__TRU64__) 29 #include <inttypes.h> 30 #else 31 #include <stdint.h> 32 #endif 33 34 #include "const.h" 35 36 37 // POSIX calls it strcasecmp, Windows uses stricmp... no ANSI standard. 38 #ifdef WIN32 39 #ifdef _MSC_VER 40 #define strcasecmp _stricmp 41 #else 42 #define strcasecmp stricmp 43 #endif 44 #endif 45 46 // Definition of the base data types 47 /// 8bit unsigned integer 48 typedef uint8_t byte; 49 /// 16bit unsigned integer 50 typedef uint16_t word; 51 /// 32bit unsigned integer 52 typedef uint32_t dword; 53 /// 64bit unsigned integer 54 typedef uint64_t qword; 55 56 // Named function prototypes 57 // GrafX2 use a lot of function pointer to do the drawing depending in the "fake hardware zoom" and the magnifier status. 58 typedef void (* Func_action) (void); ///< An action. 59 typedef void (* Func_btn_action) (int); ///< An action. Used when you click a menu button or trigger a keyboard shortcut. 60 typedef void (* Func_pixel) (word,word,byte); ///< Set pixel at position (x,y) to color c. Used in load screen to write the data to brush, picture, or preview area. 61 typedef void (* Func_pixel_opt_preview) (word,word,byte,int); ///< Set pixel at position (x,y) to color c. With optional preview. 62 typedef byte (* Func_read) (word,word); ///< Read a pixel at position (x,y) on something. Used for example in save to tell if the data is a brush or a picture 63 typedef void (* Func_clear) (byte); 64 typedef void (* Func_display) (word,word,word); 65 typedef byte (* Func_effect) (word,word,byte); ///< Called by all drawing tools to draw with a special effect (smooth, transparency, shade, ...) 66 typedef void (* Func_block) (word,word,word,word,byte); 67 typedef void (* Func_line_XOR) (word,word,word); ///< Draw an XOR line on the picture view of the screen. Use a different function when in magnify mode. 68 typedef void (* Func_display_brush_color) (word,word,word,word,word,word,byte,word); 69 typedef void (* Func_display_brush_mono) (word,word,word,word,word,word,byte,byte,word); 70 typedef void (* Func_gradient) (long,short,short); 71 typedef void (* Func_remap) (word,word,word,word,byte *); 72 typedef void (* Func_procsline) (word,word,word,byte *); 73 typedef void (* Func_display_zoom) (word,word,word,byte *); 74 typedef void (* Func_display_brush_color_zoom) (word,word,word,word,word,word,byte,word,byte *); 75 typedef void (* Func_display_brush_mono_zoom) (word,word,word,word,word,word,byte,byte,word,byte *); 76 typedef void (* Func_draw_brush) (byte *,word,word,word,word,word,word,byte,word); 77 typedef void (* Func_draw_list_item) (word,word,word,byte); ///< Draw an item inside a list button. This is done with a callback so it is possible to draw anything, as the list itself doesn't handle the content 78 79 /// A set of RGB values. 80 #ifdef __GNUC__ 81 typedef struct 82 { 83 byte R; ///< Red 84 byte G; ///< Green 85 byte B; ///< Blue 86 } __attribute__((__packed__)) T_Components, T_Palette[256] ; ///< A complete 256-entry RGB palette (768 bytes). 87 #else 88 #pragma pack(1) 89 typedef struct 90 { 91 byte R; ///< Red 92 byte G; ///< Green 93 byte B; ///< Blue 94 } T_Components, T_Palette[256] ; ///< A complete 256-entry RGB palette (768 bytes). 95 #pragma pack() 96 #endif 97 98 /// A normal rectangular button in windows and menus. 99 typedef struct T_Normal_button 100 { 101 short Number; ///< Unique identifier for all controls 102 word Pos_X; ///< Coordinate for top of button, relative to the window, before scaling. 103 word Pos_Y; ///< Coordinate for left of button, relative to the window, before scaling. 104 word Width; ///< Width before scaling 105 word Height; ///< Height before scaling 106 byte Clickable; ///< Boolean, unused. 107 byte Repeatable; ///< Boolean, true if the button activates repeatedly until you release the mouse button. Used for "+" buttons, for example. 108 word Shortcut; ///< Keyboard shortcut that will emulate a click on this button. 109 struct T_Normal_button * Next;///< Pointer to the next normal button of current window. 110 } T_Normal_button; 111 112 /// A window control that shows a complete 256-color palette 113 typedef struct T_Palette_button 114 { 115 short Number; ///< Unique identifier for all controls 116 word Pos_X; ///< Coordinate for top of button, relative to the window, before scaling. 117 word Pos_Y; ///< Coordinate for left of button, relative to the window, before scaling. 118 struct T_Palette_button * Next;///< Pointer to the next palette of current window. 119 } T_Palette_button; 120 121 /// A window control that represents a scrollbar, with a slider, and two arrow buttons. 122 typedef struct T_Scroller_button 123 { 124 short Number; ///< Unique identifier for all controls 125 byte Is_horizontal; ///< Boolean: True if slider is horizontal instead of vertical. 126 word Pos_X; ///< Coordinate for top of button, relative to the window, before scaling. 127 word Pos_Y; ///< Coordinate for left of button, relative to the window, before scaling. 128 word Length; ///< Length before scaling. 129 word Nb_elements; ///< Number of distinct values it can take. 130 word Nb_visibles; ///< If this slider is meant to show several elements of a collection, this is their number (otherwise, it's 1). 131 word Position; ///< Current position of the slider: which item it's pointing. 132 word Cursor_length; ///< Dimension of the slider, in pixels before scaling. 133 struct T_Scroller_button * Next;///< Pointer to the next scroller of current window. 134 } T_Scroller_button; 135 136 /// Special invisible button 137 /// A window control that only has a rectangular "active" area which catches mouse clicks, 138 // but no visible shape. It's used for custom controls where the drawing is done on 139 // a case by case basis. 140 typedef struct T_Special_button 141 { 142 short Number; ///< Unique identifier for all controls 143 word Pos_X; ///< Coordinate for top of button, relative to the window, before scaling. 144 word Pos_Y; ///< Coordinate for left of button, relative to the window, before scaling. 145 word Width; ///< Width before scaling 146 word Height; ///< Height before scaling 147 word Shortcut; ///< Keyboard shortcut that will emulate a click on this button. 148 struct T_Special_button * Next;///< Pointer to the next special button of current window. 149 } T_Special_button; 150 151 /// Data for a dropdown item, ie. one proposed choice. 152 typedef struct T_Dropdown_choice 153 { 154 short Number; ///< Value that identifies the choice (for this dropdown only) 155 const char * Label; ///< String to display in the dropdown panel 156 struct T_Dropdown_choice * Next;///< Pointer to the next choice for this dropdown. 157 } T_Dropdown_choice; 158 159 /// A window control that behaves like a dropdown button. 160 typedef struct T_Dropdown_button 161 { 162 short Number; ///< Unique identifier for all controls 163 word Pos_X; ///< Coordinate for top of button, relative to the window, before scaling. 164 word Pos_Y; ///< Coordinate for left of button, relative to the window, before scaling. 165 word Width; ///< Width before scaling 166 word Height; ///< Height before scaling 167 byte Display_choice; ///< Boolean, true if the engine should print the selected item's label in the dropdown area when the user chooses it. 168 byte Display_centered; ///< Boolean, true to center the labels (otherwise, align left) 169 byte Display_arrow; ///< Boolean, true to display a "down" arrow box in top right 170 byte Bottom_up; ///< Boolean, true to make the dropdown panel go above its button instead of below it 171 byte Active_button; ///< Determines which mouse button(s) cause the dropdown panel to open: LEFT_SIDE || RIGHT_SIDE || (LEFT_SIDE|RIGHT_SIDE) 172 word Dropdown_width; ///< Width of the dropdown panel when it's open. Use 0 for "same as the dropdown button" 173 T_Dropdown_choice * First_item; ///< Linked list with the choices available for this dropdown. 174 struct T_Dropdown_button * Next;///< Pointer to the next dropdown button of current window. 175 } T_Dropdown_button; 176 177 /// Data for one item (file, directory) in a fileselector. 178 typedef struct T_Fileselector_item 179 { 180 enum FSOBJECT_TYPE Type; ///< Type of item: 0 = File, 1 = Directory, 2 = Drive 181 byte Icon; ///< One of ::ICON_TYPES, ICON_NONE for none. 182 183 struct T_Fileselector_item * Next; ///< Pointer to next item of the current fileselector. 184 struct T_Fileselector_item * Previous;///< Pointer to previous item of the current fileselector. 185 186 word * Unicode_full_name; ///< Pointer to allocated unicode string. Filesystem name 187 word * Unicode_short_name; ///< Pointer to allocated unicode string. Name to display 188 189 char Short_name[36]; ///< Name to display. limited to 35 characters (used in factory.c) 190 char Full_name[1]; ///< Filesystem value. 191 // No field after Full_name[] ! Dynamic allocation according to name length. 192 } T_Fileselector_item; 193 194 /// Data for a fileselector 195 typedef struct T_Fileselector 196 { 197 /// Number of elements in the current fileselector's ::Filelist 198 unsigned short Nb_elements; 199 /// Number of files in the current fileselector's ::Filelist 200 unsigned short Nb_files; 201 /// Number of directories in the current fileselector's ::Filelist 202 unsigned short Nb_directories; 203 /// Head of the linked list for the fileselector. 204 T_Fileselector_item * First; 205 /// Index for direct access to element number N 206 T_Fileselector_item ** Index; 207 } T_Fileselector; 208 209 /// "List" button as used in the font selection, skin selection, and brush factory screens. It's like a limited filelist. 210 /// The screenmode selection and load/save screen were written before this existed so they use their own code. It would be nice if they were updated to use this one. 211 typedef struct T_List_button 212 { 213 short Number; ///< Unique identifier for all controls 214 short List_start; ///< Index of the font to appear as first line 215 short Cursor_position; ///< Index of the selected line (0=top) 216 217 T_Special_button * Entry_button; ///< Pointer to the associated selection control. 218 T_Scroller_button * Scroller; ///< Pointer to the associated scroller 219 220 Func_draw_list_item Draw_list_item; ///< Function to call for each item to draw its line 221 byte Color_index; ///< Background color: From 0->MC_Black to 3->MC_White 222 223 struct T_List_button * Next; ///< Pointer to the next list button of current window. 224 } T_List_button; 225 226 /// A stackable window (editor screen) 227 typedef struct 228 { 229 word Pos_X; 230 word Pos_Y; 231 word Width; 232 word Height; 233 word Nb_buttons; 234 T_Normal_button *Normal_button_list; 235 T_Palette_button *Palette_button_list; 236 T_Scroller_button *Scroller_button_list; 237 T_Special_button *Special_button_list; 238 T_Dropdown_button *Dropdown_button_list; 239 T_List_button *List_button_list; 240 int Attribute1; 241 int Attribute2; 242 byte Draggable; 243 } T_Window; 244 245 /// Data for one line of the "Help" screens. 246 typedef struct { 247 char Line_type; ///< Kind of line: 'N' for normal line, 'S' for a bold line, 'K' for a line with keyboard shortcut, 'T' and '-' for upper and lower titles. 248 const char * Text; ///< Displayed string. 249 int Line_parameter; ///< Generic parameter depending on line type. For 'K' lines: a shortcut identifier. For others: unused. 250 } T_Help_table; 251 252 /// Data for one section of the "Help" screens, ie a page. 253 typedef struct 254 { 255 const T_Help_table* Help_table; ///< Pointer to the array of ::T_Help_table that contains the lines 256 word Length; ///< Size of the array of lines 257 } T_Help_section; 258 259 /// Data for one setting of gradients. Warning, this one is saved/loaded as binary. 260 typedef struct 261 { 262 byte Start; ///< First color 263 byte End; ///< Last color 264 dword Inverse; ///< Boolean, true if the gradient goes in descending order 265 dword Mix; ///< Amount of randomness to add to the mix (0-255) 266 dword Technique;///< Gradient technique: 0 (no pattern) 1 (dithering), or 2 (big dithering) 267 byte Speed; ///< Speed of cycling. 0 for disabled, max value COLOR_CYCLING_SPEED_MAX. 1=>0.2856Hz, 64=>18.28Hz 268 } T_Gradient_range; 269 270 #define COLOR_CYCLING_SPEED_MAX 250 271 272 /// Data for a full set of gradients. 273 typedef struct 274 { 275 int Used; ///< Reference count 276 T_Gradient_range Range[16]; 277 } T_Gradient_array; 278 279 /// Data for one setting of shade. Warning, this one is saved/loaded as binary. 280 typedef struct 281 { 282 word List[512]; ///< List of entries, each one is either a color (0-255) or -1 for empty. 283 byte Step; ///< Step to increment/decrement on left-clicks. 284 byte Mode; ///< Shade mode: Normal, Loop, or No-saturation see ::SHADE_MODES 285 } T_Shade; 286 287 /// Data for one fullscreen video mode in configuration file. Warning, this one is saved/loaded as binary. 288 typedef struct 289 { 290 byte State; ///< How good is the mode supported. 0:Good (white) 1:OK (light) 2:So-so (dark) 4:User-disabled (black); +128 => System doesn't support it at all. 291 word Width; ///< Videomode width in pixels. 292 word Height;///< Videomode height in pixels. 293 } T_Config_video_mode; 294 295 /// Header for gfx2.cfg 296 typedef struct 297 { 298 char Signature[3]; ///< Signature for the file format. "CFG". 299 byte Version1; ///< Major version number (ex: 2) 300 byte Version2; ///< Minor version number (ex: 0) 301 byte Beta1; ///< Major beta version number (ex: 96) 302 byte Beta2; ///< Major beta version number (ex: 5) 303 } T_Config_header; 304 305 /// Header for a config chunk in for gfx2.cfg 306 typedef struct 307 { 308 byte Number; ///< Section identfier. Possible values are in enum ::CHUNKS_CFG 309 word Size; ///< Size of the configuration block that follows, in bytes. 310 } T_Config_chunk; 311 312 313 /// Configuration for one keyboard shortcut in gfx2.cfg 314 typedef struct 315 { 316 word Number; ///< Indicates the shortcut action. This is a number starting from 0, which matches ::T_Key_config.Number 317 word Key; ///< Keyboard shortcut: SDLK_something, or -1 for none 318 word Key2; ///< Alternate keyboard shortcut: SDLK_something, or -1 for none 319 } T_Config_shortcut_info; 320 321 322 /// This structure holds all the settings saved and loaded as gfx2.ini. 323 typedef struct 324 { 325 char *Font_file; ///< Name of the font used in the menus. Matches file skins/font_*.png (Case-sensitive on some filesystems) 326 char *Skin_file; ///< String, name of the file where all the graphic data is stored 327 int Show_hidden_files; ///< Boolean, true to show hidden files in fileselectors. 328 int Show_hidden_directories; ///< Boolean, true to show hidden directories in fileselectors. 329 // int Show_system_directories; ///< (removed when converted from DOS) 330 byte Display_image_limits; ///< Boolean, true to display a dotted line at the borders of the image if it's smaller than screen. 331 byte Cursor; ///< Mouse cursor aspect: 1 Solid, 2 Transparent, 3 Thin 332 byte Maximize_preview; ///< Boolean, true to make previews in fileselector fit the whole rectangle. 333 byte Auto_set_res; ///< Boolean, true to make grafx2 switch to a new resolution whenever you load an image. 334 byte Coords_rel; ///< Boolean, true to display coordinates as relative (instead of absolute) 335 byte Backup; ///< Boolean, true to backup the original file whenever you save an image. 336 byte Adjust_brush_pick; ///< Boolean, true to omit the right and bottom edges when grabbing a brush in Grid mode. 337 byte Auto_save; ///< Boolean, true to save configuration when exiting program. 338 byte Max_undo_pages; ///< Number of steps to memorize for Undo/Redo. 339 byte Mouse_sensitivity_index_x; ///< Mouse sensitivity in X axis 340 byte Mouse_sensitivity_index_y; ///< Mouse sensitivity in Y axis 341 byte Mouse_merge_movement; ///< Number of SDL mouse events that are merged into a single change of mouse coordinates. 342 byte Delay_left_click_on_slider; ///< Delay (in 1/100s) between two activations of a repeatable button when you hold left-click. 343 byte Delay_right_click_on_slider; ///< Delay (in 1/100s) between two activations of a repeatable button when you hold left-click. 344 long Timer_delay; ///< Delay (in 1/55s) before showing a preview in a fileselector. 345 T_Components Fav_menu_colors[4]; ///< Favorite colors to use for the menu. 346 int Nb_max_vertices_per_polygon; ///< Limit for the number of vertices in polygon tools. 347 byte Clear_palette; ///< Boolean, true to reset the palette (to black) before loading an image. 348 byte Set_resolution_according_to; ///< When Auto_set_res is on, this determines if the mode should be chosen according to the "original screen" information in the file (1) or the picture dimensons (2) 349 int8_t Ratio; ///< Determines the scaling of menu and windows: 0 no scaling, 1 scaling, 2 slight scaling, negative= opposite of max scaling 350 byte Fast_zoom; ///< Boolean, true if the magnifier shortcut should automatically view the mouse area. 351 byte Find_file_fast; ///< In fileselectors, this determines which entries should be sought when typing letters: 0 all, 1 files only, 2 directories only. 352 byte Separate_colors; ///< Boolean, true if the menu palette should separate color cells with a black outline. 353 word Palette_cells_X; ///< Number of colors to show in a row of the menu palette. 354 word Palette_cells_Y; ///< Number of colors to show in a column of the menu palette. 355 byte Palette_vertical; ///< Boolean, true if the menu palette should go top to bottom instead of left to right 356 byte FX_Feedback; ///< Boolean, true if drawing effects should read the image being modified (instead of the image before clicking) 357 byte Safety_colors; ///< Boolean, true to make the palette automatically re-create menu colors if needed after a "Zap" or color reduction. 358 byte Opening_message; ///< Boolean, true to display the splash screen on strtup. 359 byte Clear_with_stencil; ///< Boolean, true to take the stencil into effect (if active) when using the Clear function. 360 byte Auto_discontinuous; ///< Boolean, true to automatically switch to the discontinuous freehand draw after grabbing a brush. 361 byte Screen_size_in_GIF; ///< Boolean, true to store current resolution in GIF files. 362 byte Auto_nb_used; ///< Boolean, true to count colors in Palette screen. 363 byte Default_resolution; ///< Default video mode to use on startup. Index in ::Video_mode. 364 char *Bookmark_directory[NB_BOOKMARKS];///< Bookmarked directories in fileselectors: This is the full directory name. 365 char Bookmark_label[NB_BOOKMARKS][24]; ///< Bookmarked directories in fileselectors: This is the displayed name. 366 int Window_pos_x; ///< Last window x position (9999 if unsupportd/irrelevant for the platform) 367 int Window_pos_y; ///< Last window y position (9999 if unsupportd/irrelevant for the platform) 368 word Double_click_speed; ///< Maximum delay for double-click, in ms. 369 word Double_key_speed; ///< Maximum delay for double-keypress, in ms. 370 byte Right_click_colorpick; ///< Boolean, true to enable a "tablet" mode, where RMB acts as instant colorpicker 371 byte Sync_views; ///< Boolean, true when the Main and Spare should share their viewport settings. 372 byte Stylus_mode; ///< Boolean, true to tweak some tools (eg:Curve) for single-button stylus. 373 word Swap_buttons; ///< Sets which key swaps mouse buttons : 0=none, or GFX2_MOD_CTRL, or GFX2_MOD_ALT. 374 char * Scripts_directory; ///< Full pathname of directory for Lua scripts 375 byte Allow_multi_shortcuts; ///< Boolean, true if the same key combination can trigger multiple shortcuts. 376 byte Tilemap_allow_flipped_x; ///< Boolean, true if the Tilemap tool should detect x-flipped tiles. 377 byte Tilemap_allow_flipped_y; ///< Boolean, true if the Tilemap tool should detect y-flipped tiles. 378 byte Tilemap_show_count; ///< Boolean, true if the Tilemap tool should display tile count after analysis. 379 byte Use_virtual_keyboard; ///< 0: Auto, 1: On, 2: Off 380 byte Default_mode_layers; ///< Indicates if default new image has layers (alternative is animation) 381 byte MOTO_gamma; ///< Number, 10 x the Gamma used for converting MO6/TO8/TO9 palette 382 383 } T_Config; 384 385 // Structures utilisées pour les descriptions de pages et de liste de pages. 386 // Lorsqu'on gèrera les animations, il faudra aussi des listes de listes de 387 // pages. 388 389 // Ces structures sont manipulées à travers des fonctions de gestion du 390 // backup dans "graph.c". 391 392 typedef struct T_Image 393 { 394 byte * Pixels; 395 int Duration; 396 } T_Image; 397 398 /// This is the data for one step of Undo/Redo, for one image. 399 /// This structure is resized dynamically to hold pointers to all of the layers in the picture. 400 /// The pointed layers are just byte* holding the raw pixel data. But at Image[0]-1 you will find a short that is used as a reference counter for each layer. 401 /// This way we can use the same pixel data in many undo pages when the user edit only one of the layers (which is what they usually do). 402 typedef struct T_Page 403 { 404 int Width; ///< Image width in pixels. 405 int Height; ///< Image height in pixels. 406 T_Palette Palette; ///< Image palette. 407 408 enum IMAGE_MODES Image_mode; ///< 0= layered image, 1=animation, 409 410 char Comment[COMMENT_SIZE+1]; ///< Comment to store in the image file. 411 412 char * File_directory; ///< Directory that contains the file. 413 char * Filename; ///< Filename without directory. 414 word * Filename_unicode; ///< Filename without directory. 415 enum FILE_FORMATS File_format; ///< File format, in enum ::FILE_FORMATS 416 struct T_Page *Next; ///< Pointer to the next backup 417 struct T_Page *Prev; ///< Pointer to the previous backup 418 T_Gradient_array *Gradients; ///< Pointer to the gradients used by the image. 419 byte Background_transparent; ///< Boolean, true if Layer 0 should have transparent pixels 420 byte Transparent_color; ///< Index of transparent color. 0 to 255. 421 int Nb_layers; ///< Number of layers 422 #if __GNUC__ < 3 423 // gcc2 doesn't suport [], but supports [0] which does the same thing. 424 T_Image Image[0]; ///< Pixel data for the (first layer of) image. 425 #else 426 T_Image Image[]; ///< Pixel data for the (first layer of) image. 427 #endif 428 // No field after Image[] ! Dynamic layer allocation for Image[1], [2] etc. 429 } T_Page; 430 431 /// Collection of undo/redo steps. 432 typedef struct 433 { 434 int List_size; ///< Number of ::T_Page in the vector "Pages". 435 T_Page * Pages; ///< Head of a linked list of pages, each one being a undo/redo step. 436 } T_List_of_pages; 437 438 /// A single image bitmap 439 /// This struct is used to store a flattened view of the current picture. 440 typedef struct 441 { 442 int Width; ///< Image width in pixels. 443 int Height; ///< Image height in pixels. 444 byte * Image; ///< Pixel data for the image. 445 } T_Bitmap; 446 447 /// A single memorized brush from the Brush Container 448 typedef struct 449 { 450 byte Paintbrush_shape; ///< Kind of brush 451 byte Thumbnail[BRUSH_CONTAINER_PREVIEW_WIDTH][BRUSH_CONTAINER_PREVIEW_HEIGHT]; 452 // Data for color brush 453 word Width; 454 word Height; 455 byte * Brush; /// < Color brush (if any) 456 T_Palette Palette; 457 byte Colormap[256]; 458 byte Transp_color; 459 } T_Brush_template; 460 461 /// GUI skin data 462 typedef struct 463 { 464 // Mouse 465 466 /// X coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_WIDTH 467 word Cursor_offset_X[NB_CURSOR_SPRITES]; 468 /// Y coordinate of the mouse cursor's "hot spot". It is < ::CURSOR_SPRITE_HEIGHT 469 word Cursor_offset_Y[NB_CURSOR_SPRITES]; 470 /// Graphic resources for the mouse cursor. 471 byte Cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH]; 472 473 // Sieve patterns 474 475 /// Preset sieve patterns, stored as binary (one word per line) 476 word Sieve_pattern[12][16]; 477 478 // Menu and other graphics 479 480 /// Bitmap data for the menu, a single rectangle. 481 byte Menu_block[3][35][MENU_WIDTH]; 482 byte Layerbar_block[3][10][144]; 483 byte Animbar_block[3][14][236]; 484 byte Statusbar_block[3][9][20]; 485 /// Bitmap data for the icons that are displayed over the menu. 486 byte Menu_sprite[2][NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH]; 487 /// Bitmap data for the different "effects" icons. 488 byte Effect_sprite[NB_EFFECTS_SPRITES][EFFECT_SPRITE_HEIGHT][EFFECT_SPRITE_WIDTH]; 489 /// Bitmap data for the different Layer icons. 490 byte Layer_sprite[3][16][LAYER_SPRITE_HEIGHT][LAYER_SPRITE_WIDTH]; 491 /// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed. 492 byte Logo_grafx2[231*56]; 493 /// Bitmap data for the 6x8 font used in help screens. 494 byte Help_font_norm [256][6][8]; 495 /// Bitmap data for the 6x8 font used in help screens ("bold" verstion). 496 byte Bold_font [256][6][8]; 497 // 12 498 // 34 499 /// Bitmap data for the title font used in help screens. Top-left quarter. 500 byte Help_font_t1 [64][6][8]; 501 /// Bitmap data for the title font used in help screens. Top-right quarter. 502 byte Help_font_t2 [64][6][8]; 503 /// Bitmap data for the title font used in help screens. Bottom-left quarter. 504 byte Help_font_t3 [64][6][8]; 505 /// Bitmap data for the title font used in help screens. Bottom-right quarter. 506 byte Help_font_t4 [64][6][8]; 507 /// Bitmap data for the small 8x8 icons. 508 byte Icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH]; 509 510 /// A default 256-color palette. 511 T_Palette Default_palette; 512 513 /// Preview for displaying in the skin dialog 514 byte Preview[16][173]; 515 516 /// GUI color indices in skin palette: black, dark, light, white. 517 byte Color[4]; 518 /// Transparent GUI color index in skin file 519 byte Color_trans; 520 521 } T_Gui_skin; 522 523 typedef struct { 524 // Preset paintbrushes 525 526 /// Graphic resources for the preset paintbrushes. 527 byte Sprite[PAINTBRUSH_HEIGHT][PAINTBRUSH_WIDTH]; 528 /// Width of the preset paintbrushes. 529 word Width; 530 /// Height of the preset paintbrushes. 531 word Height; 532 /// Type of the preset paintbrush: index in enum PAINTBRUSH_SHAPES 533 byte Shape; 534 /// Brush handle for the preset brushes. Generally ::T_Paintbrush::Width[]/2 535 word Offset_X; 536 /// Brush handle for the preset brushes. Generally ::T_Paintbrush::Height[]/2 537 word Offset_Y; 538 539 } T_Paintbrush; 540 541 /** 542 * Element of a circular linked list in the tile map 543 */ 544 typedef struct 545 { 546 int Previous; ///< Previous similar tile in the linked list 547 int Next; ///< Next similar tile in the linked list 548 byte Flipped; ///< 0:no, 1:horizontally, 2:vertically, 3:both 549 } T_Tile; 550 551 /// Settings for an entire file selector screen 552 typedef struct T_Selector_settings 553 { 554 byte Format_filter; ///< 0 for "*.*", or a value of enum ::FILE_FORMATS 555 short Position; ///< Index of the first file/entry to display in list 556 short Offset; ///< Position of the "highlight" bar in the file list 557 char * Directory; ///< Directory currently browsed 558 word * Directory_unicode; ///< Directory currently browsed 559 char * filename; ///< Filename (without directory) of the highlighted file 560 word * filename_unicode; ///< /// Filename (without directory) of the highlighted file 561 } T_Selector_settings; 562 563 /// structure for Main or Spare page global data 564 typedef struct 565 { 566 /// Palette 567 T_Palette palette; 568 /// Boolean, means the page has been modified since last save. 569 byte image_is_modified; 570 /// Width in pixels of the image. 571 short image_width; 572 /// Height in pixels of the image. 573 short image_height; 574 /// X position (in image space) of the pixel to display in the top left corner of screen. 575 short offset_X; 576 /// Y position (in image space) of the pixel to display in the top left corner of screen. 577 short offset_Y; 578 /// File format of the image currently edited as page. It's a value of enum ::FILE_FORMATS 579 enum FILE_FORMATS fileformat; 580 /// File selector settings 581 T_Selector_settings selector; 582 /// X position (in screen coordinates) of the separator between normal and magnified views. 583 short separator_position; 584 /// X position (in screen coordinates) of the first pixel of the magnified view. 585 short X_zoom; 586 /// Proportion of the non-magnified part of the screen. 587 float separator_proportion; 588 /// Boolean, true if the main image has the magnifier active. 589 byte magnifier_mode; 590 /// Zoom factor used in the magnifier. 591 word magnifier_factor; 592 /// Width of the magnified view for the page. 593 word magnifier_height; 594 /// Height of the magnified view for the page. 595 word magnifier_width; 596 /// X position (in image space) of the pixel to display in the top left corner of the magnified view. 597 short magnifier_offset_X; 598 /// Y position (in image space) of the pixel to display in the top left corner of the magnified view. 599 short magnifier_offset_Y; 600 /// Index of layer currently being edited 601 int current_layer; 602 /// Bitfield that records which layers are visible. 2^0 for 0, 2^1 for 1, 2^2 for 2, etc. 603 dword layers_visible; 604 /// Backup for layers_visible 605 dword layers_visible_backup; 606 /// Index to use next time, when creating incremental backups, to make unique filename. 607 long safety_number; 608 /// Number of edit actions since the last safety backup 609 long edits_since_safety_backup; 610 /// SDL Time of the previous safety backup 611 dword time_of_safety_backup; 612 /// Letter prefix for the filenames of safety backups. a or b 613 byte safety_backup_prefix; 614 /// Tilemap mode 615 byte tilemap_mode; 616 /// Tilemap 617 T_Tile * tilemap; 618 /// Number of tiles (horizontally) for the tilemap 619 short tilemap_width; 620 /// Number of tiles (vertically) for the tilemap 621 short tilemap_height; 622 /// The pixels of visible layers, flattened copy. 623 T_Bitmap visible_image; 624 /// List of backup pages for the main image. 625 T_List_of_pages * backups; 626 } T_Document; 627 628 typedef struct T_Unicode_Font 629 { 630 struct T_Unicode_Font * Next; 631 dword FirstChar; 632 dword LastChar; 633 byte * FontData; 634 } T_Unicode_Font; 635 636 #endif 637