#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 |
A plane is a grouped layer of screen items.
|
static |
Initialises static Plane members.
|
inline |
Clips the screen rect of this plane to fit within the given screen rect.
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)
.
void Sci::Plane::update | ( | const reg_t | object | ) |
Updates the plane to match the state of the plane object from the VM.
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.
|
inline |
The default plane is the first plane generated inside the graphics engine.
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.
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.
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.
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.
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.
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.
drawList | The draw list for this plane. |
eraseList | The erase list for this plane. |
higherEraseList | The erase list for a plane above this plane. |
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.
drawList | The draw list for this plane. |
eraseList | The erase list for a plane below this plane. |
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.
drawList | The draw list for this plane. |
lowerDrawList | The draw list for a plane below this plane. |
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.
void Sci::Plane::remapMarkRedraw | ( | ) |
Marks all non-deleted remapped screen items within the plane as needing to be updated during the next frameout.
PlaneType Sci::Plane::_type |
The type of the plane.
byte Sci::Plane::_back |
The color to use when erasing the plane. Only applies to planes of type kPlaneTypeColored.
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.
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.
int16 Sci::Plane::_priority |
The rendering priority of the plane. Higher priorities are drawn above lower priorities.
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
.
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 itselfupdated
is set when the plane is updated from another plane and the two planes' planeRect
s do not matchdeleted
is set when the plane is deleted by a kernel callmoved
is set when the plane has been moved or resized 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.
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.
Common::Rect Sci::Plane::_gameRect |
The position & dimensions of the plane in game script coordinates.
Common::Rect Sci::Plane::_screenRect |
The position & dimensions of the plane in screen coordinates. This rect is clipped to the screen.
ScreenItemList Sci::Plane::_screenItemList |
The list of screen items grouped within this plane.