1 // SONIC ROBO BLAST 2 2 //----------------------------------------------------------------------------- 3 // Copyright (C) 1993-1996 by id Software, Inc. 4 // Copyright (C) 2018-2020 by Jaime "Lactozilla" Passos. 5 // Copyright (C) 2019-2020 by Sonic Team Junior. 6 // 7 // This program is free software distributed under the 8 // terms of the GNU General Public License, version 2. 9 // See the 'LICENSE' file for more details. 10 //----------------------------------------------------------------------------- 11 /// \file r_picformats.h 12 /// \brief Patch generation. 13 14 #ifndef __R_PICFORMATS__ 15 #define __R_PICFORMATS__ 16 17 #include "r_defs.h" 18 #include "doomdef.h" 19 20 typedef enum 21 { 22 PICFMT_NONE = 0, 23 24 // Doom formats 25 PICFMT_PATCH, 26 PICFMT_FLAT, 27 PICFMT_DOOMPATCH, 28 29 // PNG 30 PICFMT_PNG, 31 32 // 16bpp 33 PICFMT_PATCH16, 34 PICFMT_FLAT16, 35 PICFMT_DOOMPATCH16, 36 37 // 32bpp 38 PICFMT_PATCH32, 39 PICFMT_FLAT32, 40 PICFMT_DOOMPATCH32 41 } pictureformat_t; 42 43 typedef enum 44 { 45 PICFLAGS_XFLIP = 1, 46 PICFLAGS_YFLIP = 1<<1 47 } pictureflags_t; 48 49 enum 50 { 51 PICDEPTH_NONE = 0, 52 PICDEPTH_8BPP = 8, 53 PICDEPTH_16BPP = 16, 54 PICDEPTH_32BPP = 32 55 }; 56 57 void *Picture_Convert( 58 pictureformat_t informat, void *picture, pictureformat_t outformat, 59 size_t insize, size_t *outsize, 60 INT32 inwidth, INT32 inheight, INT32 inleftoffset, INT32 intopoffset, 61 pictureflags_t flags); 62 63 void *Picture_PatchConvert( 64 pictureformat_t informat, void *picture, pictureformat_t outformat, 65 size_t insize, size_t *outsize, 66 INT16 inwidth, INT16 inheight, INT16 inleftoffset, INT16 intopoffset, 67 pictureflags_t flags); 68 void *Picture_FlatConvert( 69 pictureformat_t informat, void *picture, pictureformat_t outformat, 70 size_t insize, size_t *outsize, 71 INT16 inwidth, INT16 inheight, INT16 inleftoffset, INT16 intopoffset, 72 pictureflags_t flags); 73 void *Picture_GetPatchPixel( 74 patch_t *patch, pictureformat_t informat, 75 INT32 x, INT32 y, 76 pictureflags_t flags); 77 78 void *Picture_TextureToFlat(size_t trickytex); 79 80 INT32 Picture_FormatBPP(pictureformat_t format); 81 boolean Picture_IsPatchFormat(pictureformat_t format); 82 boolean Picture_IsInternalPatchFormat(pictureformat_t format); 83 boolean Picture_IsDoomPatchFormat(pictureformat_t format); 84 boolean Picture_IsFlatFormat(pictureformat_t format); 85 boolean Picture_CheckIfDoomPatch(softwarepatch_t *patch, size_t size); 86 87 // Structs 88 typedef enum 89 { 90 ROTAXIS_X, // Roll (the default) 91 ROTAXIS_Y, // Pitch 92 ROTAXIS_Z // Yaw 93 } rotaxis_t; 94 95 typedef struct 96 { 97 INT32 x, y; 98 rotaxis_t rotaxis; 99 } spriteframepivot_t; 100 101 typedef struct 102 { 103 spriteframepivot_t pivot[64]; 104 boolean available; 105 } spriteinfo_t; 106 107 // Portable Network Graphics 108 boolean Picture_IsLumpPNG(const UINT8 *d, size_t s); 109 #define Picture_ThrowPNGError(lumpname, wadfilename) I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .png - please convert to either Doom or Flat (raw) image format.", lumpname, wadfilename); // Fears Of LJ Sonic 110 111 #ifndef NO_PNG_LUMPS 112 void *Picture_PNGConvert( 113 const UINT8 *png, pictureformat_t outformat, 114 INT32 *w, INT32 *h, 115 INT16 *topoffset, INT16 *leftoffset, 116 size_t insize, size_t *outsize, 117 pictureflags_t flags); 118 boolean Picture_PNGDimensions(UINT8 *png, INT32 *width, INT32 *height, INT16 *topoffset, INT16 *leftoffset, size_t size); 119 #endif 120 121 #define PICTURE_PNG_USELOOKUP 122 123 // SpriteInfo 124 extern spriteinfo_t spriteinfo[NUMSPRITES]; 125 void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps); 126 void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum); 127 128 #endif // __R_PICFORMATS__ 129