- moved render style and border drawing code out of r_draw.cpp.

SVN r3251 (trunk)
This commit is contained in:
Christoph Oelckers 2011-07-05 20:41:53 +00:00
parent 06d280f00a
commit 5bf6398d85
18 changed files with 364 additions and 311 deletions

View file

@ -905,6 +905,7 @@ add_executable( zdoom WIN32
fragglescript/t_cmd.cpp
resources/colormaps.cpp
resources/voxels.cpp
resources/renderstyle.cpp
autozend.cpp
)

View file

@ -37,7 +37,7 @@
#include "doomdef.h"
#include "textures/textures.h"
#include "r_blend.h"
#include "resources/renderstyle.h"
#include "s_sound.h"
#include "memarena.h"

View file

@ -765,7 +765,7 @@ void D_Display ()
}
if (!automapactive || viewactive)
{
R_RefreshViewBorder ();
V_RefreshViewBorder ();
}
if (hud_althud && viewheight == SCREENHEIGHT && screenblocks > 10)

View file

@ -37,7 +37,7 @@
#include <string.h>
#include "doomtype.h"
#include "r_blend.h"
#include "resources/renderstyle.h"
#include "textures/textures.h"
class FScanner;

View file

@ -67,3 +67,5 @@ int NextSkill = -1;
int SinglePlayerClass[MAXPLAYERS];
bool ToggleFullscreen;
int BorderTopRefresh;

View file

@ -993,7 +993,7 @@ public:
if(script->completeBorder) //Fill the statusbar with the border before we draw.
{
FTexture *b = TexMan[gameinfo.border->b];
R_DrawBorder(viewwindowx, viewwindowy + viewheight + b->GetHeight(), viewwindowx + viewwidth, SCREENHEIGHT);
V_DrawBorder(viewwindowx, viewwindowy + viewheight + b->GetHeight(), viewwindowx + viewwidth, SCREENHEIGHT);
if(screenblocks == 10)
screen->FlatFill(viewwindowx, viewwindowy + viewheight, viewwindowx + viewwidth, viewwindowy + viewheight + b->GetHeight(), b, true);
}

View file

@ -1053,8 +1053,8 @@ void DBaseStatusBar::RefreshBackground () const
y = x == ST_X ? ST_Y : ::ST_Y;
x2 = !(ratio & 3) || !Scaled ? ST_X+HorizontalResolution :
SCREENWIDTH - (SCREENWIDTH*(48-BaseRatioSizes[ratio][3])+48*2-1)/(48*2);
R_DrawBorder (0, y, x, SCREENHEIGHT);
R_DrawBorder (x2, y, SCREENWIDTH, SCREENHEIGHT);
V_DrawBorder (0, y, x, SCREENHEIGHT);
V_DrawBorder (x2, y, SCREENWIDTH, SCREENHEIGHT);
if (setblocks >= 10)
{

View file

@ -80,7 +80,6 @@ EXTERN_CVAR (Bool, r_drawflat) // [RH] Don't texture segs?
// BSP?
void R_ClearClipSegs (short left, short right);
void R_ClearDrawSegs ();
void R_BuildPolyBSP(subsector_t *sub);
void R_RenderBSPNode (void *node);
// killough 4/13/98: fake floors/ceilings for deep water / fake ceilings:

View file

@ -125,65 +125,6 @@ BYTE shadetables[NUMCOLORMAPS*16*256];
FDynamicColormap ShadeFakeColormap[16];
BYTE identitymap[256];
// Convert legacy render styles to flexible render styles.
// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle
// rather than the struct before it, which goes against the standard.
#ifndef __APPLE__
FRenderStyle LegacyRenderStyles[STYLE_Count] =
{
/* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }},
/* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }},
/* STYLE_Fuzzy */ {{ STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
/* STYLE_SoulTrans */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha }},
/* STYLE_OptFuzzy */ {{ STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
/* STYLE_Stencil */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed }},
/* STYLE_Translucent */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
/* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }},
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
/* STYLE_Shadow */{{ STYLEOP_Shadow, 0, 0, 0 }},
};
#else
FRenderStyle LegacyRenderStyles[STYLE_Count];
static const BYTE Styles[STYLE_Count * 4] =
{
STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1,
STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha,
STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
STYLEOP_Shadow, 0, 0, 0
};
static struct LegacyInit
{
LegacyInit()
{
for (int i = 0; i < STYLE_Count; ++i)
{
LegacyRenderStyles[i].BlendOp = Styles[i*4];
LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1];
LegacyRenderStyles[i].DestAlpha = Styles[i*4+2];
LegacyRenderStyles[i].Flags = Styles[i*4+3];
}
}
} DoLegacyInit;
#endif
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
{
arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags;
return arc;
}
EXTERN_CVAR (Int, r_columnmethod)
/************************************/
@ -2020,29 +1961,6 @@ void tmvline4_revsubclamp ()
}
void R_DrawBorder (int x1, int y1, int x2, int y2)
{
FTextureID picnum;
if (level.info != NULL && level.info->bordertexture[0] != 0)
{
picnum = TexMan.CheckForTexture (level.info->bordertexture, FTexture::TEX_Flat);
}
else
{
picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat);
}
if (picnum.isValid())
{
screen->FlatFill (x1, y1, x2, y2, TexMan(picnum));
}
else
{
screen->Clear (x1, y1, x2, y2, 0, 0);
}
}
//==========================================================================
//
// R_GetColumn
@ -2055,91 +1973,6 @@ const BYTE *R_GetColumn (FTexture *tex, int col)
}
/*
==================
=
= R_DrawViewBorder
=
= Draws the border around the view for different size windows
==================
*/
int BorderNeedRefresh;
void V_MarkRect (int x, int y, int width, int height);
void V_DrawFrame (int x, int y, int width, int height);
void R_DrawViewBorder (void)
{
// [RH] Redraw the status bar if SCREENWIDTH > status bar width.
// Will draw borders around itself, too.
if (SCREENWIDTH > 320)
{
SB_state = screen->GetPageCount ();
}
if (viewwidth == SCREENWIDTH)
{
return;
}
R_DrawBorder (0, 0, SCREENWIDTH, viewwindowy);
R_DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
R_DrawBorder (viewwindowx + viewwidth, viewwindowy, SCREENWIDTH, viewheight + viewwindowy);
R_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, ST_Y);
V_DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
V_MarkRect (0, 0, SCREENWIDTH, ST_Y);
}
/*
==================
=
= R_DrawTopBorder
=
= Draws the top border around the view for different size windows
==================
*/
int BorderTopRefresh;
void R_DrawTopBorder ()
{
FTexture *p;
int offset;
if (viewwidth == SCREENWIDTH)
return;
offset = gameinfo.border->offset;
if (viewwindowy < 34)
{
R_DrawBorder (0, 0, viewwindowx, 34);
R_DrawBorder (viewwindowx, 0, viewwindowx + viewwidth, viewwindowy);
R_DrawBorder (viewwindowx + viewwidth, 0, SCREENWIDTH, 34);
p = TexMan(gameinfo.border->t);
screen->FlatFill(viewwindowx, viewwindowy - p->GetHeight(),
viewwindowx + viewwidth, viewwindowy, p, true);
p = TexMan(gameinfo.border->l);
screen->FlatFill(viewwindowx - p->GetWidth(), viewwindowy,
viewwindowx, 35, p, true);
p = TexMan(gameinfo.border->r);
screen->FlatFill(viewwindowx + viewwidth, viewwindowy,
viewwindowx + viewwidth + p->GetWidth(), 35, p, true);
p = TexMan(gameinfo.border->tl);
screen->DrawTexture (p, viewwindowx - offset, viewwindowy - offset, TAG_DONE);
p = TexMan(gameinfo.border->tr);
screen->DrawTexture (p, viewwindowx + viewwidth, viewwindowy - offset, TAG_DONE);
}
else
{
R_DrawBorder (0, 0, SCREENWIDTH, 34);
}
}
// [RH] Initialize the column drawer pointers
void R_InitColumnDrawers ()
{
@ -2175,8 +2008,8 @@ void R_InitColumnDrawers ()
// [RH] Choose column drawers in a single place
EXTERN_CVAR (Int, r_drawfuzz)
EXTERN_CVAR (Bool, r_drawtrans)
EXTERN_CVAR (Float, transsouls)
CVAR (Bool, r_drawtrans, true, 0)
static FDynamicColormap *basecolormapsave;
@ -2323,18 +2156,6 @@ static bool R_SetBlendFunc (int op, fixed_t fglevel, fixed_t bglevel, int flags)
}
}
static fixed_t GetAlpha(int type, fixed_t alpha)
{
switch (type)
{
case STYLEALPHA_Zero: return 0;
case STYLEALPHA_One: return FRACUNIT;
case STYLEALPHA_Src: return alpha;
case STYLEALPHA_InvSrc: return FRACUNIT - alpha;
default: return 0;
}
}
ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, DWORD color)
{
fixed_t fglevel, bglevel;
@ -2461,84 +2282,3 @@ bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)())
return false;
}
//==========================================================================
//
// FRenderStyle :: IsVisible
//
// Coupled with the given alpha, will this render style produce something
// visible on-screen?
//
//==========================================================================
bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
{
if (BlendOp == STYLEOP_None)
{
return false;
}
if (BlendOp == STYLEOP_Add || BlendOp == STYLEOP_RevSub)
{
if (Flags & STYLEF_Alpha1)
{
alpha = FRACUNIT;
}
else
{
alpha = clamp(alpha, 0, FRACUNIT);
}
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != FRACUNIT;
}
// Treat anything else as visible.
return true;
}
//==========================================================================
//
// FRenderStyle :: CheckFuzz
//
// Adjusts settings based on r_drawfuzz CVAR
//
//==========================================================================
void FRenderStyle::CheckFuzz()
{
switch (BlendOp)
{
default:
return;
case STYLEOP_FuzzOrAdd:
if (r_drawtrans && r_drawfuzz == 0)
{
BlendOp = STYLEOP_Add;
return;
}
break;
case STYLEOP_FuzzOrSub:
if (r_drawtrans && r_drawfuzz == 0)
{
BlendOp = STYLEOP_Sub;
return;
}
break;
case STYLEOP_FuzzOrRevSub:
if (r_drawtrans && r_drawfuzz == 0)
{
BlendOp = STYLEOP_RevSub;
return;
}
break;
}
if (r_drawfuzz == 2)
{
BlendOp = STYLEOP_Shadow;
}
else
{
BlendOp = STYLEOP_Fuzz;
}
}

View file

@ -251,12 +251,6 @@ extern FDynamicColormap ShadeFakeColormap[16];
extern BYTE identitymap[256];
extern BYTE *dc_translation;
// If the view size is not full screen, draws a border around it.
void R_DrawViewBorder (void);
void R_DrawTopBorder (void);
void R_DrawBorder (int x1, int y1, int x2, int y2);
// [RH] Added for muliresolution support
void R_InitFuzzTable (int fuzzoff);

View file

@ -1403,35 +1403,6 @@ void R_SetupFrame (AActor *actor)
}
}
//==========================================================================
//
// R_RefreshViewBorder
//
// Draws the border around the player view, if needed.
//
//==========================================================================
void R_RefreshViewBorder ()
{
if (setblocks < 10)
{
if (BorderNeedRefresh)
{
BorderNeedRefresh--;
if (BorderTopRefresh)
{
BorderTopRefresh--;
}
R_DrawViewBorder();
}
else if (BorderTopRefresh)
{
BorderTopRefresh--;
R_DrawTopBorder();
}
}
}
//==========================================================================
//
// R_EnterMirror

View file

@ -186,7 +186,6 @@ void R_SetViewAngle ();
// Called by G_Drawer.
void R_RenderActorView (AActor *actor, bool dontmaplines = false);
void R_RefreshViewBorder ();
void R_SetupBuffer ();
void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);

View file

@ -69,8 +69,8 @@ extern fixed_t globaluclip, globaldclip;
#define BASEYCENTER (100)
EXTERN_CVAR (Bool, st_scale)
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
EXTERN_CVAR(Bool, r_shadercolormaps)
EXTERN_CVAR(Int, r_drawfuzz)
//
// Sprite rotation 0 is facing the viewer,

View file

@ -0,0 +1,195 @@
/*
** r_data.cpp
**
**---------------------------------------------------------------------------
** Copyright 2008-2011 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
**
*/
#include "farchive.h"
#include "templates.h"
#include "renderstyle.h"
#include "c_cvars.h"
CVAR (Bool, r_drawtrans, true, 0)
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
// Convert legacy render styles to flexible render styles.
// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle
// rather than the struct before it, which goes against the standard.
#ifndef __APPLE__
FRenderStyle LegacyRenderStyles[STYLE_Count] =
{
/* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }},
/* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }},
/* STYLE_Fuzzy */ {{ STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
/* STYLE_SoulTrans */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha }},
/* STYLE_OptFuzzy */ {{ STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
/* STYLE_Stencil */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed }},
/* STYLE_Translucent */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
/* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }},
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
/* STYLE_Shadow */{{ STYLEOP_Shadow, 0, 0, 0 }},
};
#else
FRenderStyle LegacyRenderStyles[STYLE_Count];
static const BYTE Styles[STYLE_Count * 4] =
{
STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1,
STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha,
STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
STYLEOP_Shadow, 0, 0, 0
};
static struct LegacyInit
{
LegacyInit()
{
for (int i = 0; i < STYLE_Count; ++i)
{
LegacyRenderStyles[i].BlendOp = Styles[i*4];
LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1];
LegacyRenderStyles[i].DestAlpha = Styles[i*4+2];
LegacyRenderStyles[i].Flags = Styles[i*4+3];
}
}
} DoLegacyInit;
#endif
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
{
arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags;
return arc;
}
//==========================================================================
//
// FRenderStyle :: IsVisible
//
// Coupled with the given alpha, will this render style produce something
// visible on-screen?
//
//==========================================================================
bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
{
if (BlendOp == STYLEOP_None)
{
return false;
}
if (BlendOp == STYLEOP_Add || BlendOp == STYLEOP_RevSub)
{
if (Flags & STYLEF_Alpha1)
{
alpha = FRACUNIT;
}
else
{
alpha = clamp(alpha, 0, FRACUNIT);
}
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != FRACUNIT;
}
// Treat anything else as visible.
return true;
}
//==========================================================================
//
// FRenderStyle :: CheckFuzz
//
// Adjusts settings based on r_drawfuzz CVAR
//
//==========================================================================
void FRenderStyle::CheckFuzz()
{
switch (BlendOp)
{
default:
return;
case STYLEOP_FuzzOrAdd:
if (r_drawtrans && r_drawfuzz == 0)
{
BlendOp = STYLEOP_Add;
return;
}
break;
case STYLEOP_FuzzOrSub:
if (r_drawtrans && r_drawfuzz == 0)
{
BlendOp = STYLEOP_Sub;
return;
}
break;
case STYLEOP_FuzzOrRevSub:
if (r_drawtrans && r_drawfuzz == 0)
{
BlendOp = STYLEOP_RevSub;
return;
}
break;
}
if (r_drawfuzz == 2)
{
BlendOp = STYLEOP_Shadow;
}
else
{
BlendOp = STYLEOP_Fuzz;
}
}
fixed_t GetAlpha(int type, fixed_t alpha)
{
switch (type)
{
case STYLEALPHA_Zero: return 0;
case STYLEALPHA_One: return FRACUNIT;
case STYLEALPHA_Src: return alpha;
case STYLEALPHA_InvSrc: return FRACUNIT - alpha;
default: return 0;
}
}

View file

@ -148,5 +148,6 @@ inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
class FArchive;
FArchive &operator<< (FArchive &arc, FRenderStyle &style);
fixed_t GetAlpha(int type, fixed_t alpha);
#endif

View file

@ -46,6 +46,8 @@
#include "doomstat.h"
#include "v_palette.h"
#include "gi.h"
#include "g_level.h"
#include "st_stuff.h"
#include "i_system.h"
#include "i_video.h"
@ -66,6 +68,7 @@ int CleanXfac_1, CleanYfac_1, CleanWidth_1, CleanHeight_1;
// FillSimplePoly uses this
extern "C" short spanend[MAXHEIGHT];
extern int setblocks;
CVAR (Bool, hud_scale, false, CVAR_ARCHIVE);
@ -1385,3 +1388,142 @@ void V_DrawFrame (int left, int top, int width, int height)
screen->DrawTexture (TexMan[border->bl], left-offset, top+height, TAG_DONE);
screen->DrawTexture (TexMan[border->br], left+width, top+height, TAG_DONE);
}
//==========================================================================
//
//
//
//==========================================================================
void V_DrawBorder (int x1, int y1, int x2, int y2)
{
FTextureID picnum;
if (level.info != NULL && level.info->bordertexture[0] != 0)
{
picnum = TexMan.CheckForTexture (level.info->bordertexture, FTexture::TEX_Flat);
}
else
{
picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat);
}
if (picnum.isValid())
{
screen->FlatFill (x1, y1, x2, y2, TexMan(picnum));
}
else
{
screen->Clear (x1, y1, x2, y2, 0, 0);
}
}
//==========================================================================
//
// R_DrawViewBorder
//
// Draws the border around the view for different size windows
//
//==========================================================================
int BorderNeedRefresh;
static void V_DrawViewBorder (void)
{
// [RH] Redraw the status bar if SCREENWIDTH > status bar width.
// Will draw borders around itself, too.
if (SCREENWIDTH > 320)
{
SB_state = screen->GetPageCount ();
}
if (viewwidth == SCREENWIDTH)
{
return;
}
V_DrawBorder (0, 0, SCREENWIDTH, viewwindowy);
V_DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
V_DrawBorder (viewwindowx + viewwidth, viewwindowy, SCREENWIDTH, viewheight + viewwindowy);
V_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, ST_Y);
V_DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
V_MarkRect (0, 0, SCREENWIDTH, ST_Y);
}
//==========================================================================
//
// R_DrawTopBorder
//
// Draws the top border around the view for different size windows
//
//==========================================================================
static void V_DrawTopBorder ()
{
FTexture *p;
int offset;
if (viewwidth == SCREENWIDTH)
return;
offset = gameinfo.border->offset;
if (viewwindowy < 34)
{
V_DrawBorder (0, 0, viewwindowx, 34);
V_DrawBorder (viewwindowx, 0, viewwindowx + viewwidth, viewwindowy);
V_DrawBorder (viewwindowx + viewwidth, 0, SCREENWIDTH, 34);
p = TexMan(gameinfo.border->t);
screen->FlatFill(viewwindowx, viewwindowy - p->GetHeight(),
viewwindowx + viewwidth, viewwindowy, p, true);
p = TexMan(gameinfo.border->l);
screen->FlatFill(viewwindowx - p->GetWidth(), viewwindowy,
viewwindowx, 35, p, true);
p = TexMan(gameinfo.border->r);
screen->FlatFill(viewwindowx + viewwidth, viewwindowy,
viewwindowx + viewwidth + p->GetWidth(), 35, p, true);
p = TexMan(gameinfo.border->tl);
screen->DrawTexture (p, viewwindowx - offset, viewwindowy - offset, TAG_DONE);
p = TexMan(gameinfo.border->tr);
screen->DrawTexture (p, viewwindowx + viewwidth, viewwindowy - offset, TAG_DONE);
}
else
{
V_DrawBorder (0, 0, SCREENWIDTH, 34);
}
}
//==========================================================================
//
// R_RefreshViewBorder
//
// Draws the border around the player view, if needed.
//
//==========================================================================
void V_RefreshViewBorder ()
{
if (setblocks < 10)
{
if (BorderNeedRefresh)
{
BorderNeedRefresh--;
if (BorderTopRefresh)
{
BorderTopRefresh--;
}
V_DrawViewBorder();
}
else if (BorderTopRefresh)
{
BorderTopRefresh--;
V_DrawTopBorder();
}
}
}

View file

@ -38,7 +38,7 @@
#include "doomdef.h"
#include "dobject.h"
#include "r_blend.h"
#include "resources/renderstyle.h"
#include "c_cvars.h"
extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac;
@ -499,6 +499,11 @@ FString V_GetColorStringByName (const char *name);
int V_GetColor (const DWORD *palette, const char *str);
void V_DrawFrame (int left, int top, int width, int height);
// If the view size is not full screen, draws a border around it.
void V_DrawBorder (int x1, int y1, int x2, int y2);
void V_RefreshViewBorder ();
#if defined(X86_ASM) || defined(X64_ASM)
extern "C" void ASM_PatchPitch (void);
#endif

View file

@ -2371,10 +2371,6 @@
RelativePath=".\src\r_3dfloors.h"
>
</File>
<File
RelativePath=".\src\r_blend.h"
>
</File>
<File
RelativePath=".\src\r_bsp.h"
>
@ -6636,6 +6632,10 @@
RelativePath=".\src\resources\colormaps.h"
>
</File>
<File
RelativePath=".\src\resources\renderstyle.h"
>
</File>
<File
RelativePath=".\src\resources\voxels.h"
>
@ -6648,6 +6648,10 @@
RelativePath=".\src\resources\colormaps.cpp"
>
</File>
<File
RelativePath=".\src\resources\renderstyle.cpp"
>
</File>
<File
RelativePath=".\src\resources\voxels.cpp"
>