2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2019-12-06 18:49:42 +00:00
|
|
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00: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 v_video.h
|
|
|
|
/// \brief Gamma correction LUT
|
|
|
|
|
|
|
|
#ifndef __V_VIDEO__
|
|
|
|
#define __V_VIDEO__
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomtype.h"
|
|
|
|
#include "r_defs.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// VIDEO
|
|
|
|
//
|
|
|
|
|
|
|
|
// Screen 0 is the screen updated by I_Update screen.
|
|
|
|
// Screen 1 is an extra buffer.
|
|
|
|
|
|
|
|
extern UINT8 *screens[5];
|
|
|
|
|
2017-04-19 21:24:28 +00:00
|
|
|
extern consvar_t cv_ticrate, cv_constextsize,\
|
|
|
|
cv_globalgamma, cv_globalsaturation, \
|
|
|
|
cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,\
|
|
|
|
cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma, \
|
2019-01-07 20:43:58 +00:00
|
|
|
cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation,\
|
|
|
|
cv_allcaps;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Allocates buffer screens, call before R_Init.
|
|
|
|
void V_Init(void);
|
|
|
|
|
|
|
|
// Set the current RGB palette lookup to use for palettized graphics
|
|
|
|
void V_SetPalette(INT32 palettenum);
|
|
|
|
|
|
|
|
void V_SetPaletteLump(const char *pal);
|
|
|
|
|
|
|
|
const char *R_GetPalname(UINT16 num);
|
|
|
|
const char *GetPalette(void);
|
|
|
|
|
|
|
|
extern RGBA_t *pLocalPalette;
|
2017-04-29 15:40:07 +00:00
|
|
|
extern RGBA_t *pMasterPalette;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Retrieve the ARGB value from a palette color index
|
|
|
|
#define V_GetColor(color) (pLocalPalette[color&0xFF])
|
|
|
|
|
|
|
|
// Bottom 8 bits are used for parameter (screen or character)
|
|
|
|
#define V_PARAMMASK 0x000000FF
|
|
|
|
|
|
|
|
// flags hacked in scrn (not supported by all functions (see src))
|
|
|
|
// patch scaling uses bits 9 and 10
|
2014-03-21 18:42:55 +00:00
|
|
|
#define V_SCALEPATCHSHIFT 8
|
2014-03-15 16:59:03 +00:00
|
|
|
#define V_SCALEPATCHMASK 0x00000300
|
|
|
|
#define V_NOSCALEPATCH 0x00000100
|
|
|
|
#define V_SMALLSCALEPATCH 0x00000200
|
|
|
|
#define V_MEDSCALEPATCH 0x00000300
|
|
|
|
|
|
|
|
// string spacing uses bits 11 and 12
|
|
|
|
#define V_SPACINGMASK 0x00000C00
|
|
|
|
#define V_6WIDTHSPACE 0x00000400 // early 2.1 style spacing, variable widths, 6 character space
|
|
|
|
#define V_OLDSPACING 0x00000800 // Old style spacing, 8 per character 4 per space
|
|
|
|
#define V_MONOSPACE 0x00000C00 // Don't do width checks on characters, all characters 8 width
|
|
|
|
|
|
|
|
// use bits 13-16 for colors
|
|
|
|
// though we only have 7 colors now, perhaps we can introduce
|
|
|
|
// more as needed later
|
|
|
|
#define V_CHARCOLORSHIFT 12
|
|
|
|
#define V_CHARCOLORMASK 0x0000F000
|
|
|
|
// for simplicity's sake, shortcuts to specific colors
|
2018-03-02 13:32:55 +00:00
|
|
|
#define V_MAGENTAMAP 0x00001000
|
2014-03-15 16:59:03 +00:00
|
|
|
#define V_YELLOWMAP 0x00002000
|
|
|
|
#define V_GREENMAP 0x00003000
|
|
|
|
#define V_BLUEMAP 0x00004000
|
|
|
|
#define V_REDMAP 0x00005000
|
|
|
|
#define V_GRAYMAP 0x00006000
|
|
|
|
#define V_ORANGEMAP 0x00007000
|
2018-03-02 13:32:55 +00:00
|
|
|
#define V_SKYMAP 0x00008000
|
|
|
|
#define V_PURPLEMAP 0x00009000
|
|
|
|
#define V_AQUAMAP 0x0000A000
|
|
|
|
#define V_PERIDOTMAP 0x0000B000
|
|
|
|
#define V_AZUREMAP 0x0000C000
|
|
|
|
#define V_BROWNMAP 0x0000D000
|
|
|
|
#define V_ROSYMAP 0x0000E000
|
|
|
|
#define V_INVERTMAP 0x0000F000
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// use bits 17-20 for alpha transparency
|
|
|
|
#define V_ALPHASHIFT 16
|
|
|
|
#define V_ALPHAMASK 0x000F0000
|
|
|
|
// define specific translucencies
|
|
|
|
#define V_10TRANS 0x00010000
|
|
|
|
#define V_20TRANS 0x00020000
|
|
|
|
#define V_30TRANS 0x00030000
|
|
|
|
#define V_40TRANS 0x00040000
|
2014-03-21 18:42:55 +00:00
|
|
|
#define V_TRANSLUCENT 0x00050000 // TRANS50
|
2014-03-15 16:59:03 +00:00
|
|
|
#define V_60TRANS 0x00060000
|
|
|
|
#define V_70TRANS 0x00070000
|
2014-03-21 18:42:55 +00:00
|
|
|
#define V_80TRANS 0x00080000 // used to be V_8020TRANS
|
2014-03-15 16:59:03 +00:00
|
|
|
#define V_90TRANS 0x00090000
|
2014-03-21 18:42:55 +00:00
|
|
|
#define V_HUDTRANSHALF 0x000D0000
|
|
|
|
#define V_HUDTRANS 0x000E0000 // draw the hud translucent
|
|
|
|
#define V_HUDTRANSDOUBLE 0x000F0000
|
2019-11-23 21:41:28 +00:00
|
|
|
// Macros follow
|
|
|
|
#define V_USERHUDTRANSHALF ((10-(cv_translucenthud.value/2))<<V_ALPHASHIFT)
|
|
|
|
#define V_USERHUDTRANS ((10-cv_translucenthud.value)<<V_ALPHASHIFT)
|
|
|
|
#define V_USERHUDTRANSDOUBLE ((10-min(cv_translucenthud.value*2, 10))<<V_ALPHASHIFT)
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#define V_AUTOFADEOUT 0x00100000 // used by CECHOs, automatic fade out when almost over
|
|
|
|
#define V_RETURN8 0x00200000 // 8 pixel return instead of 12
|
|
|
|
#define V_OFFSET 0x00400000 // account for offsets in patches
|
|
|
|
#define V_ALLOWLOWERCASE 0x00800000 // (strings only) allow fonts that have lowercase letters to use them
|
|
|
|
#define V_FLIP 0x00800000 // (patches only) Horizontal flip
|
2019-10-14 05:24:44 +00:00
|
|
|
#define V_CENTERNAMETAG 0x00800000 // (nametag only) center nametag lines
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#define V_SNAPTOTOP 0x01000000 // for centering
|
|
|
|
#define V_SNAPTOBOTTOM 0x02000000 // for centering
|
|
|
|
#define V_SNAPTOLEFT 0x04000000 // for centering
|
|
|
|
#define V_SNAPTORIGHT 0x08000000 // for centering
|
|
|
|
|
|
|
|
#define V_WRAPX 0x10000000 // Don't clamp texture on X (for HW mode)
|
|
|
|
#define V_WRAPY 0x20000000 // Don't clamp texture on Y (for HW mode)
|
|
|
|
|
2018-01-21 12:56:38 +00:00
|
|
|
#define V_NOSCALESTART 0x40000000 // don't scale x, y, start coords
|
|
|
|
#define V_PERPLAYER 0x80000000 // automatically adjust coordinates/scaling for splitscreen mode
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
// defines for old functions
|
|
|
|
#define V_DrawPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, s|V_NOSCALESTART|V_NOSCALEPATCH, p, NULL)
|
|
|
|
#define V_DrawTranslucentMappedPatch(x,y,s,p,c) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, s, p, c)
|
|
|
|
#define V_DrawSmallTranslucentMappedPatch(x,y,s,p,c) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, s, p, c)
|
|
|
|
#define V_DrawTinyTranslucentMappedPatch(x,y,s,p,c) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, s, p, c)
|
|
|
|
#define V_DrawMappedPatch(x,y,s,p,c) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, s, p, c)
|
|
|
|
#define V_DrawSmallMappedPatch(x,y,s,p,c) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, s, p, c)
|
|
|
|
#define V_DrawTinyMappedPatch(x,y,s,p,c) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, s, p, c)
|
2019-12-04 15:43:33 +00:00
|
|
|
#define V_DrawScaledPatch(x,y,s,p) V_DrawFixedPatch((x)*FRACUNIT, (y)<<FRACBITS, FRACUNIT, s, p, NULL)
|
2014-03-21 18:42:55 +00:00
|
|
|
#define V_DrawSmallScaledPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, s, p, NULL)
|
|
|
|
#define V_DrawTinyScaledPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, s, p, NULL)
|
|
|
|
#define V_DrawTranslucentPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, s, p, NULL)
|
|
|
|
#define V_DrawSmallTranslucentPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, s, p, NULL)
|
|
|
|
#define V_DrawTinyTranslucentPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, s, p, NULL)
|
|
|
|
#define V_DrawSciencePatch(x,y,s,p,sc) V_DrawFixedPatch(x,y,sc,s,p,NULL)
|
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
|
|
|
#define V_DrawFixedPatch(x,y,sc,s,p,c) V_DrawStretchyFixedPatch(x,y,sc,sc,s,p,c)
|
|
|
|
void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap);
|
2014-03-21 18:42:55 +00:00
|
|
|
void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t *patch, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor);
|
|
|
|
|
|
|
|
// Draw a linear block of pixels into the view buffer.
|
|
|
|
void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const UINT8 *src);
|
|
|
|
|
|
|
|
// draw a pic_t, SCALED
|
|
|
|
void V_DrawScaledPic (INT32 px1, INT32 py1, INT32 scrn, INT32 lumpnum);
|
|
|
|
|
|
|
|
// fill a box with a single color
|
|
|
|
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
2018-07-31 09:10:02 +00:00
|
|
|
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
2014-03-15 16:59:03 +00:00
|
|
|
// fill a box with a flat as a pattern
|
|
|
|
void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum);
|
|
|
|
|
|
|
|
// fade down the screen buffer before drawing the menu over
|
2018-02-12 17:47:31 +00:00
|
|
|
void V_DrawFadeScreen(UINT16 color, UINT8 strength);
|
A good and bad ending cutscene now exist.
Also:
* SPR2_XTRA - instead of defining lumpnames in S_SKIN, those kinds of assets can just be bundled into the spriteset. Required for ending cutscene stuff, I guess, but also done for HUD life icon and character select image (aside from Sonic&Tails, still SOC'd in).
* Minor oversights in SPR2 support corrected.
* Better evaluation, featuring ending assets.
* Intro has warping-in blackrock, reusing ending assets.
* Cutscene text now supports lowercase (intro and custom).
* Disable the asset-fucking "gamma correction" I put in over two years ago when implementing colour cube. (This is the only thing I could move into another branch if you MUST, but it's basically invisble in the diff so w/e.)
* Don't blank the screen if the top left pixel of a screen-covering patch is transparent. (Checked via nonzero topdelta for first column)
Bugs:
* OPENGL ONLY: The first ~20 frames of both endings are fucked. A little help here? Might be HWR_DrawFadeFill's fault, which I just created. OR it could be in f_finale, but I doubt it, since it doesn't appear in Software.
2019-07-27 23:32:57 +00:00
|
|
|
// available to lua over my dead body, which will probably happen in this heat
|
|
|
|
void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, UINT8 strength);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2016-11-02 21:26:35 +00:00
|
|
|
void V_DrawFadeConsBack(INT32 plines);
|
2018-11-10 03:38:55 +00:00
|
|
|
void V_DrawPromptBack(INT32 boxheight, INT32 color);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// draw a single character
|
|
|
|
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
2018-07-31 09:10:02 +00:00
|
|
|
// draw a single character, but for the chat
|
|
|
|
void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-12-16 02:44:39 +00:00
|
|
|
UINT8 *V_GetStringColormap(INT32 colorflags);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);
|
|
|
|
|
|
|
|
// wordwrap a string using the hu_font
|
|
|
|
char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
|
2018-12-17 19:43:59 +00:00
|
|
|
UINT8 *V_GetStringColormap(INT32 colorflags);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// draw a string using the hu_font
|
|
|
|
void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string);
|
|
|
|
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string);
|
|
|
|
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string);
|
|
|
|
|
2014-08-04 03:49:33 +00:00
|
|
|
// draw a string using the hu_font, 0.5x scale
|
2014-03-15 16:59:03 +00:00
|
|
|
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
2014-08-04 03:49:33 +00:00
|
|
|
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2014-08-04 03:49:33 +00:00
|
|
|
// draw a string using the tny_font
|
2014-03-15 16:59:03 +00:00
|
|
|
void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
|
|
|
void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
|
|
|
|
|
|
|
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
|
|
|
|
|
|
|
// Draw tall nums, used for menu, HUD, intermission
|
|
|
|
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
|
|
|
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);
|
2018-02-22 21:49:36 +00:00
|
|
|
void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Find string width from lt_font chars
|
|
|
|
INT32 V_LevelNameWidth(const char *string);
|
|
|
|
INT32 V_LevelNameHeight(const char *string);
|
2018-02-22 21:49:36 +00:00
|
|
|
INT32 V_LevelActNumWidth(INT32 num); // act number width
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
|
2019-10-14 05:24:44 +00:00
|
|
|
INT32 V_CreditStringWidth(const char *string);
|
2019-10-09 04:28:01 +00:00
|
|
|
|
2019-10-10 05:56:48 +00:00
|
|
|
// Draw a string using the nt_font
|
2019-10-14 05:24:44 +00:00
|
|
|
void V_DrawNameTag(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string);
|
|
|
|
INT32 V_CountNameTagLines(const char *string);
|
|
|
|
INT32 V_NameTagWidth(const char *string);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Find string width from hu_font chars
|
|
|
|
INT32 V_StringWidth(const char *string, INT32 option);
|
2014-08-04 03:49:33 +00:00
|
|
|
// Find string width from hu_font chars, 0.5x scale
|
|
|
|
INT32 V_SmallStringWidth(const char *string, INT32 option);
|
2014-03-15 16:59:03 +00:00
|
|
|
// Find string width from tny_font chars
|
|
|
|
INT32 V_ThinStringWidth(const char *string, INT32 option);
|
|
|
|
|
|
|
|
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
|
|
|
|
|
|
|
void V_DrawPatchFill(patch_t *pat);
|
|
|
|
|
|
|
|
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
|
|
|
size_t destrowbytes);
|
|
|
|
|
|
|
|
#endif
|