SRB2/src/r_patch.h

77 lines
2.5 KiB
C
Raw Normal View History

2019-10-28 11:28:42 -07:00
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
2019-12-06 12:07:57 -08:00
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
// Copyright (C) 2019 by Sonic Team Junior.
2019-10-28 11:28:42 -07:00
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_patch.h
/// \brief Patch generation.
#ifndef __R_PATCH__
#define __R_PATCH__
#include "r_defs.h"
#include "doomdef.h"
2019-12-04 10:26:51 -08:00
// Structs
2019-10-28 11:28:42 -07:00
#ifdef ROTSPRITE
typedef enum
{
2019-12-04 10:26:51 -08:00
ROTAXIS_X, // Roll (the default)
ROTAXIS_Y, // Pitch
ROTAXIS_Z // Yaw
2019-11-13 07:47:30 -08:00
} rotaxis_t;
2019-10-28 11:28:42 -07:00
typedef struct
{
INT32 x, y;
2019-11-13 07:47:30 -08:00
rotaxis_t rotaxis;
2019-10-28 11:28:42 -07:00
} spriteframepivot_t;
#endif
typedef struct
{
#ifdef ROTSPRITE
spriteframepivot_t pivot[64];
#endif
boolean available;
} spriteinfo_t;
2019-12-04 10:26:51 -08:00
// Conversions between patches / flats / textures...
2019-10-28 11:28:42 -07:00
boolean R_CheckIfPatch(lumpnum_t lump);
void R_TextureToFlat(size_t tex, UINT8 *flat);
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
void R_PatchToFlat_16bpp(patch_t *patch, UINT16 *raw, boolean flip);
patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize, boolean transparency);
patch_t *R_FlatToPatch_16bpp(UINT16 *raw, UINT16 width, UINT16 height, size_t *size);
2019-12-04 10:26:51 -08:00
// Portable Network Graphics
boolean R_IsLumpPNG(const UINT8 *d, size_t s);
#define W_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
2019-10-28 11:28:42 -07:00
#ifndef NO_PNG_LUMPS
UINT8 *R_PNGToFlat(UINT16 *width, UINT16 *height, UINT8 *png, size_t size);
patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize, boolean transparency);
boolean R_PNGDimensions(UINT8 *png, INT16 *width, INT16 *height, size_t size);
#endif
2019-12-04 10:26:51 -08:00
// SpriteInfo
extern spriteinfo_t spriteinfo[NUMSPRITES];
2019-10-28 11:28:42 -07:00
void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps);
void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
2019-12-04 10:26:51 -08:00
// Sprite rotation
2019-10-28 11:28:42 -07:00
#ifdef ROTSPRITE
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, UINT8 flip);
2019-11-14 09:12:36 -08:00
void R_FreeSingleRotSprite(spritedef_t *spritedef);
void R_FreeSkinRotSprite(size_t skinnum);
2019-10-28 11:28:42 -07:00
extern fixed_t cosang2rad[ROTANGLES];
extern fixed_t sinang2rad[ROTANGLES];
#endif
#endif // __R_PATCH__