1 /* 2 * lists.h 3 * AYM 2000-04-29 4 */ 5 6 7 /* 8 This file is part of Yadex. 9 10 Yadex incorporates code from DEU 5.21 that was put in the public domain in 11 1994 by Rapha�l Quinet and Brendon Wyber. 12 13 The rest of Yadex is Copyright � 1997-2003 Andr� Majorel and others. 14 15 This program is free software; you can redistribute it and/or modify it under 16 the terms of the GNU General Public License as published by the Free Software 17 Foundation; either version 2 of the License, or (at your option) any later 18 version. 19 20 This program is distributed in the hope that it will be useful, but WITHOUT 21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License along with 25 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 26 Place, Suite 330, Boston, MA 02111-1307, USA. 27 */ 28 29 30 #ifndef YH_LISTS /* DO NOT INSERT ANYTHING BEFORE THIS LINE */ 31 #define YH_LISTS 32 33 #include "img.h" 34 35 36 /* AYM 19980112 37 This is the format of the block that the callback function (*hookfunc)() 38 and its caller InputNameFromListWithFunc() use to communicate. It 39 includes the old hookfunc parameters (x0, y0, x1, y1, name) plus a 40 couple of new parameters. The purpose of those new parameters is : 41 1. Give the caller an easy way to know the actual size of the 42 image (for shift-F1). 43 2. Hence let the caller display the size (remember "yes you 44 can laugh at the way I did it..." ?). 45 3. Provide the caller with various statistics such as number of 46 patches in current texture etc. Good tourist information :) 47 4. Give the caller a way to know whether the image has been 48 drawn (i.e. "ready for shift-F1 ?") 49 5. Give the caller something to call Img::save() on when user 50 presses [Shift][F1]. 51 Why did I create a structure instead of just adding parameters to the 52 hookfunc ? Just for the sake of streamlining the prototype of 53 InputNameFromListWithFunc() :) 54 In the following, 55 - "expected" means "set by caller, read by callee" 56 - "returned" means "set by callee, read by caller" 57 - "both" means... both :-) 58 59 img 60 The Img is part of the structure. The callee should not 61 make any assumptions regarding the contents and property 62 of img ; it should call resize() and set_opaque() 63 systematically. The callee should not clear the Img 64 before exiting, because the caller may need it for the 65 save-to-file function. 66 67 For that reason, the caller should put the whole image 68 in img, *not* clipped to the dimensions of the screen 69 area on which it will be displayed. Unfortunately, that 70 is currently (2000-10-31) not possible because of 71 limitations in the Sticker class. 72 73 The caller may do whatever it pleases with img. 74 */ 75 typedef struct 76 { 77 int x0; // [expected] Top left corner of where to draw image 78 int y0; 79 int x1; // [expected] Bottom right corner 80 int y1; 81 int disp_x0; // [returned] Top left corner and bottom right corner 82 int disp_y0; // of area that was drawn on by callee. This is so that 83 int disp_x1; // the caller knows what needs to be cleared... 84 int disp_y1; 85 int xofs; // [expected] Top left corner of image in buffer 86 int yofs; 87 const char *name; // [expected] Name of image to display 88 int flags; // [both] Flags 89 Img img; // [returned] Image buffer (clipped !) 90 int width; // [returned] Width of image before clipping 91 int height; // [returned] Height of image before clipping 92 int npatches; // [returned] Textures only : number of patches 93 int maxpatches; // [expected] Textures: if !0 only render that many patches 94 Lump_loc lump_loc;// [returned] Location of lump that was just displayed 95 } hookfunc_comm_t; 96 const int HOOK_DRAWN = 1 << 0; // Image is completely drawn 97 const int HOOK_SIZE_VALID = 1 << 1; // width and height are valid 98 const int HOOK_DISP_SIZE = 1 << 2; // Caller should display "widthxheight" 99 const int HOOK_SPECTRAL = 1 << 3; // Render picture with a spectral look 100 const int HOOK_PATCH = 1 << 4; // Use patch_dir.loc_by_name() 101 const int HOOK_SPRITE = 1 << 5; // Use wad_res.sprites.loc_by_name() 102 const int HOOK_LOC_VALID = 1 << 6; // lump_loc is valid 103 const int HOOK_ROOT = 1 << 7; // .name is the prefix. Use loc_by_root 104 105 106 void InputNameFromListWithFunc (int, int, const char *, size_t, 107 const char *const *, size_t, char *, int, int, 108 void (*hookfunc)(hookfunc_comm_t *), 109 char flags_to_pass_to_callback = 0); 110 void InputNameFromList (int, int, const char *, size_t, const char *const *, 111 char *); 112 113 114 #endif /* DO NOT ADD ANYTHING AFTER THIS LINE */ 115