mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Picture formats test
This commit is contained in:
parent
4ffe5d0670
commit
4e0810e8a3
17 changed files with 703 additions and 346 deletions
|
|
@ -123,7 +123,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
||||||
r_sky.c
|
r_sky.c
|
||||||
r_splats.c
|
r_splats.c
|
||||||
r_things.c
|
r_things.c
|
||||||
r_patch.c
|
r_picformats.c
|
||||||
r_portal.c
|
r_portal.c
|
||||||
|
|
||||||
r_bsp.h
|
r_bsp.h
|
||||||
|
|
@ -138,7 +138,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
||||||
r_splats.h
|
r_splats.h
|
||||||
r_state.h
|
r_state.h
|
||||||
r_things.h
|
r_things.h
|
||||||
r_patch.h
|
r_picformats.h
|
||||||
r_portal.h
|
r_portal.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ OBJS:=$(i_main_o) \
|
||||||
$(OBJDIR)/r_sky.o \
|
$(OBJDIR)/r_sky.o \
|
||||||
$(OBJDIR)/r_splats.o \
|
$(OBJDIR)/r_splats.o \
|
||||||
$(OBJDIR)/r_things.o \
|
$(OBJDIR)/r_things.o \
|
||||||
$(OBJDIR)/r_patch.o \
|
$(OBJDIR)/r_picformats.o \
|
||||||
$(OBJDIR)/r_portal.o \
|
$(OBJDIR)/r_portal.o \
|
||||||
$(OBJDIR)/screen.o \
|
$(OBJDIR)/screen.o \
|
||||||
$(OBJDIR)/v_video.o \
|
$(OBJDIR)/v_video.o \
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "r_draw.h"
|
#include "r_draw.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#include "../z_zone.h"
|
#include "../z_zone.h"
|
||||||
#include "../v_video.h"
|
#include "../v_video.h"
|
||||||
#include "../r_draw.h"
|
#include "../r_draw.h"
|
||||||
#include "../r_patch.h"
|
#include "../r_picformats.h"
|
||||||
#include "../p_setup.h"
|
#include "../p_setup.h"
|
||||||
|
|
||||||
// Values set after a call to HWR_ResizeBlock()
|
// Values set after a call to HWR_ResizeBlock()
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#include "../p_local.h"
|
#include "../p_local.h"
|
||||||
#include "../p_setup.h"
|
#include "../p_setup.h"
|
||||||
#include "../r_local.h"
|
#include "../r_local.h"
|
||||||
#include "../r_patch.h"
|
#include "../r_picformats.h"
|
||||||
#include "../r_bsp.h"
|
#include "../r_bsp.h"
|
||||||
#include "../d_clisrv.h"
|
#include "../d_clisrv.h"
|
||||||
#include "../w_wad.h"
|
#include "../w_wad.h"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include "p_mobj.h"
|
#include "p_mobj.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "doomstat.h" // luabanks[]
|
#include "doomstat.h" // luabanks[]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "r_draw.h"
|
#include "r_draw.h"
|
||||||
|
|
||||||
|
|
@ -574,6 +574,8 @@ Ploadflat (levelflat_t *levelflat, const char *flatname)
|
||||||
|
|
||||||
lumpnum_t flatnum;
|
lumpnum_t flatnum;
|
||||||
int texturenum;
|
int texturenum;
|
||||||
|
patch_t *flatpatch;
|
||||||
|
size_t lumplength;
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -635,7 +637,9 @@ texturefound:
|
||||||
{
|
{
|
||||||
flatfound:
|
flatfound:
|
||||||
/* This could be a flat, patch, or PNG. */
|
/* This could be a flat, patch, or PNG. */
|
||||||
if (R_CheckIfPatch(flatnum))
|
flatpatch = W_CacheLumpNum(flatnum, PU_STATIC);
|
||||||
|
lumplength = W_LumpLength(flatnum);
|
||||||
|
if (R_CheckIfPatch(flatpatch, lumplength))
|
||||||
levelflat->type = LEVELFLAT_PATCH;
|
levelflat->type = LEVELFLAT_PATCH;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -644,8 +648,10 @@ flatfound:
|
||||||
Only need eight bytes for PNG headers.
|
Only need eight bytes for PNG headers.
|
||||||
FIXME: Put this elsewhere.
|
FIXME: Put this elsewhere.
|
||||||
*/
|
*/
|
||||||
|
if (flatpatch)
|
||||||
|
Z_Free(flatpatch);
|
||||||
W_ReadLumpHeader(flatnum, buffer, 8, 0);
|
W_ReadLumpHeader(flatnum, buffer, 8, 0);
|
||||||
if (R_IsLumpPNG(buffer, W_LumpLength(flatnum)))
|
if (R_IsLumpPNG(buffer, lumplength))
|
||||||
levelflat->type = LEVELFLAT_PNG;
|
levelflat->type = LEVELFLAT_PNG;
|
||||||
else
|
else
|
||||||
#endif/*NO_PNG_LUMPS*/
|
#endif/*NO_PNG_LUMPS*/
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "p_setup.h" // levelflats
|
#include "p_setup.h" // levelflats
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,14 +1,14 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
|
// Copyright (C) 2018-2020 by Jaime "Lactozilla" Passos.
|
||||||
// Copyright (C) 2019 by Sonic Team Junior.
|
// Copyright (C) 2019-2020 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
// See the 'LICENSE' file for more details.
|
// See the 'LICENSE' file for more details.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file r_patch.h
|
/// \file r_picformats.h
|
||||||
/// \brief Patch generation.
|
/// \brief Patch generation.
|
||||||
|
|
||||||
#ifndef __R_PATCH__
|
#ifndef __R_PATCH__
|
||||||
|
|
@ -17,6 +17,57 @@
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PICFMT_NONE = 0,
|
||||||
|
|
||||||
|
// Doom formats
|
||||||
|
PICFMT_PATCH,
|
||||||
|
PICFMT_FLAT,
|
||||||
|
|
||||||
|
// PNG
|
||||||
|
PICFMT_PNG,
|
||||||
|
|
||||||
|
// 16bpp
|
||||||
|
PICFMT_PATCH16,
|
||||||
|
PICFMT_FLAT16,
|
||||||
|
|
||||||
|
// 32bpp
|
||||||
|
PICFMT_PATCH32,
|
||||||
|
PICFMT_FLAT32
|
||||||
|
} pictureformat_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PICFLAGS_XFLIP = 1,
|
||||||
|
PICFLAGS_YFLIP = 1<<1
|
||||||
|
} pictureflags_t;
|
||||||
|
|
||||||
|
void *Picture_Convert(
|
||||||
|
pictureformat_t informat, void *picture, pictureformat_t outformat,
|
||||||
|
size_t insize, size_t *outsize,
|
||||||
|
INT32 inwidth, INT32 inheight, INT32 inleftoffset, INT32 intopoffset,
|
||||||
|
pictureflags_t flags);
|
||||||
|
|
||||||
|
void *Picture_PatchConvert(
|
||||||
|
pictureformat_t informat, void *picture, pictureformat_t outformat,
|
||||||
|
size_t insize, size_t *outsize,
|
||||||
|
INT16 inwidth, INT16 inheight, INT16 inleftoffset, INT16 intopoffset,
|
||||||
|
pictureflags_t flags);
|
||||||
|
void *Picture_FlatConvert(
|
||||||
|
pictureformat_t informat, void *picture, pictureformat_t outformat,
|
||||||
|
size_t insize, size_t *outsize,
|
||||||
|
INT16 inwidth, INT16 inheight, INT16 inleftoffset, INT16 intopoffset,
|
||||||
|
pictureflags_t flags);
|
||||||
|
void *Picture_GetPatchPixel(
|
||||||
|
patch_t *patch, pictureformat_t informat,
|
||||||
|
INT32 x, INT32 y,
|
||||||
|
pictureflags_t flags);
|
||||||
|
|
||||||
|
INT32 Picture_FormatBPP(pictureformat_t format);
|
||||||
|
boolean Picture_IsPatchFormat(pictureformat_t format);
|
||||||
|
boolean Picture_IsFlatFormat(pictureformat_t format);
|
||||||
|
|
||||||
// Structs
|
// Structs
|
||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
@ -42,7 +93,7 @@ typedef struct
|
||||||
} spriteinfo_t;
|
} spriteinfo_t;
|
||||||
|
|
||||||
// Conversions between patches / flats / textures...
|
// Conversions between patches / flats / textures...
|
||||||
boolean R_CheckIfPatch(lumpnum_t lump);
|
boolean R_CheckIfPatch(patch_t *patch, size_t size);
|
||||||
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
||||||
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
||||||
void R_PatchToFlat_16bpp(patch_t *patch, UINT16 *raw, boolean flip);
|
void R_PatchToFlat_16bpp(patch_t *patch, UINT16 *raw, boolean flip);
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "i_video.h" // rendermode
|
#include "i_video.h" // rendermode
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "r_plane.h"
|
#include "r_plane.h"
|
||||||
#include "r_portal.h"
|
#include "r_portal.h"
|
||||||
#include "p_tick.h"
|
#include "p_tick.h"
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
#include "r_plane.h"
|
#include "r_plane.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "r_portal.h"
|
#include "r_portal.h"
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@
|
||||||
<ClInclude Include="..\r_local.h" />
|
<ClInclude Include="..\r_local.h" />
|
||||||
<ClInclude Include="..\r_main.h" />
|
<ClInclude Include="..\r_main.h" />
|
||||||
<ClInclude Include="..\r_plane.h" />
|
<ClInclude Include="..\r_plane.h" />
|
||||||
<ClInclude Include="..\r_patch.h" />
|
<ClInclude Include="..\r_picformats.h" />
|
||||||
<ClInclude Include="..\r_portal.h" />
|
<ClInclude Include="..\r_portal.h" />
|
||||||
<ClInclude Include="..\r_segs.h" />
|
<ClInclude Include="..\r_segs.h" />
|
||||||
<ClInclude Include="..\r_sky.h" />
|
<ClInclude Include="..\r_sky.h" />
|
||||||
|
|
@ -443,7 +443,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\r_main.c" />
|
<ClCompile Include="..\r_main.c" />
|
||||||
<ClCompile Include="..\r_plane.c" />
|
<ClCompile Include="..\r_plane.c" />
|
||||||
<ClCompile Include="..\r_patch.c" />
|
<ClCompile Include="..\r_picformats.c" />
|
||||||
<ClCompile Include="..\r_portal.c" />
|
<ClCompile Include="..\r_portal.c" />
|
||||||
<ClCompile Include="..\r_segs.c" />
|
<ClCompile Include="..\r_segs.c" />
|
||||||
<ClCompile Include="..\r_sky.c" />
|
<ClCompile Include="..\r_sky.c" />
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@
|
||||||
<ClInclude Include="..\hardware\hw_clip.h">
|
<ClInclude Include="..\hardware\hw_clip.h">
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\r_patch.h">
|
<ClInclude Include="..\r_picformats.h">
|
||||||
<Filter>R_Rend</Filter>
|
<Filter>R_Rend</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\r_portal.h">
|
<ClInclude Include="..\r_portal.h">
|
||||||
|
|
@ -928,7 +928,7 @@
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\apng.c" />
|
<ClCompile Include="..\apng.c" />
|
||||||
<ClCompile Include="..\r_patch.c">
|
<ClCompile Include="..\r_picformats.c">
|
||||||
<Filter>R_Rend</Filter>
|
<Filter>R_Rend</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\r_portal.c">
|
<ClCompile Include="..\r_portal.c">
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\r_main.c" />
|
<ClCompile Include="..\r_main.c" />
|
||||||
<ClCompile Include="..\r_plane.c" />
|
<ClCompile Include="..\r_plane.c" />
|
||||||
<ClCompile Include="..\r_patch.c" />
|
<ClCompile Include="..\r_picformats.c" />
|
||||||
<ClCompile Include="..\r_portal.c" />
|
<ClCompile Include="..\r_portal.c" />
|
||||||
<ClCompile Include="..\r_segs.c" />
|
<ClCompile Include="..\r_segs.c" />
|
||||||
<ClCompile Include="..\r_sky.c" />
|
<ClCompile Include="..\r_sky.c" />
|
||||||
|
|
@ -456,7 +456,7 @@
|
||||||
<ClInclude Include="..\r_local.h" />
|
<ClInclude Include="..\r_local.h" />
|
||||||
<ClInclude Include="..\r_main.h" />
|
<ClInclude Include="..\r_main.h" />
|
||||||
<ClInclude Include="..\r_plane.h" />
|
<ClInclude Include="..\r_plane.h" />
|
||||||
<ClInclude Include="..\r_patch.h" />
|
<ClInclude Include="..\r_picformats.h" />
|
||||||
<ClInclude Include="..\r_portal.h" />
|
<ClInclude Include="..\r_portal.h" />
|
||||||
<ClInclude Include="..\r_segs.h" />
|
<ClInclude Include="..\r_segs.h" />
|
||||||
<ClInclude Include="..\r_sky.h" />
|
<ClInclude Include="..\r_sky.h" />
|
||||||
|
|
|
||||||
|
|
@ -472,7 +472,7 @@
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\apng.c" />
|
<ClCompile Include="..\apng.c" />
|
||||||
<ClCompile Include="..\r_patch.c">
|
<ClCompile Include="..\r_picformats.c">
|
||||||
<Filter>R_Rend</Filter>
|
<Filter>R_Rend</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\r_portal.c">
|
<ClCompile Include="..\r_portal.c">
|
||||||
|
|
@ -892,7 +892,7 @@
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\apng.h" />
|
<ClInclude Include="..\apng.h" />
|
||||||
<ClInclude Include="..\r_patch.h">
|
<ClInclude Include="..\r_picformats.h">
|
||||||
<Filter>R_Rend</Filter>
|
<Filter>R_Rend</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\r_portal.h">
|
<ClInclude Include="..\r_portal.h">
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "r_patch.h"
|
#include "r_picformats.h"
|
||||||
#include "i_system.h" // I_GetFreeMem
|
#include "i_system.h" // I_GetFreeMem
|
||||||
#include "i_video.h" // rendermode
|
#include "i_video.h" // rendermode
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue