mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-06 01:31:39 +00:00
BAGEL: Renaming in pan_bitmap and pan_window, fix typos, move some code from header to cpp file, remove unused functions
This commit is contained in:
parent
23a839bc1f
commit
badeeca5d2
@ -43,8 +43,8 @@ void PaintTable::initialize(Common::SeekableReadStream &src) {
|
||||
int result = sscanf(line.c_str(), "{ %d,%d}", &y1, &y2);
|
||||
assert(result == 2);
|
||||
|
||||
STRIP_POINTS[stripNum][pointIndex].top = y1;
|
||||
STRIP_POINTS[stripNum][pointIndex].bottom = y2;
|
||||
STRIP_POINTS[stripNum][pointIndex]._top = y1;
|
||||
STRIP_POINTS[stripNum][pointIndex]._bottom = y2;
|
||||
|
||||
// Move to next point on line
|
||||
line = Common::String(strchr(line.c_str() + 1, '{'));
|
||||
|
@ -28,8 +28,8 @@
|
||||
namespace Bagel {
|
||||
|
||||
struct stripEnds {
|
||||
int16 top;
|
||||
int16 bottom;
|
||||
int16 _top;
|
||||
int16 _bottom;
|
||||
};
|
||||
|
||||
extern stripEnds STRIP_POINTS[153][120];
|
||||
|
@ -29,11 +29,11 @@ const CBofRect CBagPanBitmap::getMaxView(CBofSize s) {
|
||||
CBofRect r;
|
||||
|
||||
if (_bPanorama) {
|
||||
int h = 3 * (int)((double)width() / (MAXDIVVIEW * 4));
|
||||
int h = 3 * (int)((double)width() / (MAX_DIV_VIEW * 4));
|
||||
if (h > height())
|
||||
h = height();
|
||||
|
||||
r.setRect(0, 0, (int)(width() / MAXDIVVIEW - 2), h - 1);
|
||||
r.setRect(0, 0, (int)(width() / MAX_DIV_VIEW - 2), h - 1);
|
||||
|
||||
} else {
|
||||
r.setRect(0, 0, width() - 1, height() - 1);
|
||||
@ -59,7 +59,7 @@ CBagPanBitmap::CBagPanBitmap(const char *pszFileName, CBofPalette *pPalette, con
|
||||
if (nW && nH) {
|
||||
CBofRect xMaxViewSize(0, 0, nW - 1, nH - 1);
|
||||
if (nW > 1000) {
|
||||
xMaxViewSize.left = (long)(nW / MAXDIVVIEW);
|
||||
xMaxViewSize.left = (long)(nW / MAX_DIV_VIEW);
|
||||
_bPanorama = true;
|
||||
} else
|
||||
_bPanorama = false;
|
||||
@ -82,13 +82,13 @@ CBagPanBitmap::CBagPanBitmap(const char *pszFileName, CBofPalette *pPalette, con
|
||||
_xRotateRate.x = (nW - _xCurrView.width()) / 64 + 1;
|
||||
_xRotateRate.y = (nH - _xCurrView.height()) / 64 + 1;
|
||||
|
||||
NormalizeViewSize();
|
||||
normalizeViewSize();
|
||||
|
||||
setFOV(DEFFOV); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
|
||||
setFOV(DEF_FOV); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
|
||||
|
||||
// _nCorrWidth is uninitialized for the call to setFOV below,
|
||||
// this causes the cosine table to be allocated incorrectly in
|
||||
// GenerateCosineTable. Move the initialization before setFOV.
|
||||
// generateCosineTable. Move the initialization before setFOV.
|
||||
if (_bPanorama)
|
||||
setCorrWidth(4);
|
||||
else
|
||||
@ -109,7 +109,7 @@ CBagPanBitmap::CBagPanBitmap(int dx, int dy, CBofPalette *pPalette, const CBofRe
|
||||
if (nW && nH) {
|
||||
CBofRect xMaxViewSize(0, 0, nW - 1, nH - 1);
|
||||
if (nW > 1000) {
|
||||
xMaxViewSize.left = (long)(nW / MAXDIVVIEW);
|
||||
xMaxViewSize.left = (long)(nW / MAX_DIV_VIEW);
|
||||
_bPanorama = true;
|
||||
} else
|
||||
_bPanorama = false;
|
||||
@ -132,9 +132,9 @@ CBagPanBitmap::CBagPanBitmap(int dx, int dy, CBofPalette *pPalette, const CBofRe
|
||||
_xRotateRate.x = (nW - _xCurrView.width()) / 64 + 1;
|
||||
_xRotateRate.y = (nH - _xCurrView.height()) / 64 + 1;
|
||||
|
||||
NormalizeViewSize();
|
||||
normalizeViewSize();
|
||||
|
||||
setFOV(DEFFOV); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
|
||||
setFOV(DEF_FOV); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
|
||||
|
||||
if (_bPanorama)
|
||||
setCorrWidth(4);
|
||||
@ -158,7 +158,7 @@ CBagPanBitmap::~CBagPanBitmap() {
|
||||
}
|
||||
|
||||
// This must be updated whenever the size, view size, or correction witdh changes
|
||||
void CBagPanBitmap::GenerateCosineTable() {
|
||||
void CBagPanBitmap::generateCosineTable() {
|
||||
int nWidth = 1 << _nCorrWidth;
|
||||
int offset = nWidth >> 1; // This is not really needed just more correction to move angle to center
|
||||
int viewWidth = _xCurrView.width();
|
||||
@ -178,10 +178,6 @@ void CBagPanBitmap::GenerateCosineTable() {
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode CBagPanBitmap::paint(CBofWindow * /*pWnd*/, const CBofPoint /*xDstOffset*/) {
|
||||
return _errCode;
|
||||
}
|
||||
|
||||
CBofRect CBagPanBitmap::getWarpSrcRect() {
|
||||
int nH2 = height() >> 1;
|
||||
|
||||
@ -252,9 +248,9 @@ ErrorCode CBagPanBitmap::paintWarped(CBofBitmap *pBmp, const CBofRect &dstRect,
|
||||
for (int i = 0; i < dstRect.width(); i += nWidth, stripNumber++) {
|
||||
// Set the source
|
||||
PanSrcRect.setRect(srcRect.left + i,
|
||||
STRIP_POINTS[tableSlot][stripNumber].top,
|
||||
STRIP_POINTS[tableSlot][stripNumber]._top,
|
||||
nRight + i,
|
||||
STRIP_POINTS[tableSlot][stripNumber].bottom);
|
||||
STRIP_POINTS[tableSlot][stripNumber]._bottom);
|
||||
|
||||
pSrcBmp->paintStretch4(pBmp, &WndDstRect, &PanSrcRect);
|
||||
|
||||
@ -376,7 +372,7 @@ void CBagPanBitmap::setCorrWidth(int nWidth, bool bUpdate) {
|
||||
if (i >= 0 && i < 6) {
|
||||
_nCorrWidth = i;
|
||||
if (bUpdate) {
|
||||
GenerateCosineTable();
|
||||
generateCosineTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -409,14 +405,14 @@ void CBagPanBitmap::rotateDown(int nYRotRate) {
|
||||
offsetCurrView(CBofPoint(0, -1 * _xRotateRate.y));
|
||||
}
|
||||
|
||||
void CBagPanBitmap::NormalizeViewSize() {
|
||||
void CBagPanBitmap::normalizeViewSize() {
|
||||
int nW = width();
|
||||
int nH = height();
|
||||
|
||||
if (_bPanorama) {
|
||||
// The CurrView can not be more than 0.25Width x Height of the Bitmap
|
||||
if ((_xCurrView.width() >= nW / MAXDIVVIEW) || (_xCurrView.width() <= 0))
|
||||
_xCurrView.right = (long)(_xCurrView.left + nW / MAXDIVVIEW - 1);
|
||||
if ((_xCurrView.width() >= nW / MAX_DIV_VIEW) || (_xCurrView.width() <= 0))
|
||||
_xCurrView.right = (long)(_xCurrView.left + nW / MAX_DIV_VIEW - 1);
|
||||
if ((_xCurrView.height() >= nH) || (_xCurrView.height() <= 0))
|
||||
_xCurrView.bottom = _xCurrView.top + nH - 1;
|
||||
|
||||
@ -440,4 +436,46 @@ void CBagPanBitmap::NormalizeViewSize() {
|
||||
_xCurrView.offsetRect(0, (nH - _xCurrView.bottom) - 1);
|
||||
}
|
||||
|
||||
|
||||
void CBagPanBitmap::setCurrView(const CBofRect &xCurrView) {
|
||||
_xCurrView = xCurrView;
|
||||
normalizeViewSize();
|
||||
}
|
||||
|
||||
void CBagPanBitmap::offsetCurrView(const CBofPoint &xOffset) {
|
||||
CBofRect xCurrView = _xCurrView;
|
||||
xCurrView.offsetRect(xOffset);
|
||||
setCurrView(xCurrView);
|
||||
}
|
||||
|
||||
void CBagPanBitmap::setFOV(double degrees, bool bUpdate) {
|
||||
_xFOVAngle = degrees / 114.5916558176;
|
||||
if (bUpdate) {
|
||||
generateCosineTable();
|
||||
}
|
||||
}
|
||||
|
||||
void CBagPanBitmap::setViewSize(const CBofSize &xViewSize, bool bUpdate) {
|
||||
_xCurrView.right = _xCurrView.left + xViewSize.cx;
|
||||
_xCurrView.bottom = _xCurrView.top + xViewSize.cy;
|
||||
normalizeViewSize();
|
||||
|
||||
if (bUpdate) {
|
||||
generateCosineTable();
|
||||
}
|
||||
}
|
||||
|
||||
CBofSize CBagPanBitmap::setUnityViewSize() {
|
||||
int w = (int)(width() * _xFOVAngle / 3.14159);
|
||||
_xCurrView.setRect(0, _xCurrView.top, w, _xCurrView.bottom);
|
||||
generateCosineTable();
|
||||
return getViewSize();
|
||||
}
|
||||
|
||||
double CBagPanBitmap::setUnityFOV() {
|
||||
setFOV(360.0 * _xCurrView.width() / width(), false); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
|
||||
generateCosineTable();
|
||||
return getFOV();
|
||||
}
|
||||
|
||||
} // namespace Bagel
|
||||
|
@ -28,8 +28,8 @@
|
||||
|
||||
namespace Bagel {
|
||||
|
||||
#define MAXDIVVIEW (12.8 / 3) // Ratio for 480x380 Screen
|
||||
#define DEFFOV (360 / MAXDIVVIEW) // 1TO1 Paint FOV
|
||||
#define MAX_DIV_VIEW (12.8 / 3) // Ratio for 480x380 Screen
|
||||
#define DEF_FOV (360 / MAX_DIV_VIEW) // 1TO1 Paint FOV
|
||||
|
||||
class CBagPanBitmap : public CBofBitmap {
|
||||
public:
|
||||
@ -44,7 +44,7 @@ public:
|
||||
|
||||
private:
|
||||
CBofRect _xCurrView; // Viewport Window size (0->Width-1,0->Heigth-1,1->Width+Width/4,1->Heigth)
|
||||
double _xFOVAngle; // Feild of view in radians
|
||||
double _xFOVAngle; // Field of view in radians
|
||||
CBofPoint _xRotateRate; // Rate of rotation on increment left, right ...
|
||||
bool _bActiveScrolling; // True when there should be screen updates
|
||||
bool _bPanorama; // True when the bitmap is a 360 panorama
|
||||
@ -53,49 +53,59 @@ private:
|
||||
CBofFixed *_pCosineTable; // Lookup table for cosine values
|
||||
int _nNumDegrees; // Number of lookups in the cosine table
|
||||
bool _bIsValid; // Is the bmp a valid object
|
||||
static int AdjustConvexUp(CBofRect &, const CBofRect &, const int);
|
||||
static int AdjustConvexDown(CBofRect &, const CBofRect &, const int);
|
||||
static int AdjustPlanar(CBofRect &, const CBofRect &, const int);
|
||||
|
||||
void NormalizeViewSize();
|
||||
void GenerateCosineTable();
|
||||
void normalizeViewSize();
|
||||
void generateCosineTable();
|
||||
|
||||
public:
|
||||
CBagPanBitmap(const char *pszFileName, CBofPalette *pPalette, const CBofRect &xViewSize = CBofRect());
|
||||
CBagPanBitmap(int dx, int dy, CBofPalette *pPalette, const CBofRect &xViewSize = CBofRect());
|
||||
virtual ~CBagPanBitmap();
|
||||
|
||||
bool isValid() {
|
||||
bool isValid() const {
|
||||
return _bIsValid;
|
||||
}
|
||||
bool isPan() {
|
||||
bool isPan() const {
|
||||
return _bPanorama;
|
||||
}
|
||||
|
||||
ErrorCode paint(CBofBitmap *pBmp, const CBofPoint xDstOffset = CBofPoint(0, 0));
|
||||
ErrorCode paint(CBofWindow *pWnd, const CBofPoint xDstOffset = CBofPoint(0, 0));
|
||||
ErrorCode paintUncorrected(CBofBitmap *pBmp, CBofRect &dstRect);
|
||||
ErrorCode paintWarped(CBofBitmap *pBmp, const CBofRect &dstRect, const CBofRect &srcRect, const int offset = 0, CBofBitmap *pSrcBmp = nullptr, const CBofRect &preSrcRect = CBofRect());
|
||||
ErrorCode paintWarped4(CBofBitmap *pBmp, const CBofRect &dstRect, const CBofRect &srcRect, const int offset = 0, CBofBitmap *pSrcBmp = nullptr, const CBofRect &preSrcRect = CBofRect());
|
||||
|
||||
|
||||
CBofRect getWarpSrcRect();
|
||||
CBofPoint warpedPoint(CBofPoint &xPoint);
|
||||
|
||||
double getFOV() {
|
||||
const CBofRect getMaxView(CBofSize s = CBofSize(640, 480));
|
||||
|
||||
void setCorrWidth(int nWidth, bool bUpdate = true);
|
||||
|
||||
void rotateRight(int nXRotRate = 0);
|
||||
void rotateLeft(int nXRotRate = 0);
|
||||
void rotateUp(int nYRotRate = 0);
|
||||
void rotateDown(int nYRotRate = 0);
|
||||
|
||||
Direction updateView();
|
||||
|
||||
void setCurrView(const CBofRect &xCurrView);
|
||||
void offsetCurrView(const CBofPoint &xOffset);
|
||||
void setFOV(double degrees, bool bUpdate = true);
|
||||
|
||||
void setViewSize(const CBofSize &xViewSize, bool bUpdate = true);
|
||||
CBofSize setUnityViewSize();
|
||||
double setUnityFOV();
|
||||
|
||||
double getFOV() const {
|
||||
return _xFOVAngle;
|
||||
}
|
||||
const CBofSize getViewSize() {
|
||||
const CBofSize getViewSize() const {
|
||||
return CBofPoint(_xCurrView.size());
|
||||
}
|
||||
const CBofRect getCurrView() {
|
||||
const CBofRect getCurrView() const {
|
||||
return _xCurrView;
|
||||
}
|
||||
|
||||
const CBofRect getMaxView(CBofSize s = CBofSize(640, 480));
|
||||
const CBofPoint getRotateRate() {
|
||||
return _xRotateRate;
|
||||
}
|
||||
Direction getDirection() {
|
||||
Direction getDirection() const {
|
||||
return _xDirection;
|
||||
}
|
||||
|
||||
@ -105,61 +115,17 @@ public:
|
||||
void setDirection(const Direction xDirection) {
|
||||
_xDirection = xDirection;
|
||||
}
|
||||
void setCurrView(const CBofRect &xCurrView) {
|
||||
_xCurrView = xCurrView;
|
||||
NormalizeViewSize();
|
||||
}
|
||||
void offsetCurrView(const CBofPoint &xOffset) {
|
||||
CBofRect xCurrView = _xCurrView;
|
||||
xCurrView.offsetRect(xOffset);
|
||||
setCurrView(xCurrView);
|
||||
}
|
||||
void setFOV(double degrees, bool bUpdate = true) {
|
||||
_xFOVAngle = degrees / 114.5916558176;
|
||||
if (bUpdate) {
|
||||
// _xCurrView.setRect(0, _xCurrView.top, width()*degrees/360, _xCurrView.bottom);
|
||||
GenerateCosineTable();
|
||||
}
|
||||
}
|
||||
int getCorrWidth() {
|
||||
return _nCorrWidth;
|
||||
}
|
||||
|
||||
void setCorrWidth(int nWidth, bool bUpdate = true);
|
||||
|
||||
void setViewSize(const CBofSize &xViewSize, bool bUpdate = true) {
|
||||
_xCurrView.right = _xCurrView.left + xViewSize.cx;
|
||||
_xCurrView.bottom = _xCurrView.top + xViewSize.cy;
|
||||
NormalizeViewSize();
|
||||
|
||||
if (bUpdate) {
|
||||
GenerateCosineTable();
|
||||
}
|
||||
}
|
||||
CBofSize setUnityViewSize() {
|
||||
int w = (int)(width() * _xFOVAngle / 3.14159);
|
||||
_xCurrView.setRect(0, _xCurrView.top, w, _xCurrView.bottom);
|
||||
GenerateCosineTable();
|
||||
return getViewSize();
|
||||
}
|
||||
double setUnityFOV() {
|
||||
setFOV(360.0 * _xCurrView.width() / width(), false); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
|
||||
GenerateCosineTable();
|
||||
return getFOV();
|
||||
}
|
||||
void rotateRight(int nXRotRate = 0);
|
||||
void rotateLeft(int nXRotRate = 0);
|
||||
void rotateUp(int nYRotRate = 0);
|
||||
void rotateDown(int nYRotRate = 0);
|
||||
|
||||
Direction updateView();
|
||||
|
||||
void activateScrolling(bool val = true) {
|
||||
_bActiveScrolling = val;
|
||||
}
|
||||
void deActivateScrolling() {
|
||||
activateScrolling(false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace Bagel
|
||||
|
@ -47,7 +47,7 @@ void CBagPanWindow::initialize() {
|
||||
CBagPanWindow::CBagPanWindow() : CBagStorageDevWnd() {
|
||||
CBofRect tmpRect;
|
||||
|
||||
_xVeiwPortPos = CBofPoint(0, 20);
|
||||
_xViewPortPos = CBofPoint(0, 20);
|
||||
_xMovementRect.setRectEmpty();
|
||||
|
||||
_nCorrection = CBagMasterWin::getCorrection();
|
||||
@ -58,7 +58,7 @@ CBagPanWindow::CBagPanWindow() : CBagStorageDevWnd() {
|
||||
_bStretchToScreen = false;
|
||||
_bDraggingObject = false;
|
||||
_bDraggingStart = CBofPoint(0, 0);
|
||||
_pVeiwPortBitmap = nullptr;
|
||||
_pViewPortBitmap = nullptr;
|
||||
|
||||
// Objects to be painted to the window
|
||||
_pFGObjectList = new CBofList<CBagObject *>();
|
||||
@ -72,7 +72,7 @@ CBagPanWindow::CBagPanWindow() : CBagStorageDevWnd() {
|
||||
LoadObjects();
|
||||
}
|
||||
|
||||
CBofRect CBagPanWindow::unSetSlidebitmap() {
|
||||
CBofRect CBagPanWindow::unSetSlideBitmap() {
|
||||
CBofRect viewRect;
|
||||
|
||||
SetLActiveObject(nullptr);
|
||||
@ -82,9 +82,9 @@ CBofRect CBagPanWindow::unSetSlidebitmap() {
|
||||
delete _pSlideBitmap;
|
||||
_pSlideBitmap = nullptr;
|
||||
}
|
||||
if (_pVeiwPortBitmap) {
|
||||
delete _pVeiwPortBitmap;
|
||||
_pVeiwPortBitmap = nullptr;
|
||||
if (_pViewPortBitmap) {
|
||||
delete _pViewPortBitmap;
|
||||
_pViewPortBitmap = nullptr;
|
||||
}
|
||||
|
||||
CBofSprite::closeLibrary();
|
||||
@ -95,9 +95,9 @@ CBofRect CBagPanWindow::unSetSlidebitmap() {
|
||||
return viewRect;
|
||||
}
|
||||
|
||||
CBofPalette *CBagPanWindow::setSlidebitmap(const CBofString &xSlideBmp, const CBofRect &xSlideRect) {
|
||||
CBofPalette *CBagPanWindow::setSlideBitmap(const CBofString &xSlideBmp, const CBofRect &xSlideRect) {
|
||||
if (!xSlideBmp.isEmpty()) {
|
||||
CBofRect viewRect = unSetSlidebitmap();
|
||||
CBofRect viewRect = unSetSlideBitmap();
|
||||
CBofRect cRect = getWindowRect();
|
||||
|
||||
if ((cRect.width() <= 0) || (cRect.width() > DEF_WIDTH))
|
||||
@ -133,8 +133,8 @@ CBofPalette *CBagPanWindow::setSlidebitmap(const CBofString &xSlideBmp, const CB
|
||||
if (!pBackDropBitmap || pBackDropBitmap->height() <= 0 || pBackDropBitmap->width() <= 0) {
|
||||
reportError(ERR_FOPEN, "Error opening bitmap");
|
||||
}
|
||||
_pVeiwPortBitmap = new CBofBitmap(DEF_WIDTH + 1, _pSlideBitmap->height() + 1, _pPalette);
|
||||
if (!_pVeiwPortBitmap || !_pVeiwPortBitmap->height() || !_pVeiwPortBitmap->width()) {
|
||||
_pViewPortBitmap = new CBofBitmap(DEF_WIDTH + 1, _pSlideBitmap->height() + 1, _pPalette);
|
||||
if (!_pViewPortBitmap || !_pViewPortBitmap->height() || !_pViewPortBitmap->width()) {
|
||||
reportError(ERR_FOPEN);
|
||||
}
|
||||
setBackdrop(pBackDropBitmap);
|
||||
@ -154,9 +154,9 @@ CBagPanWindow::~CBagPanWindow() {
|
||||
delete _pSlideBitmap;
|
||||
_pSlideBitmap = nullptr;
|
||||
}
|
||||
if (_pVeiwPortBitmap) {
|
||||
delete _pVeiwPortBitmap;
|
||||
_pVeiwPortBitmap = nullptr;
|
||||
if (_pViewPortBitmap) {
|
||||
delete _pViewPortBitmap;
|
||||
_pViewPortBitmap = nullptr;
|
||||
}
|
||||
|
||||
CBofSprite::closeLibrary(); // Free the off screen bitmap
|
||||
@ -210,21 +210,21 @@ ErrorCode CBagPanWindow::onRender(CBofBitmap *pBmp, CBofRect *pRect) {
|
||||
SetPreFilterPan(false);
|
||||
}
|
||||
|
||||
_pSlideBitmap->paintUncorrected(_pVeiwPortBitmap, offsetRect); // Paint and return size
|
||||
_pSlideBitmap->paintUncorrected(_pViewPortBitmap, offsetRect); // Paint and return size
|
||||
srcRect.offsetRect(0, currViewRect.top - offsetRect.top); // less the offset from full
|
||||
|
||||
// Paint the objects to the backdrop
|
||||
paintObjects(GetObjectList(), _pVeiwPortBitmap, offsetRect, nullptr);
|
||||
paintObjects(GetObjectList(), _pViewPortBitmap, offsetRect, nullptr);
|
||||
|
||||
dstRect.offsetRect(_xVeiwPortPos);
|
||||
dstRect.offsetRect(_xViewPortPos);
|
||||
|
||||
// No correction ?
|
||||
if (_nCorrection == 0) {
|
||||
_pVeiwPortBitmap->paint(pBmp, &dstRect, &srcRect);
|
||||
_pViewPortBitmap->paint(pBmp, &dstRect, &srcRect);
|
||||
|
||||
} else {
|
||||
// Warp the backdrop to itself
|
||||
_pSlideBitmap->paintWarped(pBmp, dstRect, srcRect, 0, _pVeiwPortBitmap, offsetRect);
|
||||
_pSlideBitmap->paintWarped(pBmp, dstRect, srcRect, 0, _pViewPortBitmap, offsetRect);
|
||||
}
|
||||
|
||||
if (IsFiltered()) {
|
||||
@ -249,11 +249,11 @@ ErrorCode CBagPanWindow::onRender(CBofBitmap *pBmp, CBofRect *pRect) {
|
||||
// Only paint the slide the first time around, if we paint
|
||||
// it in subsequent calls, then we will trash our PDA in this closeup,
|
||||
// and that will be a bad thing.
|
||||
dstRect.offsetRect(_xVeiwPortPos);
|
||||
((CBofBitmap *)_pSlideBitmap)->paint(pBmp, _xVeiwPortPos.x, _xVeiwPortPos.y);
|
||||
dstRect.offsetRect(_xViewPortPos);
|
||||
((CBofBitmap *)_pSlideBitmap)->paint(pBmp, _xViewPortPos.x, _xViewPortPos.y);
|
||||
}
|
||||
|
||||
clientArea.offsetRect(-_xVeiwPortPos.x, -_xVeiwPortPos.y);
|
||||
clientArea.offsetRect(-_xViewPortPos.x, -_xViewPortPos.y);
|
||||
paintObjects(GetObjectList(), pBmp, clientArea, nullptr);
|
||||
|
||||
if (IsFiltered()) {
|
||||
@ -810,8 +810,8 @@ const CBofPoint CBagPanWindow::devPtToViewPort(const CBofPoint &xPoint) {
|
||||
CRect r = _pSlideBitmap->getCurrView();
|
||||
CBofPoint p;
|
||||
|
||||
p.x = xPoint.x + r.left - _xVeiwPortPos.x;
|
||||
p.y = xPoint.y + r.top - _xVeiwPortPos.y;
|
||||
p.x = xPoint.x + r.left - _xViewPortPos.x;
|
||||
p.y = xPoint.y + r.top - _xViewPortPos.y;
|
||||
|
||||
if (_pSlideBitmap->isPan()) {
|
||||
if (p.x >= _pSlideBitmap->width())
|
||||
@ -848,4 +848,32 @@ ErrorCode CBagPanWindow::attachActiveObjects() {
|
||||
return _errCode;
|
||||
}
|
||||
|
||||
void CBagPanWindow::setViewPortSize(const CSize &xViewSize) {
|
||||
if (_pSlideBitmap)
|
||||
_pSlideBitmap->setViewSize(xViewSize);
|
||||
}
|
||||
|
||||
const CRect CBagPanWindow::getViewPort() {
|
||||
CRect r;
|
||||
if (_pSlideBitmap)
|
||||
r = _pSlideBitmap->getCurrView();
|
||||
return r;
|
||||
}
|
||||
|
||||
const CSize CBagPanWindow::getViewPortSize() {
|
||||
CRect r;
|
||||
if (_pSlideBitmap)
|
||||
r = _pSlideBitmap->getCurrView();
|
||||
return r.size();
|
||||
}
|
||||
|
||||
void CBagPanWindow::waitForPDA() {
|
||||
// Make sure we have a non-null pda
|
||||
while (_pPDABmp && _pPDABmp->isActivating()) {
|
||||
SetPreFilterPan(true);
|
||||
_pPDABmp->setDirty(true);
|
||||
PaintScreen();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Bagel
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
//
|
||||
// private data members
|
||||
//
|
||||
CPoint _xVeiwPortPos; // Position of the viewport
|
||||
CPoint _xViewPortPos; // Position of the viewport
|
||||
CRect _xMovementRect; // if mouse is in this region will not scroll
|
||||
CRect _cLeftRect;
|
||||
CRect _cRightRect;
|
||||
@ -63,7 +63,7 @@ private:
|
||||
CRect _cBottomRect;
|
||||
|
||||
CBagPanBitmap *_pSlideBitmap; // Contains the full bitmap of the world
|
||||
CBofBitmap *_pVeiwPortBitmap; // Contains the current viewport bitmap
|
||||
CBofBitmap *_pViewPortBitmap; // Contains the current viewport bitmap
|
||||
CBofPalette *_pPalette;
|
||||
|
||||
CBofPoint _bDraggingStart; // Starting location of the dragged object
|
||||
@ -71,12 +71,8 @@ private:
|
||||
|
||||
bool _bStretchToScreen; // Whether or not the backdrop is painted full screen
|
||||
bool _bPaintToBackdrop; // Whether or not the backdrop is a extra paint surface
|
||||
// Access via CSprite::getBackdrop()
|
||||
CBofList<CBagObject *> *_pFGObjectList; // Objects to be painted to the window
|
||||
|
||||
// CPoint _xCursorLocation; // Current cursor location in bmp.
|
||||
// double _fxAspectRation; // Maintain the current aspect ratio
|
||||
// double _fyAspectRation; // Maintain the current aspect ratio
|
||||
CBofList<CBagObject *> *_pFGObjectList; // Objects to be painted to the window
|
||||
|
||||
public:
|
||||
static CBagWield *_pWieldBmp; // Pointer to the WEILD object
|
||||
@ -85,9 +81,9 @@ public:
|
||||
virtual ~CBagPanWindow();
|
||||
static void initialize();
|
||||
|
||||
virtual ErrorCode attachActiveObjects();
|
||||
ErrorCode attachActiveObjects() override;
|
||||
|
||||
virtual ErrorCode onRender(CBofBitmap *pBmp, CRect *pRect = nullptr);
|
||||
ErrorCode onRender(CBofBitmap *pBmp, CRect *pRect = nullptr) override;
|
||||
|
||||
/**
|
||||
* The modal object is painted to the screen until it is done with
|
||||
@ -95,28 +91,44 @@ public:
|
||||
* when the loop value of a modal character is set, before execution
|
||||
* of the next line of script.
|
||||
*/
|
||||
ErrorCode runModal(CBagObject *pObj);
|
||||
ErrorCode runModal(CBagObject *pObj) override;
|
||||
|
||||
ErrorCode insertFGObjects(CBagObject *pBmp);
|
||||
void deleteFGObjects();
|
||||
CBagObject *getFGObjects(const CBofString &sObjName);
|
||||
|
||||
CBofPalette *setSlidebitmap(const CBofString &xSlideBmp, const CRect &xSlideRect = CRect(0, 0, 0, 0));
|
||||
CBofPalette *setSlideBitmap(const CBofString &xSlideBmp, const CRect &xSlideRect = CRect(0, 0, 0, 0));
|
||||
|
||||
/**
|
||||
* Clear the last pan bitmaps and return a rect of the current view
|
||||
*/
|
||||
CBofRect unSetSlidebitmap();
|
||||
|
||||
CBagPanBitmap *getSlideBitmap() {
|
||||
return _pSlideBitmap;
|
||||
}
|
||||
CBofRect unSetSlideBitmap();
|
||||
|
||||
uint32 rotateTo(CPoint xPoint, int nRate = 8);
|
||||
|
||||
void activateView();
|
||||
void deActivateView();
|
||||
|
||||
void enable() override;
|
||||
void disable() override;
|
||||
|
||||
ErrorCode paintObjects(CBofList<CBagObject *> *list, CBofBitmap *pBmp, CRect &viewOffsetRect,
|
||||
CBofList<CRect> * = nullptr, bool tempVar = true);
|
||||
|
||||
const CBofPoint devPtToViewPort(const CBofPoint &xPoint) override;
|
||||
const CBofPoint viewPortToDevPt(const CBofPoint &xPoint) override;
|
||||
|
||||
void setViewPortSize(const CSize &xViewSize);
|
||||
const CRect getViewPort();
|
||||
const CSize getViewPortSize();
|
||||
|
||||
CBagPanBitmap *getSlideBitmap() const {
|
||||
return _pSlideBitmap;
|
||||
}
|
||||
void setViewPortPos(const CPoint &pos) {
|
||||
_xViewPortPos = pos; // Position of the viewport
|
||||
}
|
||||
|
||||
static void setPanSpeed(int nSpeed) {
|
||||
_nPanSpeed = nSpeed;
|
||||
}
|
||||
@ -124,38 +136,10 @@ public:
|
||||
return _nPanSpeed;
|
||||
}
|
||||
|
||||
virtual void enable();
|
||||
virtual void disable();
|
||||
|
||||
ErrorCode paintObjects(CBofList<CBagObject *> *list, CBofBitmap *pBmp, CRect &viewOffsetRect,
|
||||
CBofList<CRect> * = nullptr, bool tempVar = true);
|
||||
ErrorCode paintObjects(CBofList<CBagObject *> *list, CBofBitmap *pBmp) {
|
||||
CRect emptyRect;
|
||||
return paintObjects(list, pBmp, emptyRect);
|
||||
}
|
||||
|
||||
void setViewPortPos(const CPoint &pos) {
|
||||
_xVeiwPortPos = pos; // Position of the viewport
|
||||
}
|
||||
void setViewPortSize(const CSize &xViewSize) {
|
||||
if (_pSlideBitmap)
|
||||
_pSlideBitmap->setViewSize(xViewSize);
|
||||
}
|
||||
const CRect getViewPort() {
|
||||
CRect r;
|
||||
if (_pSlideBitmap)
|
||||
r = _pSlideBitmap->getCurrView();
|
||||
return r;
|
||||
}
|
||||
const CPoint getViewPortPos() {
|
||||
return _xVeiwPortPos;
|
||||
}
|
||||
const CSize getViewPortSize() {
|
||||
CRect r;
|
||||
if (_pSlideBitmap)
|
||||
r = _pSlideBitmap->getCurrView();
|
||||
return r.size();
|
||||
return _xViewPortPos;
|
||||
}
|
||||
|
||||
const CRect getMaxView() {
|
||||
return _pSlideBitmap->getMaxView();
|
||||
}
|
||||
@ -168,23 +152,18 @@ public:
|
||||
void setPaintToBackdrop(const bool bPaint) {
|
||||
_bPaintToBackdrop = bPaint;
|
||||
}
|
||||
|
||||
virtual const CBofPoint devPtToViewPort(const CBofPoint &xPoint);
|
||||
virtual const CBofPoint viewPortToDevPt(const CBofPoint &xPoint);
|
||||
bool getStretchToScreen() {
|
||||
return _bStretchToScreen;
|
||||
}
|
||||
bool setStretchToScreen(bool val = true) {
|
||||
return _bStretchToScreen = val;
|
||||
}
|
||||
|
||||
static int getRealCorrection() {
|
||||
return _nCorrection;
|
||||
}
|
||||
static void setRealCorrection(int n) {
|
||||
_nCorrection = n;
|
||||
}
|
||||
|
||||
int getCorrection() {
|
||||
return _pSlideBitmap->getCorrWidth();
|
||||
}
|
||||
@ -207,15 +186,15 @@ public:
|
||||
public:
|
||||
static void flushInputEvents();
|
||||
|
||||
void onClose();
|
||||
void onMouseMove(uint32 nFlags, CBofPoint *p, void * = nullptr);
|
||||
void onLButtonDown(uint32 nFlags, CBofPoint *point, void * = nullptr);
|
||||
void onLButtonUp(uint32 nFlags, CBofPoint *point, void * = nullptr);
|
||||
void onKeyHit(uint32 lKey, uint32 lRepCount);
|
||||
void onSize(uint32 nType, int cx, int cy);
|
||||
void onClose() override;
|
||||
void onMouseMove(uint32 nFlags, CBofPoint *p, void * = nullptr) override;
|
||||
void onLButtonDown(uint32 nFlags, CBofPoint *point, void * = nullptr) override;
|
||||
void onLButtonUp(uint32 nFlags, CBofPoint *point, void * = nullptr) override;
|
||||
void onKeyHit(uint32 lKey, uint32 lRepCount) override;
|
||||
virtual void onSize(uint32 nType, int cx, int cy);
|
||||
void OnWindowPosChanging(WindowPos *lpwndpos);
|
||||
|
||||
ErrorCode onCursorUpdate(int nCurrObj);
|
||||
ErrorCode onCursorUpdate(int nCurrObj) override;
|
||||
|
||||
static CBagPDA *_pPDABmp; // Pointer to the PDA object
|
||||
|
||||
@ -231,14 +210,7 @@ public:
|
||||
*/
|
||||
bool activatePDA();
|
||||
|
||||
void waitForPDA() {
|
||||
// Make sure we have a non-null pda
|
||||
while (_pPDABmp && _pPDABmp->isActivating()) {
|
||||
SetPreFilterPan(true);
|
||||
_pPDABmp->setDirty(true);
|
||||
PaintScreen();
|
||||
}
|
||||
}
|
||||
void waitForPDA();
|
||||
};
|
||||
|
||||
} // namespace Bagel
|
||||
|
@ -120,7 +120,7 @@ ErrorCode CMainWindow::attach() {
|
||||
|
||||
CBofSound::audioTask();
|
||||
|
||||
CBofPalette *bofpal = setSlidebitmap(GetBackgroundName(), rView);
|
||||
CBofPalette *bofpal = setSlideBitmap(GetBackgroundName(), rView);
|
||||
setPalPtr(bofpal);
|
||||
|
||||
CBagel::getBagApp()->getMasterWnd()->selectPalette(bofpal);
|
||||
@ -299,7 +299,7 @@ ErrorCode CMainWindow::detach() {
|
||||
|
||||
CBagPanWindow::detach();
|
||||
|
||||
unSetSlidebitmap();
|
||||
unSetSlideBitmap();
|
||||
|
||||
destroy();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user