2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** v_video.h
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2006-06-11 01:37:00 +00:00
|
|
|
** Copyright 1998-2006 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** 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.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __V_VIDEO_H__
|
|
|
|
#define __V_VIDEO_H__
|
|
|
|
|
|
|
|
#include "doomtype.h"
|
|
|
|
#include "m_bbox.h"
|
|
|
|
|
|
|
|
#include "v_palette.h"
|
|
|
|
#include "v_font.h"
|
|
|
|
#include "colormatcher.h"
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
|
|
|
|
// Needed because we are refering to patches.
|
|
|
|
#include "r_data.h"
|
|
|
|
|
|
|
|
extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac;
|
|
|
|
extern int DisplayWidth, DisplayHeight, DisplayBits;
|
|
|
|
|
|
|
|
class FTexture;
|
|
|
|
|
|
|
|
// TagItem definitions for DrawTexture. As far as I know, tag lists
|
|
|
|
// originated on the Amiga.
|
|
|
|
//
|
|
|
|
// Think of TagItems as an array of the following structure:
|
|
|
|
//
|
|
|
|
// struct TagItem {
|
|
|
|
// DWORD ti_Tag;
|
|
|
|
// DWORD ti_Data;
|
|
|
|
// };
|
|
|
|
|
2006-05-24 15:31:21 +00:00
|
|
|
#define TAG_DONE (0) /* Used to indicate the end of the Tag list */
|
|
|
|
#define TAG_END (0) /* Ditto */
|
|
|
|
#define TAG_IGNORE (1) /* Ignore this Tag */
|
|
|
|
#define TAG_MORE (2) /* Ends this list and continues with the */
|
2006-02-24 04:48:15 +00:00
|
|
|
/* list pointed to in ti_Data */
|
|
|
|
|
2006-12-21 04:34:43 +00:00
|
|
|
#define TAG_USER ((DWORD)(1u<<30))
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
DTA_Base = TAG_USER + 5000,
|
|
|
|
DTA_DestWidth, // width of area to draw to
|
|
|
|
DTA_DestHeight, // height of area to draw to
|
|
|
|
DTA_Alpha, // alpha value for translucency
|
|
|
|
DTA_FillColor, // color to stencil onto the destination
|
2007-12-23 14:13:29 +00:00
|
|
|
DTA_Font, // For characters: Font it belongs to
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_Translation, // translation table to recolor the source
|
2007-12-23 14:13:29 +00:00
|
|
|
DTA_TranslationPtr, // translation table to recolor the source
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
|
|
|
|
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
|
|
|
|
DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen
|
|
|
|
DTA_CleanNoMove, // bool: like DTA_Clean but does not reposition output position
|
2007-12-20 04:36:43 +00:00
|
|
|
DTA_FlipX, // bool: flip image horizontally //FIXME: Does not work with DTA_Window(Left|Right)
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_ShadowColor, // color of shadow
|
|
|
|
DTA_ShadowAlpha, // alpha of shadow
|
|
|
|
DTA_Shadow, // set shadow color and alphas to defaults
|
|
|
|
DTA_VirtualWidth, // pretend the canvas is this wide
|
|
|
|
DTA_VirtualHeight, // pretend the canvas is this tall
|
|
|
|
DTA_TopOffset, // override texture's top offset
|
|
|
|
DTA_LeftOffset, // override texture's left offset
|
|
|
|
DTA_CenterOffset, // override texture's left and top offsets and set them for the texture's middle
|
|
|
|
DTA_CenterBottomOffset,// override texture's left and top offsets and set them for the texture's bottom middle
|
|
|
|
DTA_WindowLeft, // don't draw anything left of this column (on source, not dest)
|
|
|
|
DTA_WindowRight, // don't draw anything at or to the right of this column (on source, not dest)
|
|
|
|
DTA_ClipTop, // don't draw anything above this row (on dest, not source)
|
|
|
|
DTA_ClipBottom, // don't draw anything at or below this row (on dest, not source)
|
|
|
|
DTA_ClipLeft, // don't draw anything to the left of this column (on dest, not source)
|
|
|
|
DTA_ClipRight, // don't draw anything at or to the right of this column (on dest, not source)
|
|
|
|
DTA_Masked, // true(default)=use masks from texture, false=ignore masks
|
|
|
|
DTA_HUDRules, // use fullscreen HUD rules to position and size textures
|
|
|
|
DTA_KeepRatio, // doesn't adjust screen size for DTA_Virtual* if the aspect ratio is not 4:3
|
2006-10-20 04:04:04 +00:00
|
|
|
DTA_RenderStyle, // same as render style for actors
|
2007-12-09 03:40:02 +00:00
|
|
|
|
|
|
|
// For DrawText calls:
|
2007-12-20 04:36:43 +00:00
|
|
|
DTA_TextLen, // stop after this many characters, even if \0 not hit
|
2007-12-09 03:40:02 +00:00
|
|
|
DTA_CellX, // horizontal size of character cell
|
|
|
|
DTA_CellY, // vertical size of character cell
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
HUD_Normal,
|
|
|
|
HUD_HorizCenter
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// VIDEO
|
|
|
|
//
|
|
|
|
// [RH] Made screens more implementation-independant:
|
|
|
|
// This layer isn't really necessary, and it would be nice to remove it, I think.
|
|
|
|
// But ZDoom is now built around it so much, I'll probably just leave it.
|
|
|
|
//
|
|
|
|
class DCanvas : public DObject
|
|
|
|
{
|
|
|
|
DECLARE_ABSTRACT_CLASS (DCanvas, DObject)
|
|
|
|
public:
|
|
|
|
FFont *Font;
|
|
|
|
|
|
|
|
DCanvas (int width, int height);
|
|
|
|
virtual ~DCanvas ();
|
|
|
|
|
|
|
|
// Member variable access
|
|
|
|
inline BYTE *GetBuffer () const { return Buffer; }
|
|
|
|
inline int GetWidth () const { return Width; }
|
|
|
|
inline int GetHeight () const { return Height; }
|
|
|
|
inline int GetPitch () const { return Pitch; }
|
|
|
|
|
|
|
|
virtual bool IsValid ();
|
|
|
|
|
|
|
|
// Access control
|
|
|
|
virtual bool Lock () = 0; // Returns true if the surface was lost since last time
|
|
|
|
virtual void Unlock () = 0;
|
|
|
|
virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked
|
|
|
|
|
|
|
|
// Copy blocks from one canvas to another
|
2007-12-20 14:05:08 +00:00
|
|
|
virtual void Blit (int destx, int desty, int destwidth, int destheight, DCanvas *src, int srcx, int srcy, int srcwidth, int srcheight);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Draw a linear block of pixels into the canvas
|
2006-09-14 00:02:31 +00:00
|
|
|
virtual void DrawBlock (int x, int y, int width, int height, const BYTE *src) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Reads a linear block of pixels into the view buffer.
|
2006-09-14 00:02:31 +00:00
|
|
|
virtual void GetBlock (int x, int y, int width, int height, BYTE *dest) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Dim the entire canvas for the menus
|
2006-05-09 00:28:01 +00:00
|
|
|
virtual void Dim (PalEntry color = 0) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Dim part of the canvas
|
|
|
|
virtual void Dim (PalEntry color, float amount, int x1, int y1, int w, int h) const;
|
|
|
|
|
|
|
|
// Fill an area with a texture
|
2006-04-11 16:27:41 +00:00
|
|
|
virtual void FlatFill (int left, int top, int right, int bottom, FTexture *src);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Set an area to a specified color
|
2007-12-22 04:52:51 +00:00
|
|
|
virtual void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-23 21:56:46 +00:00
|
|
|
// renders the player backdrop for the menu
|
|
|
|
virtual void DrawPlayerBackdrop (DCanvas *src, const BYTE *FireRemap, int x, int y);
|
|
|
|
|
2007-12-24 14:24:24 +00:00
|
|
|
// draws a line
|
|
|
|
virtual void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor);
|
|
|
|
|
|
|
|
// draws a single pixel
|
|
|
|
virtual void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Calculate gamma table
|
|
|
|
void CalcGamma (float gamma, BYTE gammalookup[256]);
|
|
|
|
|
2007-12-24 21:56:49 +00:00
|
|
|
// Can be overridden so that the colormaps for sector color/fade won't be built.
|
|
|
|
virtual bool UsesColormap() const;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Text drawing functions -----------------------------------------------
|
|
|
|
|
|
|
|
virtual void SetFont (FFont *font);
|
|
|
|
|
|
|
|
// 2D Texture drawing
|
2007-12-22 04:00:25 +00:00
|
|
|
void STACK_ARGS DrawTexture (FTexture *img, int x, int y, int tags, ...);
|
2006-02-24 04:48:15 +00:00
|
|
|
void FillBorder (FTexture *img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
|
|
|
|
|
|
|
|
// 2D Text drawing
|
|
|
|
void STACK_ARGS DrawText (int normalcolor, int x, int y, const char *string, ...);
|
|
|
|
void STACK_ARGS DrawChar (int normalcolor, int x, int y, BYTE character, ...);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BYTE *Buffer;
|
|
|
|
int Width;
|
|
|
|
int Height;
|
|
|
|
int Pitch;
|
|
|
|
int LockCount;
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
struct DrawParms
|
|
|
|
{
|
|
|
|
fixed_t x, y;
|
|
|
|
int texwidth;
|
|
|
|
int texheight;
|
|
|
|
int windowleft;
|
|
|
|
int windowright;
|
|
|
|
int dclip;
|
|
|
|
int uclip;
|
|
|
|
int lclip;
|
|
|
|
int rclip;
|
|
|
|
fixed_t destwidth;
|
|
|
|
fixed_t destheight;
|
|
|
|
int top;
|
|
|
|
int left;
|
|
|
|
fixed_t alpha;
|
|
|
|
int fillcolor;
|
2007-12-23 14:13:29 +00:00
|
|
|
FFont *font;
|
|
|
|
int translation;
|
2007-12-20 04:36:43 +00:00
|
|
|
INTBOOL alphaChannel;
|
|
|
|
INTBOOL flipX;
|
|
|
|
fixed_t shadowAlpha;
|
|
|
|
int shadowColor;
|
|
|
|
int virtWidth;
|
|
|
|
int virtHeight;
|
|
|
|
INTBOOL keepratio;
|
|
|
|
INTBOOL masked;
|
|
|
|
ERenderStyle style;
|
|
|
|
};
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
|
2007-12-20 14:05:08 +00:00
|
|
|
virtual void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags);
|
2007-12-20 04:36:43 +00:00
|
|
|
bool ParseDrawTextureTags (FTexture *img, int x, int y, uint32 tag, va_list tags, DrawParms *parms) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
DCanvas() {}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
private:
|
|
|
|
// Keep track of canvases, for automatic destruction at exit
|
|
|
|
DCanvas *Next;
|
|
|
|
static DCanvas *CanvasChain;
|
2007-12-24 14:24:24 +00:00
|
|
|
|
|
|
|
void PUTTRANSDOT (int xx, int yy, int basecolor, int level);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// A canvas in system memory.
|
|
|
|
|
|
|
|
class DSimpleCanvas : public DCanvas
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DSimpleCanvas, DCanvas)
|
|
|
|
public:
|
|
|
|
DSimpleCanvas (int width, int height);
|
|
|
|
~DSimpleCanvas ();
|
|
|
|
|
|
|
|
bool IsValid ();
|
|
|
|
bool Lock ();
|
|
|
|
void Unlock ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BYTE *MemBuffer;
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
DSimpleCanvas() {}
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// A canvas that represents the actual display. The video code is responsible
|
|
|
|
// for actually implementing this. Built on top of SimpleCanvas, because it
|
|
|
|
// needs a system memory buffer when buffered output is enabled.
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
class FNativeTexture;
|
2006-02-24 04:48:15 +00:00
|
|
|
class DFrameBuffer : public DSimpleCanvas
|
|
|
|
{
|
|
|
|
DECLARE_ABSTRACT_CLASS (DFrameBuffer, DSimpleCanvas)
|
|
|
|
public:
|
|
|
|
DFrameBuffer (int width, int height);
|
|
|
|
|
|
|
|
// Force the surface to use buffered output if true is passed.
|
|
|
|
virtual bool Lock (bool buffered) = 0;
|
|
|
|
|
|
|
|
// Make the surface visible. Also implies Unlock().
|
|
|
|
virtual void Update () = 0;
|
|
|
|
|
|
|
|
// Return a pointer to 256 palette entries that can be written to.
|
|
|
|
virtual PalEntry *GetPalette () = 0;
|
|
|
|
|
|
|
|
// Stores the palette with flash blended in into 256 dwords
|
|
|
|
virtual void GetFlashedPalette (PalEntry palette[256]) = 0;
|
|
|
|
|
|
|
|
// Mark the palette as changed. It will be updated on the next Update().
|
|
|
|
virtual void UpdatePalette () = 0;
|
|
|
|
|
|
|
|
// Sets the gamma level. Returns false if the hardware does not support
|
|
|
|
// gamma changing. (Always true for now, since palettes can always be
|
|
|
|
// gamma adjusted.)
|
|
|
|
virtual bool SetGamma (float gamma) = 0;
|
|
|
|
|
|
|
|
// Sets a color flash. RGB is the color, and amount is 0-256, with 256
|
|
|
|
// being all flash and 0 being no flash. Returns false if the hardware
|
|
|
|
// does not support this. (Always true for now, since palettes can always
|
|
|
|
// be flashed.)
|
|
|
|
virtual bool SetFlash (PalEntry rgb, int amount) = 0;
|
|
|
|
|
|
|
|
// Converse of SetFlash
|
|
|
|
virtual void GetFlash (PalEntry &rgb, int &amount) = 0;
|
|
|
|
|
|
|
|
// Returns the number of video pages the frame buffer is using.
|
|
|
|
virtual int GetPageCount () = 0;
|
|
|
|
|
|
|
|
// Returns true if running fullscreen.
|
|
|
|
virtual bool IsFullscreen () = 0;
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
// Changes the vsync setting, if supported by the device.
|
|
|
|
virtual void SetVSync (bool vsync);
|
|
|
|
|
2007-12-18 01:50:08 +00:00
|
|
|
// Set the rect defining the area effected by blending.
|
2007-12-20 04:36:43 +00:00
|
|
|
virtual void SetBlendingRect (int x1, int y1, int x2, int y2);
|
|
|
|
|
|
|
|
bool IsComposited; // If true, the following functions can be used.
|
|
|
|
|
|
|
|
// Begin 2D drawing operations. This is like Update, but it doesn't end
|
|
|
|
// the scene, and it doesn't present the image yet.
|
|
|
|
virtual void Begin2D();
|
|
|
|
|
2007-12-22 04:00:25 +00:00
|
|
|
// DrawTexture calls after Begin2D use native textures.
|
2007-12-20 04:36:43 +00:00
|
|
|
|
|
|
|
// Create a native texture from a game texture.
|
|
|
|
virtual FNativeTexture *CreateTexture(FTexture *gametex);
|
|
|
|
|
|
|
|
// Create a palette texture from a 256-entry palette.
|
|
|
|
virtual FNativeTexture *CreatePalette(const PalEntry *pal);
|
2007-12-18 01:50:08 +00:00
|
|
|
|
2007-12-20 18:53:35 +00:00
|
|
|
// texture copy functions
|
|
|
|
virtual void CopyPixelDataRGB(BYTE * buffer, int texwidth, int texheight, int originx, int originy,
|
|
|
|
const BYTE * patch, int pix_width, int pix_height, int step_x, int step_y,
|
|
|
|
int ct);
|
|
|
|
|
|
|
|
virtual void CopyPixelData(BYTE * buffer, int texwidth, int texheight, int originx, int originy,
|
|
|
|
const BYTE * patch, int pix_width, int pix_height,
|
|
|
|
int step_x, int step_y, PalEntry * palette);
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
virtual void PaletteChanged () = 0;
|
|
|
|
virtual int QueryNewPalette () = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void DrawRateStuff ();
|
|
|
|
void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest);
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
DFrameBuffer () {}
|
|
|
|
|
2007-12-20 18:53:35 +00:00
|
|
|
bool ClipCopyPixelRect(int texwidth, int texheight, int &originx, int &originy,
|
|
|
|
const BYTE *&patch, int &srcwidth, int &srcheight, int step_x, int step_y);
|
|
|
|
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
int RateX;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
private:
|
|
|
|
DWORD LastMS, LastSec, FrameCount, LastCount, LastTic;
|
|
|
|
};
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
// This class represents a native texture, as opposed to an FTexture.
|
|
|
|
class FNativeTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~FNativeTexture();
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
extern FColorMatcher ColorMatcher;
|
|
|
|
|
|
|
|
// This is the screen updated by I_FinishUpdate.
|
|
|
|
extern DFrameBuffer *screen;
|
|
|
|
|
|
|
|
#define SCREENWIDTH (screen->GetWidth ())
|
|
|
|
#define SCREENHEIGHT (screen->GetHeight ())
|
|
|
|
#define SCREENPITCH (screen->GetPitch ())
|
|
|
|
|
|
|
|
EXTERN_CVAR (Float, Gamma)
|
|
|
|
|
|
|
|
// Translucency tables
|
|
|
|
extern "C" DWORD Col2RGB8[65][256];
|
2006-09-14 00:02:31 +00:00
|
|
|
extern "C" BYTE RGB32k[32][32][32];
|
2006-02-24 04:48:15 +00:00
|
|
|
extern "C" DWORD *Col2RGB8_LessPrecision[65];
|
|
|
|
|
|
|
|
// Allocates buffer screens, call before R_Init.
|
|
|
|
void V_Init ();
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
// Initializes graphics mode for the first time.
|
|
|
|
void V_Init2 ();
|
|
|
|
|
2006-05-12 03:14:40 +00:00
|
|
|
void V_Shutdown ();
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void V_MarkRect (int x, int y, int width, int height);
|
|
|
|
|
|
|
|
// Returns the closest color to the one desired. String
|
|
|
|
// should be of the form "rr gg bb".
|
|
|
|
int V_GetColorFromString (const DWORD *palette, const char *colorstring);
|
|
|
|
// Scans through the X11R6RGB lump for a matching color
|
|
|
|
// and returns a color string suitable for V_GetColorFromString.
|
2006-08-30 02:38:39 +00:00
|
|
|
FString V_GetColorStringByName (const char *name);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Tries to get color by name, then by string
|
|
|
|
int V_GetColor (const DWORD *palette, const char *str);
|
|
|
|
|
|
|
|
bool V_SetResolution (int width, int height, int bpp);
|
|
|
|
|
|
|
|
#ifdef USEASM
|
|
|
|
extern "C" void ASM_PatchPitch (void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int CheckRatio (int width, int height);
|
|
|
|
extern const int BaseRatioSizes[5][4];
|
|
|
|
|
2007-12-20 18:53:35 +00:00
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// True color conversion classes for the different pixel formats
|
|
|
|
// used by the supported texture formats
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
struct cRGB
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[2]; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return 255; }
|
|
|
|
static int Gray(const unsigned char * p) { return (p[0]*77 + p[1]*143 + p[2]*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cRGBA
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[2]; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return p[3]; }
|
|
|
|
static int Gray(const unsigned char * p) { return (p[0]*77 + p[1]*143 + p[2]*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cIA
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return p[1]; }
|
|
|
|
static int Gray(const unsigned char * p) { return p[0]; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cCMYK
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[3] - (((256-p[0])*p[3]) >> 8); }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[3] - (((256-p[1])*p[3]) >> 8); }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[3] - (((256-p[2])*p[3]) >> 8); }
|
|
|
|
static unsigned char A(const unsigned char * p) { return 255; }
|
|
|
|
static int Gray(const unsigned char * p) { return (R(p)*77 + G(p)*143 + B(p)*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cBGR
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[2]; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return 255; }
|
|
|
|
static int Gray(const unsigned char * p) { return (p[2]*77 + p[1]*143 + p[0]*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cBGRA
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[2]; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[0]; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return p[3]; }
|
|
|
|
static int Gray(const unsigned char * p) { return (p[2]*77 + p[1]*143 + p[0]*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cI16
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return p[1]; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return 255; }
|
|
|
|
static int Gray(const unsigned char * p) { return p[1]; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cRGB555
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return (((*(WORD*)p)&0x1f)<<3); }
|
|
|
|
static unsigned char G(const unsigned char * p) { return (((*(WORD*)p)&0x3e0)>>2); }
|
|
|
|
static unsigned char B(const unsigned char * p) { return (((*(WORD*)p)&0x7c00)>>7); }
|
|
|
|
static unsigned char A(const unsigned char * p) { return p[1]; }
|
|
|
|
static int Gray(const unsigned char * p) { return (R(p)*77 + G(p)*143 + B(p)*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cPalEntry
|
|
|
|
{
|
|
|
|
static unsigned char R(const unsigned char * p) { return ((PalEntry*)p)->r; }
|
|
|
|
static unsigned char G(const unsigned char * p) { return ((PalEntry*)p)->g; }
|
|
|
|
static unsigned char B(const unsigned char * p) { return ((PalEntry*)p)->b; }
|
|
|
|
static unsigned char A(const unsigned char * p) { return ((PalEntry*)p)->a; }
|
|
|
|
static int Gray(const unsigned char * p) { return (R(p)*77 + G(p)*143 + B(p)*36)>>8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ColorType
|
|
|
|
{
|
|
|
|
CF_RGB,
|
|
|
|
CF_RGBA,
|
|
|
|
CF_IA,
|
|
|
|
CF_CMYK,
|
|
|
|
CF_BGR,
|
|
|
|
CF_BGRA,
|
|
|
|
CF_I16,
|
|
|
|
CF_RGB555,
|
|
|
|
CF_PalEntry
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif // __V_VIDEO_H__
|