ScummVM API documentation
Sci::Plane Class Reference

#include <plane32.h>

Public Member Functions

 Plane (const Common::Rect &gameRect, PlanePictureCodes pictureId=kPlanePicColored)
 
 Plane (const reg_t object)
 
 Plane (const Plane &other)
 
void operator= (const Plane &other)
 
bool operator< (const Plane &other) const
 
void clipScreenRect (const Common::Rect &screenRect)
 
void printDebugInfo (Console *con) const
 
void sync (const Plane *other, const Common::Rect &screenRect)
 
void update (const reg_t object)
 
void scrollScreenItems (const int16 deltaX, const int16 deltaY, const bool scrollPics)
 
bool isDefaultPlane ()
 
GuiResourceId addPic (const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX, const bool deleteDuplicate=true)
 
void changePic ()
 
void deletePic (const GuiResourceId oldPictureId, const GuiResourceId newPictureId)
 
void calcLists (Plane &visiblePlane, const PlaneList &planeList, DrawList &drawList, RectList &eraseList)
 
void decrementScreenItemArrayCounts (Plane *visiblePlane, const bool forceUpdate)
 
void filterDownEraseRects (DrawList &drawList, RectList &eraseList, RectList &higherEraseList) const
 
void filterUpEraseRects (DrawList &drawList, const RectList &lowerEraseList) const
 
void filterUpDrawRects (DrawList &drawList, const DrawList &lowerDrawList) const
 
void redrawAll (Plane *visiblePlane, const PlaneList &planeList, DrawList &drawList, RectList &eraseList)
 
void remapMarkRedraw ()
 

Static Public Member Functions

static void init ()
 

Public Attributes

PlaneType _type
 
byte _back
 
int _priorityChanged
 
reg_t _object
 
int16 _priority
 
int _redrawAllCount
 
int _created
 
int _updated
 
int _deleted
 
int _moved
 
Common::Point _vanishingPoint
 
Common::Rect _planeRect
 
Common::Rect _gameRect
 
Common::Rect _screenRect
 
ScreenItemList _screenItemList
 

Detailed Description

A plane is a grouped layer of screen items.

Member Function Documentation

◆ init()

static void Sci::Plane::init ( )
static

Initialises static Plane members.

◆ clipScreenRect()

void Sci::Plane::clipScreenRect ( const Common::Rect screenRect)
inline

Clips the screen rect of this plane to fit within the given screen rect.

◆ sync()

void Sci::Plane::sync ( const Plane other,
const Common::Rect screenRect 
)

Compares the properties of the current plane against the properties of the other plane (which is the corresponding plane from the visible plane list) to discover which properties have been changed on this plane by a call to update(reg_t).

Note
This method was called UpdatePlane in SSCI.

◆ update()

void Sci::Plane::update ( const reg_t  object)

Updates the plane to match the state of the plane object from the VM.

Note
This method was called UpdatePlane in SSCI.

◆ scrollScreenItems()

void Sci::Plane::scrollScreenItems ( const int16  deltaX,
const int16  deltaY,
const bool  scrollPics 
)

Modifies the position of all non-pic screen items by the given delta. If scrollPics is true, pic items are also repositioned.

◆ isDefaultPlane()

bool Sci::Plane::isDefaultPlane ( )
inline

The default plane is the first plane generated inside the graphics engine.

◆ addPic()

GuiResourceId Sci::Plane::addPic ( const GuiResourceId  pictureId,
const Common::Point position,
const bool  mirrorX,
const bool  deleteDuplicate = true 
)

Marks all existing screen items matching the current picture to be deleted, then adds all cels from the new picture resource to the plane at the given position.

◆ changePic()

void Sci::Plane::changePic ( )

If the plane is a picture plane, re-adds all cels from its picture resource to the plane. Otherwise, just clears the _pictureChanged flag.

◆ deletePic()

void Sci::Plane::deletePic ( const GuiResourceId  oldPictureId,
const GuiResourceId  newPictureId 
)

Marks all screen items to be deleted that are within this plane and match the given picture ID, then sets the picture ID of the plane to the new picture ID without adding any screen items.

◆ calcLists()

void Sci::Plane::calcLists ( Plane visiblePlane,
const PlaneList planeList,
DrawList drawList,
RectList eraseList 
)

Calculates the location and dimensions of dirty rects of the screen items in this plane and adds them to the given draw and erase lists, and synchronises this plane's list of screen items to the given visible plane.

◆ decrementScreenItemArrayCounts()

void Sci::Plane::decrementScreenItemArrayCounts ( Plane visiblePlane,
const bool  forceUpdate 
)

Synchronises changes to screen items from the current plane to the visible plane and deletes screen items from the current plane that have been marked as deleted. If forceUpdate is true, all screen items on the visible plane will be updated, even if they are not marked as having changed.

◆ filterDownEraseRects()

void Sci::Plane::filterDownEraseRects ( DrawList drawList,
RectList eraseList,
RectList higherEraseList 
) const

This method is called from the highest priority plane to the lowest priority plane.

Adds screen items from this plane to the draw list that must be redrawn because they intersect entries in the higherEraseList.

If this plane is opaque, all intersecting erase rects in lowerEraseList are removed, as they would be completely overwritten by the contents of this plane.

If this plane is transparent, erase rects from the lowerEraseList are added to the erase list for this plane, so that lower planes.

Parameters
drawListThe draw list for this plane.
eraseListThe erase list for this plane.
higherEraseListThe erase list for a plane above this plane.

◆ filterUpEraseRects()

void Sci::Plane::filterUpEraseRects ( DrawList drawList,
const RectList lowerEraseList 
) const

This method is called from the lowest priority plane to the highest priority plane.

Adds screen items from this plane to the draw list that must be drawn because the lower plane is being redrawn and potentially transparent screen items from this plane would draw over the lower priority plane's screen items.

This method applies only to transparent planes.

Parameters
drawListThe draw list for this plane.
eraseListThe erase list for a plane below this plane.

◆ filterUpDrawRects()

void Sci::Plane::filterUpDrawRects ( DrawList drawList,
const DrawList lowerDrawList 
) const

This method is called from the lowest priority plane to the highest priority plane.

Adds screen items from this plane to the draw list that must be drawn because the lower plane is being redrawn and potentially transparent screen items from this plane would draw over the lower priority plane's screen items.

This method applies only to transparent planes.

Parameters
drawListThe draw list for this plane.
lowerDrawListThe draw list for a plane below this plane.

◆ redrawAll()

void Sci::Plane::redrawAll ( Plane visiblePlane,
const PlaneList planeList,
DrawList drawList,
RectList eraseList 
)

Updates all of the plane's non-deleted screen items and adds them to the given draw and erase lists.

◆ remapMarkRedraw()

void Sci::Plane::remapMarkRedraw ( )

Marks all non-deleted remapped screen items within the plane as needing to be updated during the next frameout.

Member Data Documentation

◆ _type

PlaneType Sci::Plane::_type

The type of the plane.

◆ _back

byte Sci::Plane::_back

The color to use when erasing the plane. Only applies to planes of type kPlaneTypeColored.

◆ _priorityChanged

int Sci::Plane::_priorityChanged

Whether the priority of this plane has changed. This flag is set when the plane is updated from another plane and cleared when draw list calculation occurs.

◆ _object

reg_t Sci::Plane::_object

A handle to the VM object corresponding to this plane. Some planes are generated purely within the graphics engine and have a numeric object value.

◆ _priority

int16 Sci::Plane::_priority

The rendering priority of the plane. Higher priorities are drawn above lower priorities.

◆ _redrawAllCount

int Sci::Plane::_redrawAllCount

Whether or not all screen items in this plane should be redrawn on the next frameout, instead of just the screen items marked as updated. This is set when visual changes to the plane itself are made that affect the rendering of the entire plane, and cleared once those changes are rendered by redrawAll.

◆ _created

int Sci::Plane::_created

Flags indicating the state of the plane.

  • created is set when the plane is first created, either from a VM object or from within the engine itself
  • updated is set when the plane is updated from another plane and the two planes' planeRects do not match
  • deleted is set when the plane is deleted by a kernel call
  • moved is set when the plane has been moved or resized

◆ _vanishingPoint

Common::Point Sci::Plane::_vanishingPoint

The vanishing point for the plane. Used when automatically calculating the correct scaling of the plane's screen items according to their position.

◆ _planeRect

Common::Rect Sci::Plane::_planeRect

The position & dimensions of the plane in screen coordinates. This rect is not clipped to the screen, so may include coordinates that are offscreen.

◆ _gameRect

Common::Rect Sci::Plane::_gameRect

The position & dimensions of the plane in game script coordinates.

◆ _screenRect

Common::Rect Sci::Plane::_screenRect

The position & dimensions of the plane in screen coordinates. This rect is clipped to the screen.

◆ _screenItemList

ScreenItemList Sci::Plane::_screenItemList

The list of screen items grouped within this plane.


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