mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
- Some work on kLocalToGlobal and kGlobalToLocal for SCI2+
- Removed the custom types MemoryHandle, LoopNo, CelNo (cause we ended up having code like LoopNo loopNo = ...) - Improved the sanity checks in frameOut() svn-id: r47087
This commit is contained in:
parent
9a99226d31
commit
254850aa23
@ -205,12 +205,6 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
|
||||
reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
|
||||
#ifdef ENABLE_SCI32
|
||||
// SCI32 has an extra argument for a plane here
|
||||
if (argc > 1)
|
||||
warning("kGlobalToLocal Plane: %04x:%04x", PRINT_REG(argv[1]));
|
||||
#endif
|
||||
|
||||
reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars
|
||||
SegManager *segMan = s->_segMan;
|
||||
|
||||
@ -218,7 +212,12 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
|
||||
int16 x = GET_SEL32V(segMan, obj, x);
|
||||
int16 y = GET_SEL32V(segMan, obj, y);
|
||||
|
||||
s->_gui->globalToLocal(&x, &y);
|
||||
#ifdef ENABLE_SCI32
|
||||
if (argc > 1)
|
||||
s->_gui->globalToLocal(&x, &y, argv[1]);
|
||||
else
|
||||
#endif
|
||||
s->_gui->globalToLocal(&x, &y);
|
||||
|
||||
PUT_SEL32V(segMan, obj, x, x);
|
||||
PUT_SEL32V(segMan, obj, y, y);
|
||||
@ -229,12 +228,6 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
|
||||
reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
|
||||
#ifdef ENABLE_SCI32
|
||||
// SCI32 has an extra argument for a plane here
|
||||
if (argc > 1)
|
||||
warning("kLocalToGlobal Plane: %04x:%04x", PRINT_REG(argv[1]));
|
||||
#endif
|
||||
|
||||
reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars
|
||||
SegManager *segMan = s->_segMan;
|
||||
|
||||
@ -242,6 +235,11 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
|
||||
int16 x = GET_SEL32V(segMan, obj, x);
|
||||
int16 y = GET_SEL32V(segMan, obj, y);
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
if (argc > 1)
|
||||
s->_gui->localToGlobal(&x, &y, argv[1]);
|
||||
else
|
||||
#endif
|
||||
s->_gui->localToGlobal(&x, &y);
|
||||
|
||||
PUT_SEL32V(segMan, obj, x, x);
|
||||
|
@ -705,8 +705,8 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
|
||||
int16 mode, maxChars, cursorPos, upperPos, listCount, i;
|
||||
int16 upperOffset, cursorOffset;
|
||||
GuiResourceId viewId;
|
||||
LoopNo loopNo;
|
||||
CelNo celNo;
|
||||
int16 loopNo;
|
||||
int16 celNo;
|
||||
reg_t listSeeker;
|
||||
Common::String *listStrings = NULL;
|
||||
const char **listEntries = NULL;
|
||||
@ -842,8 +842,8 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
|
||||
GuiResourceId viewId;
|
||||
LoopNo loopNo;
|
||||
CelNo celNo;
|
||||
int16 loopNo;
|
||||
int16 celNo;
|
||||
int16 leftPos, topPos, priority, control;
|
||||
|
||||
switch (argc) {
|
||||
@ -909,8 +909,8 @@ reg_t kSetPort(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) {
|
||||
GuiResourceId viewId = argv[0].toSint16();
|
||||
LoopNo loopNo = argv[1].toSint16();
|
||||
CelNo celNo = argv[2].toSint16();
|
||||
int16 loopNo = argv[1].toSint16();
|
||||
int16 celNo = argv[2].toSint16();
|
||||
uint16 x = argv[3].toUint16();
|
||||
uint16 y = argv[4].toUint16();
|
||||
int16 priority = (argc > 5) ? argv[5].toSint16() : -1;
|
||||
|
@ -553,7 +553,7 @@ void SciGuiAnimate::addToPicDrawCels() {
|
||||
}
|
||||
}
|
||||
|
||||
void SciGuiAnimate::addToPicDrawView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
|
||||
void SciGuiAnimate::addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
|
||||
View *view = _gfx->getView(viewId);
|
||||
Common::Rect celRect;
|
||||
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
void restoreAndDelete(int argc, reg_t *argv);
|
||||
void reAnimate(Common::Rect rect);
|
||||
void addToPicDrawCels();
|
||||
void addToPicDrawView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
|
||||
void addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
@ -265,8 +265,8 @@ void Gfx::BitsShow(const Common::Rect &rect) {
|
||||
_screen->copyRectToScreen(workerRect);
|
||||
}
|
||||
|
||||
MemoryHandle Gfx::BitsSave(const Common::Rect &rect, byte screenMask) {
|
||||
MemoryHandle memoryId;
|
||||
reg_t Gfx::BitsSave(const Common::Rect &rect, byte screenMask) {
|
||||
reg_t memoryId;
|
||||
byte *memoryPtr;
|
||||
int size;
|
||||
|
||||
@ -286,7 +286,7 @@ MemoryHandle Gfx::BitsSave(const Common::Rect &rect, byte screenMask) {
|
||||
return memoryId;
|
||||
}
|
||||
|
||||
void Gfx::BitsGetRect(MemoryHandle memoryHandle, Common::Rect *destRect) {
|
||||
void Gfx::BitsGetRect(reg_t memoryHandle, Common::Rect *destRect) {
|
||||
byte *memoryPtr = NULL;
|
||||
|
||||
if (!memoryHandle.isNull()) {
|
||||
@ -298,7 +298,7 @@ void Gfx::BitsGetRect(MemoryHandle memoryHandle, Common::Rect *destRect) {
|
||||
}
|
||||
}
|
||||
|
||||
void Gfx::BitsRestore(MemoryHandle memoryHandle) {
|
||||
void Gfx::BitsRestore(reg_t memoryHandle) {
|
||||
byte *memoryPtr = NULL;
|
||||
|
||||
if (!memoryHandle.isNull()) {
|
||||
@ -311,7 +311,7 @@ void Gfx::BitsRestore(MemoryHandle memoryHandle) {
|
||||
}
|
||||
}
|
||||
|
||||
void Gfx::BitsFree(MemoryHandle memoryHandle) {
|
||||
void Gfx::BitsFree(reg_t memoryHandle) {
|
||||
if (!memoryHandle.isNull()) {
|
||||
kfree(_segMan, memoryHandle);
|
||||
}
|
||||
@ -329,7 +329,7 @@ void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredF
|
||||
}
|
||||
|
||||
// This one is the only one that updates screen!
|
||||
void Gfx::drawCelAndShow(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void Gfx::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
View *view = getView(viewId);
|
||||
Common::Rect rect;
|
||||
|
||||
@ -352,12 +352,12 @@ void Gfx::drawCelAndShow(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint1
|
||||
}
|
||||
|
||||
// This version of drawCel is not supposed to call BitsShow()!
|
||||
void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void Gfx::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo, origHeight, scaleX, scaleY);
|
||||
}
|
||||
|
||||
// This version of drawCel is not supposed to call BitsShow()!
|
||||
void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
Common::Rect clipRect = celRect;
|
||||
clipRect.clip(_curPort->rect);
|
||||
if (clipRect.isEmpty()) // nothing to draw
|
||||
@ -497,8 +497,8 @@ void Gfx::SetNowSeen(reg_t objectReference) {
|
||||
View *view = NULL;
|
||||
Common::Rect celRect(0, 0);
|
||||
GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, view);
|
||||
LoopNo loopNo = sign_extend_byte((LoopNo)GET_SEL32V(_segMan, objectReference, loop));
|
||||
CelNo celNo = sign_extend_byte((CelNo)GET_SEL32V(_segMan, objectReference, cel));
|
||||
int16 loopNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, loop));
|
||||
int16 celNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, cel));
|
||||
int16 x = (int16)GET_SEL32V(_segMan, objectReference, x);
|
||||
int16 y = (int16)GET_SEL32V(_segMan, objectReference, y);
|
||||
int16 z = 0;
|
||||
|
@ -78,15 +78,15 @@ public:
|
||||
void OffsetLine(Common::Point &start, Common::Point &end);
|
||||
|
||||
void BitsShow(const Common::Rect &r);
|
||||
MemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags);
|
||||
void BitsGetRect(MemoryHandle memoryHandle, Common::Rect *destRect);
|
||||
void BitsRestore(MemoryHandle memoryHandle);
|
||||
void BitsFree(MemoryHandle memoryHandle);
|
||||
reg_t BitsSave(const Common::Rect &rect, byte screenFlags);
|
||||
void BitsGetRect(reg_t memoryHandle, Common::Rect *destRect);
|
||||
void BitsRestore(reg_t memoryHandle);
|
||||
void BitsFree(reg_t memoryHandle);
|
||||
|
||||
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
|
||||
void drawCelAndShow(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
|
||||
uint16 onControl(uint16 screenMask, Common::Rect rect);
|
||||
|
||||
|
@ -145,6 +145,20 @@ void SciGui::localToGlobal(int16 *x, int16 *y) {
|
||||
*y = *y + curPort->top;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
|
||||
void SciGui::globalToLocal(int16 *x, int16 *y, reg_t planeObj) {
|
||||
*x = *x - GET_SEL32V(_s->_segMan, planeObj, left);
|
||||
*y = *y - GET_SEL32V(_s->_segMan, planeObj, top);
|
||||
}
|
||||
|
||||
void SciGui::localToGlobal(int16 *x, int16 *y, reg_t planeObj) {
|
||||
*x = *x + GET_SEL32V(_s->_segMan, planeObj, left);
|
||||
*y = *y + GET_SEL32V(_s->_segMan, planeObj, top);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int16 SciGui::coordinateToPriority(int16 y) {
|
||||
return _gfx->CoordinateToPriority(y);
|
||||
}
|
||||
@ -351,7 +365,7 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animat
|
||||
_gfx->SetPort(oldPort);
|
||||
}
|
||||
|
||||
void SciGui::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) {
|
||||
void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) {
|
||||
_gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, origHeight);
|
||||
_palette->setOnScreen();
|
||||
}
|
||||
@ -422,7 +436,7 @@ void SciGui::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text,
|
||||
_gfx->BitsShow(rect);
|
||||
}
|
||||
|
||||
void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 style, bool hilite) {
|
||||
void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 style, bool hilite) {
|
||||
if (!hilite) {
|
||||
_gfx->drawCelAndShow(viewId, loopNo, celNo, rect.left, rect.top, 255, 0);
|
||||
if (style & 0x20) {
|
||||
@ -674,7 +688,7 @@ void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) {
|
||||
addToPicSetPicNotValid();
|
||||
}
|
||||
|
||||
void SciGui::addToPicView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
|
||||
void SciGui::addToPicView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
|
||||
_gfx->SetPort((Port *)_windowMgr->_picWind);
|
||||
_animate->addToPicDrawView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
|
||||
addToPicSetPicNotValid();
|
||||
@ -725,8 +739,8 @@ void SciGui::baseSetter(reg_t object) {
|
||||
int16 z = (_s->_kernel->_selectorCache.z > -1) ? GET_SEL32V(_s->_segMan, object, z) : 0;
|
||||
int16 yStep = GET_SEL32V(_s->_segMan, object, yStep);
|
||||
GuiResourceId viewId = GET_SEL32V(_s->_segMan, object, view);
|
||||
LoopNo loopNo = GET_SEL32V(_s->_segMan, object, loop);
|
||||
CelNo celNo = GET_SEL32V(_s->_segMan, object, cel);
|
||||
int16 loopNo = GET_SEL32V(_s->_segMan, object, loop);
|
||||
int16 celNo = GET_SEL32V(_s->_segMan, object, cel);
|
||||
|
||||
View *tmpView = _gfx->getView(viewId);
|
||||
Common::Rect celRect;
|
||||
@ -888,16 +902,13 @@ void SciGui::frameOut() {
|
||||
// Apparently, sometimes they're not, therefore I'm adding some sanity checks here so that
|
||||
// the hack underneath does not try and draw cels outside the screen coordinates
|
||||
if (leftPos >= _screen->getWidth()) {
|
||||
warning("kAddScreenItem: invalid left position (%d), resetting to 0", leftPos);
|
||||
leftPos = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (topPos >= _screen->getHeight()) {
|
||||
warning("kAddScreenItem: invalid top position (%d), resetting to 0", topPos);
|
||||
topPos = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// HACK: just draw the view on screen
|
||||
if (viewId != 0xffff)
|
||||
drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, 0);
|
||||
}
|
||||
|
@ -88,11 +88,11 @@ public:
|
||||
virtual reg_t menuSelect(reg_t eventObject);
|
||||
|
||||
virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo);
|
||||
virtual void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight = -1);
|
||||
virtual void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight = -1);
|
||||
virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite);
|
||||
virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite);
|
||||
virtual void drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite);
|
||||
virtual void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 style, bool hilite);
|
||||
virtual void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 style, bool hilite);
|
||||
virtual void drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite);
|
||||
virtual void editControl(reg_t controlObject, reg_t eventObject);
|
||||
|
||||
@ -124,7 +124,7 @@ public:
|
||||
virtual void animateShowPic();
|
||||
virtual void animate(reg_t listReference, bool cycle, int argc, reg_t *argv);
|
||||
virtual void addToPicList(reg_t listReference, int argc, reg_t *argv);
|
||||
virtual void addToPicView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
|
||||
virtual void addToPicView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
|
||||
virtual void setNowSeen(reg_t objectReference);
|
||||
virtual bool canBeHere(reg_t curObject, reg_t listReference);
|
||||
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
|
||||
@ -157,6 +157,8 @@ public:
|
||||
virtual void updatePlane(reg_t object);
|
||||
virtual void deletePlane(reg_t object);
|
||||
virtual void frameOut();
|
||||
virtual void globalToLocal(int16 *x, int16 *y, reg_t planeObj);
|
||||
virtual void localToGlobal(int16 *x, int16 *y, reg_t planeObj);
|
||||
#endif
|
||||
|
||||
virtual bool debugUndither(bool flag);
|
||||
|
@ -36,9 +36,6 @@ namespace Sci {
|
||||
#define SCI_SHAKE_DIRECTION_HORIZONTAL 2
|
||||
|
||||
typedef int GuiResourceId; // is a resource-number and -1 means no parameter given
|
||||
typedef reg_t MemoryHandle;
|
||||
typedef int16 LoopNo;
|
||||
typedef int16 CelNo;
|
||||
|
||||
typedef int16 TextAlignment;
|
||||
|
||||
@ -80,15 +77,15 @@ struct Window : public Port {
|
||||
struct AnimateEntry {
|
||||
reg_t object;
|
||||
GuiResourceId viewId;
|
||||
LoopNo loopNo;
|
||||
CelNo celNo;
|
||||
int16 loopNo;
|
||||
int16 celNo;
|
||||
int16 paletteNo;
|
||||
int16 x, y, z;
|
||||
int16 priority;
|
||||
uint16 signal;
|
||||
Common::Rect celRect;
|
||||
bool showBitsFlag;
|
||||
MemoryHandle castHandle;
|
||||
reg_t castHandle;
|
||||
};
|
||||
typedef Common::List<AnimateEntry *> AnimateList;
|
||||
|
||||
|
@ -113,8 +113,8 @@ private:
|
||||
uint16 _curItemId;
|
||||
|
||||
Port *_oldPort;
|
||||
MemoryHandle _barSaveHandle;
|
||||
MemoryHandle _menuSaveHandle;
|
||||
reg_t _barSaveHandle;
|
||||
reg_t _menuSaveHandle;
|
||||
Common::Rect _menuRect;
|
||||
};
|
||||
|
||||
|
@ -233,30 +233,30 @@ GuiResourceId View::getResourceId() {
|
||||
return _resourceId;
|
||||
}
|
||||
|
||||
int16 View::getWidth(LoopNo loopNo, CelNo celNo) {
|
||||
int16 View::getWidth(int16 loopNo, int16 celNo) {
|
||||
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
|
||||
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
|
||||
return _loopCount ? _loop[loopNo].cel[celNo].width : 0;
|
||||
}
|
||||
|
||||
int16 View::getHeight(LoopNo loopNo, CelNo celNo) {
|
||||
int16 View::getHeight(int16 loopNo, int16 celNo) {
|
||||
loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
|
||||
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
|
||||
return _loopCount ? _loop[loopNo].cel[celNo].height : 0;
|
||||
}
|
||||
|
||||
CelInfo *View::getCelInfo(LoopNo loopNo, CelNo celNo) {
|
||||
CelInfo *View::getCelInfo(int16 loopNo, int16 celNo) {
|
||||
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
|
||||
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
|
||||
return _loopCount ? &_loop[loopNo].cel[celNo] : NULL;
|
||||
}
|
||||
|
||||
LoopInfo *View::getLoopInfo(LoopNo loopNo) {
|
||||
LoopInfo *View::getLoopInfo(int16 loopNo) {
|
||||
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
|
||||
return _loopCount ? &_loop[loopNo] : NULL;
|
||||
}
|
||||
|
||||
void View::getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect) {
|
||||
void View::getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect) {
|
||||
CelInfo *celInfo = getCelInfo(loopNo, celNo);
|
||||
if (celInfo) {
|
||||
outRect->left = x + celInfo->displaceX - (celInfo->width >> 1);
|
||||
@ -266,7 +266,7 @@ void View::getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Com
|
||||
}
|
||||
}
|
||||
|
||||
void View::unpackCel(LoopNo loopNo, CelNo celNo, byte *outPtr, uint16 pixelCount) {
|
||||
void View::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint16 pixelCount) {
|
||||
CelInfo *celInfo = getCelInfo(loopNo, celNo);
|
||||
byte *rlePtr;
|
||||
byte *literalPtr;
|
||||
@ -354,7 +354,7 @@ void View::unpackCel(LoopNo loopNo, CelNo celNo, byte *outPtr, uint16 pixelCount
|
||||
error("Unable to decompress view");
|
||||
}
|
||||
|
||||
byte *View::getBitmap(LoopNo loopNo, CelNo celNo) {
|
||||
byte *View::getBitmap(int16 loopNo, int16 celNo) {
|
||||
loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
|
||||
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
|
||||
if (_loop[loopNo].cel[celNo].rawBitmap)
|
||||
@ -460,7 +460,7 @@ void View::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clear
|
||||
}
|
||||
}
|
||||
|
||||
void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
|
||||
CelInfo *celInfo = getCelInfo(loopNo, celNo);
|
||||
byte *bitmap = getBitmap(loopNo, celNo);
|
||||
|
@ -54,20 +54,20 @@ public:
|
||||
~View();
|
||||
|
||||
GuiResourceId getResourceId();
|
||||
int16 getWidth(LoopNo loopNo, CelNo celNo);
|
||||
int16 getHeight(LoopNo loopNo, CelNo celNo);
|
||||
CelInfo *getCelInfo(LoopNo loopNo, CelNo celNo);
|
||||
LoopInfo *getLoopInfo(LoopNo loopNo);
|
||||
void getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
|
||||
byte *getBitmap(LoopNo loopNo, CelNo celNo);
|
||||
void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
int16 getWidth(int16 loopNo, int16 celNo);
|
||||
int16 getHeight(int16 loopNo, int16 celNo);
|
||||
CelInfo *getCelInfo(int16 loopNo, int16 celNo);
|
||||
LoopInfo *getLoopInfo(int16 loopNo);
|
||||
void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
|
||||
byte *getBitmap(int16 loopNo, int16 celNo);
|
||||
void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
uint16 getLoopCount() const { return _loopCount; }
|
||||
uint16 getCelCount(LoopNo loopNo) { return _loop[loopNo].celCount; }
|
||||
uint16 getCelCount(int16 loopNo) { return _loop[loopNo].celCount; }
|
||||
Palette *getPalette();
|
||||
|
||||
private:
|
||||
void initData(GuiResourceId resourceId);
|
||||
void unpackCel(LoopNo loopNo, CelNo celNo, byte *outPtr, uint16 pixelCount);
|
||||
void unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint16 pixelCount);
|
||||
void unditherBitmap(byte *bitmap, int16 width, int16 height, byte clearKey);
|
||||
|
||||
ResourceManager *_resMan;
|
||||
|
@ -269,7 +269,7 @@ void WindowMgr::DisposeWindow(Window *pWnd, bool reanimate) {
|
||||
}
|
||||
|
||||
void WindowMgr::UpdateWindow(Window *wnd) {
|
||||
MemoryHandle handle;
|
||||
reg_t handle;
|
||||
|
||||
if (wnd->saveScreenMask && wnd->bDrawn) {
|
||||
handle = _gfx->BitsSave(wnd->restoreRect, SCI_SCREEN_MASK_VISUAL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user