1 //---------------------------------------------------------------------------- 2 // EDGE Data Definition File Code (Images) 3 //---------------------------------------------------------------------------- 4 // 5 // Copyright (c) 1999-2008 The EDGE Team. 6 // 7 // This program 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; either version 2 10 // of the License, or (at your option) any later version. 11 // 12 // This program 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 //---------------------------------------------------------------------------- 18 19 #ifndef __DDF_IMAGE_H__ 20 #define __DDF_IMAGE_H__ 21 22 #include "epi/utility.h" 23 24 #include "types.h" 25 26 typedef enum 27 { 28 INS_Graphic = 0, 29 INS_Texture, 30 INS_Flat, 31 INS_Sprite, 32 } 33 image_namespace_e; 34 35 // 36 // -AJA- 2004/11/16 Images.ddf 37 // 38 typedef enum 39 { 40 IMGDT_Colour = 0, // solid colour 41 IMGDT_Builtin, // built-in pre-fab DYI kit 42 IMGDT_File, // load from an image file 43 IMGDT_Lump, // load from lump in a WAD 44 45 // future: 46 // IMGDT_WadFlat 47 // IMGDT_WadTex 48 // IMGDT_WadGfx 49 // IMGDT_WadSprite 50 // IMGDT_WadPlaySkin 51 // IMGDT_WadTexPatch 52 // IMGDT_Package 53 // IMGDT_Composed 54 } 55 imagedata_type_e; 56 57 typedef enum 58 { 59 BLTIM_Quadratic = 0, 60 BLTIM_Linear, 61 BLTIM_Shadow 62 } 63 builtin_image_e; 64 65 typedef enum 66 { 67 IMGSP_None = 0, 68 69 IMGSP_NoAlpha = 0x0001, // image does not require an alpha channel 70 IMGSP_Mip = 0x0002, // force mip-mapping 71 IMGSP_NoMip = 0x0004, // disable mip-mapping 72 IMGSP_Clamp = 0x0008, // clamp image 73 IMGSP_Smooth = 0x0010, // force smoothing 74 IMGSP_NoSmooth = 0x0020, // disable smoothing 75 IMGSP_Crosshair = 0x0040, // weapon crosshair (center vertically) 76 } 77 image_special_e; 78 79 typedef enum 80 { 81 FIXTRN_None = 0, // no modification (the default) 82 FIXTRN_Blacken = 1, // make 100% transparent pixels Black 83 } 84 image_fix_trans_e; 85 86 typedef enum 87 { 88 LIF_PNG = 0, 89 LIF_JPEG, 90 LIF_TGA 91 } 92 L_image_format_e; 93 94 class imagedef_c 95 { 96 public: 97 imagedef_c(); ~imagedef_c()98 ~imagedef_c() {}; 99 100 public: 101 void Default(void); 102 void CopyDetail(const imagedef_c &src); 103 104 // Member vars.... 105 epi::strent_c name; 106 image_namespace_e belong; 107 108 imagedata_type_e type; 109 110 rgbcol_t colour; // IMGDT_Colour 111 builtin_image_e builtin; // IMGDT_Builtin 112 113 epi::strent_c info; // IMGDT_WadXXX, IMGDT_Package, IMGDT_File, IMGDT_Lump 114 L_image_format_e format; // IMGDT_Lump, IMGDT_File (etc) 115 116 image_special_e special; 117 118 int x_offset, y_offset; 119 120 int fix_trans; // FIXTRN_XXX value 121 122 // COMPOSE specifics: 123 // rgbcol_t base_col; 124 // percent_t base_trans; 125 // compose_overlay_t *overlays; 126 127 // WAD specifics: 128 // lumpname_c palette; 129 // colourmap_c *colmap; 130 131 // CONVERSION 132 // float gamma; 133 // h_formula_t conv_h; 134 // rgb_formula_t conv_s, conv_v; 135 // rgb_formula_t conv_r, conv_g, conv_b, conv_a; 136 137 // RENDERING specifics: 138 float scale, aspect; 139 // percent_t translucency; 140 // angle_t rotation; 141 142 private: 143 // disable copy construct and assignment operator imagedef_c(imagedef_c & rhs)144 explicit imagedef_c(imagedef_c &rhs) { } 145 imagedef_c& operator=(imagedef_c &rhs) { return *this; } 146 }; 147 148 149 // Our imagedefs container 150 class imagedef_container_c : public epi::array_c 151 { 152 public: imagedef_container_c()153 imagedef_container_c() : epi::array_c(sizeof(imagedef_c*)) {} ~imagedef_container_c()154 ~imagedef_container_c() { Clear(); } 155 156 private: 157 void CleanupObject(void *obj); 158 159 public: GetSize()160 int GetSize() { return array_entries; } Insert(imagedef_c * a)161 int Insert(imagedef_c *a) { return InsertObject((void*)&a); } 162 imagedef_c *operator[](int idx) { return *(imagedef_c**)FetchObject(idx); } 163 164 // Search Functions 165 imagedef_c *Lookup(const char *refname, image_namespace_e belong); 166 }; 167 168 extern imagedef_container_c imagedefs; 169 170 bool DDF_ReadImages(void *data, int size); 171 172 #endif /*__DDF_IMAGE_H__*/ 173 174 //--- editor settings --- 175 // vi:ts=4:sw=4:noexpandtab 176