ScummVM API documentation
Scumm::VirtScreen Struct Reference

#include <gfx.h>

Inheritance diagram for Scumm::VirtScreen:
Graphics::Surface

Public Member Functions

void clear ()
 
void setDirtyRange (int top, int bottom)
 
byte * getPixels (int x, int y) const
 
byte * getBackPixels (int x, int y) const
 
- Public Member Functions inherited from Graphics::Surface
 Surface ()
 
const void * getPixels () const
 
void * getPixels ()
 
void setPixels (void *newPixels)
 
const void * getBasePtr (int x, int y) const
 
void * getBasePtr (int x, int y)
 
uint32 getPixel (int x, int y) const
 
void setPixel (int x, int y, int pixel)
 
void create (int16 width, int16 height, const PixelFormat &format)
 
void free ()
 
void init (int16 width, int16 height, int16 pitch, void *pixels, const PixelFormat &format)
 
void copyFrom (const Surface &surf)
 
void convertFrom (const Surface &surf, const PixelFormat &format)
 
Surface getSubArea (const Common::Rect &area)
 
const Surface getSubArea (const Common::Rect &area) const
 
bool clip (Common::Rect &srcBounds, Common::Rect &destBounds) const
 
void copyRectToSurface (const void *buffer, int srcPitch, int destX, int destY, int width, int height)
 
void copyRectToSurface (const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect)
 
void copyRectToSurfaceWithKey (const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
 
void copyRectToSurfaceWithKey (const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key)
 
void convertToInPlace (const PixelFormat &dstFormat)
 
void convertToInPlace (const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
 
Graphics::SurfaceconvertTo (const PixelFormat &dstFormat, const byte *srcPalette=0, int srcPaletteCount=256, const byte *dstPalette=0, int dstPaletteCount=0, DitherMethod method=kDitherFloyd) const
 
void drawLine (int x0, int y0, int x1, int y1, uint32 color)
 
void drawThickLine (int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
 
void hLine (int x, int y, int x2, uint32 color)
 
void vLine (int x, int y, int y2, uint32 color)
 
void fillRect (Common::Rect r, uint32 color)
 
void frameRect (const Common::Rect &r, uint32 color)
 
void move (int dx, int dy, int height)
 
void flipVertical (const Common::Rect &r)
 
void flipHorizontal (const Common::Rect &r)
 
bool applyColorKey (uint8 rKey, uint8 gKey, uint8 bKey, bool overwriteAlpha=false)
 
bool applyColorKey (uint8 rKey, uint8 gKey, uint8 bKey, bool overwriteAlpha, uint8 rNew, uint8 gNew, uint8 bNew)
 
bool setAlpha (uint8 alpha, bool skipTransparent=false)
 
Graphics::Surfacescale (int16 newWidth, int16 newHeight, bool filtering=false) const
 
Graphics::Surfacerotoscale (const TransformStruct &transform, bool filtering=false) const
 Rotoscale function; this returns a transformed version of this surface after rotation and scaling. Please do not use this if angle == 0, use plain old scaling function. More...
 
void debugPrint (int debuglevel=0, int width=0, int height=0, int x=0, int y=0, int scale=-1, int maxwidth=160, const byte *palette=NULL) const
 

Public Attributes

VirtScreenNumber number
 
uint16 topline
 
uint16 xstart
 
bool hasTwoBuffers
 
byte * backBuf
 
uint16 tdirty [80+1]
 
uint16 bdirty [80+1]
 
- Public Attributes inherited from Graphics::Surface
int16 w
 
int16 h
 
int32 pitch
 
PixelFormat format
 

Additional Inherited Members

- Protected Member Functions inherited from Graphics::Surface
void ditherFloyd (const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method, const PixelFormat &dstFormat) const
 
- Protected Attributes inherited from Graphics::Surface
void * pixels
 

Detailed Description

In all Scumm games, one to four virtual screen (or 'windows') together make up the content of the actual screen. Thinking of virtual screens as fixed size, fixed location windows might help understanding them. Typical, in all scumm games there is either one single virtual screen covering the entire real screen (mostly in all newer games, e.g. Sam & Max, and all V7+ games). The classic setup consists of three virtual screens: one at the top of the screen, where all conversation texts are printed; then the main one (which I like calling 'the stage', since all the actors are doing their stuff there), and finally the lower part of the real screen is taken up by the verb area. Finally, in V5 games and some V6 games, it's almost the same as in the original games, except that there is no separate conversation area.

Each of these virtual screens has a fixed number or id (see also VirtScreenNumber).

Member Function Documentation

◆ setDirtyRange()

void Scumm::VirtScreen::setDirtyRange ( int  top,
int  bottom 
)
inline

Convenience method to set the whole tdirty and bdirty arrays to one specific value each. This is mostly used to mark every as dirty in a single step, like so: vs->setDirtyRange(0, vs->height); or to mark everything as clean, like so: vs->setDirtyRange(0, 0);

Member Data Documentation

◆ number

VirtScreenNumber Scumm::VirtScreen::number

The unique id of this screen (corresponds to its position in the ScummEngine:_virtscr array).

◆ topline

uint16 Scumm::VirtScreen::topline

Vertical position of the virtual screen. Tells how much the virtual screen is shifted along the y axis relative to the real screen.

◆ xstart

uint16 Scumm::VirtScreen::xstart

Horizontal scroll offset, tells how far the screen is scrolled to the right. Only used for the main screen. After all, verbs and the conversation text box don't have to scroll.

◆ hasTwoBuffers

bool Scumm::VirtScreen::hasTwoBuffers

Flag indicating whether this screen has a back buffer or not. This is yet another feature which is only used by the main screen. Strictly spoken one could remove this variable and replace checks on it with checks on backBuf. But since some code needs to temporarily disable the backBuf (so it can abuse drawBitmap; see drawVerbBitmap() and useIm01Cursor()), we keep it (at least for now).

◆ backBuf

byte* Scumm::VirtScreen::backBuf

Pointer to the screen's back buffer, if it has one (see also the hasTwoBuffers member). The backBuf is used by drawBitmap to store the background graphics of the active room. This eases redrawing: whenever a portion of the screen has to be redrawn, first a copy from the backBuf content to screenPtr is performed. Then, any objects/actors in that area are redrawn atop that.

◆ tdirty

uint16 Scumm::VirtScreen::tdirty[80+1]

Array containing for each visible strip of this virtual screen the coordinate at which the dirty region of that strip starts. 't' stands for 'top' - the top coordinate of the dirty region. This together with bdirty is used to do efficient redrawing of the screen.

◆ bdirty

uint16 Scumm::VirtScreen::bdirty[80+1]

Array containing for each visible strip of this virtual screen the coordinate at which the dirty region of that strip end. 'b' stands for 'bottom' - the bottom coordinate of the dirty region. This together with tdirty is used to do efficient redrawing of the screen.


The documentation for this struct was generated from the following file: