Files
SRB2Kart-Saturn/src/r_draw.h
T

203 lines
5.3 KiB
C

// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// 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_draw.h
/// \brief Low-level span/column drawer functions
#ifndef __R_DRAW__
#define __R_DRAW__
#include "r_defs.h"
#include "r_things.h"
// -------------------------------
// COMMON STUFF FOR 8bpp AND 16bpp
// -------------------------------
extern UINT8 *renderscreen;
extern INT32 linesize;
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
{
return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px);
}
// -------------------------
// COLUMN DRAWING CODE STUFF
// -------------------------
extern lighttable_t *dc_colormap;
extern INT32 dc_x, dc_yl, dc_yh;
extern fixed_t dc_iscale, dc_texturemid;
extern UINT8 dc_hires;
extern UINT8 *dc_source; // first pixel in a column
// translucency stuff here
extern UINT8 *dc_transmap;
// translation stuff here
extern UINT8 *dc_translation;
extern struct r_lightlist_s *dc_lightlist;
extern INT32 dc_numlights, dc_maxlights;
//Fix TUTIFRUTI
extern INT32 dc_texheight;
// -----------------------
// SPAN DRAWING CODE STUFF
// -----------------------
extern INT32 ds_y, ds_x1, ds_x2;
extern lighttable_t *ds_colormap;
extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern INT32 ds_waterofs, ds_bgofs;
extern UINT8 *ds_source; // start of a 64*64 tile image
extern INT32 dc_sourcelength;
extern UINT8 *ds_transmap;
extern INT32 ds_bgofs;
typedef struct {
float x, y, z;
} floatv3_t;
// Vectors for Software's tilted slope drawers
extern floatv3_t *ds_su, *ds_sv, *ds_sz;
extern floatv3_t *ds_sup, *ds_svp, *ds_szp;
extern float focallengthf, zeroheight;
// Variable flat sizes
extern UINT32 nflatxshift;
extern UINT32 nflatyshift;
extern UINT32 nflatshiftup;
extern UINT32 nflatmask;
/// \brief Top border
#define BRDR_T 0
/// \brief Bottom border
#define BRDR_B 1
/// \brief Left border
#define BRDR_L 2
/// \brief Right border
#define BRDR_R 3
/// \brief Topleft border
#define BRDR_TL 4
/// \brief Topright border
#define BRDR_TR 5
/// \brief Bottomleft border
#define BRDR_BL 6
/// \brief Bottomright border
#define BRDR_BR 7
extern lumpnum_t viewborderlump[8];
// ------------------------------------------------
// r_draw.c COMMON ROUTINES FOR BOTH 8bpp and 16bpp
// ------------------------------------------------
#define GTC_CACHE 1
#define GTC_MENUCACHE GTC_CACHE
//@TODO Add a separate caching mechanism for menu colormaps distinct from in-level GTC_CACHE. For now this is still preferable to memory leaks...
#define TC_DEFAULT -1
#define TC_BOSS -2
#define TC_METALSONIC -3 // For Metal Sonic battle
#define TC_ALLWHITE -4 // For Cy-Brak-demon
#define TC_RAINBOW -5 // For invincibility power
#define TC_BLINK -6 // For item blinking
// Initialize color translation tables, for player rendering etc.
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags);
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local);
patch_t* R_GetSkinFaceRank(player_t* ply);
patch_t* R_GetSkinFaceWant(player_t* ply);
patch_t* R_GetSkinFaceMini(player_t* ply);
void R_FlushTranslationColormapCache(void);
UINT8 R_GetColorByName(const char *name);
extern UINT8 *transtables; // translucency tables, should be (*transtables)[5][256][256]
enum
{
blendtab_add,
blendtab_subtract,
blendtab_reversesubtract,
blendtab_modulate,
NUMBLENDMAPS
};
extern UINT8 *blendtables[NUMBLENDMAPS];
void R_InitTranslucencyTables(void);
void R_GenerateBlendTables(void);
UINT8 *R_GetTranslucencyTable(INT32 alphalevel);
UINT8 *R_GetBlendTable(int style, INT32 alphalevel);
boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel);
// Custom player skin translation
void R_InitViewBuffer(INT32 width, INT32 height);
void R_InitViewBorder(void);
void R_VideoErase(size_t ofs, INT32 count);
// Rendering function.
#if 0
void R_FillBackScreen(void);
// If the view size is not full screen, draws a border around it.
void R_DrawViewBorder(void);
#endif
#define TRANSPARENTPIXEL 247
// -----------------
// DRAWING CODE
// -----------------
// column drawers
void R_DrawColumn(void);
#define R_DrawWallColumn R_DrawColumn
void R_DrawShadeColumn(void);
void R_DrawColumnShadowed(void);
void R_DrawTranslucentColumn(void);
void R_DrawTranslatedColumn(void);
void R_DrawTranslatedTranslucentColumn(void);
void R_Draw2sMultiPatchColumn(void);
void R_Draw2sMultiPatchTranslucentColumn(void);
void R_DrawFogColumn(void);
// span drawers
void R_DrawSpan(void);
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
void R_DrawTiltedSpan(void);
void R_DrawTiltedTranslucentSpan(void);
void R_DrawTiltedTranslucentWaterSpan(void);
void R_DrawTranslucentSpan(void);
void R_DrawTranslucentWaterSpan(void);
void R_DrawFogSpan(void);
void R_DrawTiltedSplat(void);
void R_DrawSplat(void);
void R_DrawTranslucentSplat(void);
// =========================================================================
#endif // __R_DRAW__