aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2003-10-02 07:54:01 +0000
committerGregory Montoir2003-10-02 07:54:01 +0000
commit906c2eab2ed223357222562880d42522e4bacf4b (patch)
treec27afeb584a2690c5b4071a527398bf85f127c4a /queen
parentc8de7d508997c26295dbbb6f4853a8a113b74d8a (diff)
downloadscummvm-rg350-906c2eab2ed223357222562880d42522e4bacf4b.tar.gz
scummvm-rg350-906c2eab2ed223357222562880d42522e4bacf4b.tar.bz2
scummvm-rg350-906c2eab2ed223357222562880d42522e4bacf4b.zip
minor changes to Graphics class (dtor...)
svn-id: r10533
Diffstat (limited to 'queen')
-rw-r--r--queen/graphics.cpp41
-rw-r--r--queen/graphics.h24
2 files changed, 27 insertions, 38 deletions
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 965e37dc3d..14d724caee 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -28,10 +28,21 @@ QueenGraphics::QueenGraphics(QueenResource *resource)
memset(_frames, 0, sizeof(_frames));
memset(_banks, 0, sizeof(_banks));
memset(_sortedBobs, 0, sizeof(_sortedBobs));
+ _shrinkBuffer.data = new uint8[BOB_SHRINK_BUF_SIZE];
}
+QueenGraphics::~QueenGraphics() {
+ uint32 i;
+ for(i = 0; i < ARRAYSIZE(_banks); ++i) {
+ delete _banks[i].data;
+ }
+// frameClearAll();
+ delete _shrinkBuffer.data;
+}
+
+
void QueenGraphics::bankLoad(const char *bankname, uint32 bankslot) {
int16 i;
@@ -269,16 +280,13 @@ void QueenGraphics::bobDraw(uint32 bobnum, uint16 x, uint16 y, uint16 scale, boo
BobFrame *pbf = &_frames[bobnum];
if (scale < 100) { // Note: scale is unsigned, hence always >= 0
bobShrink(pbf, scale);
- src = _shrinkBuffer.data;
- w = _shrinkBuffer.width;
- h = _shrinkBuffer.height;
- }
- else {
- src = pbf->data;
- w = pbf->width;
- h = pbf->height;
+ pbf = &_shrinkBuffer;
}
+ src = pbf->data;
+ w = pbf->width;
+ h = pbf->height;
+
if(w != 0 && h != 0 && box.intersects(x, y, w, h)) {
uint16 x_skip = 0;
@@ -307,10 +315,7 @@ void QueenGraphics::bobDraw(uint32 bobnum, uint16 x, uint16 y, uint16 scale, boo
h_new = box.y2 - y + 1;
}
- uint16 j;
- for (j = 0; j < h_new; ++j) {
- memset(_ulines[y + j], 2, w_new / 16);
- }
+// _display->ulines(i, j, w_new / 16, h_new);
src += w * y_skip;
if (!xflip) {
@@ -330,13 +335,7 @@ void QueenGraphics::bobDraw(uint32 bobnum, uint16 x, uint16 y, uint16 scale, boo
void QueenGraphics::bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y) {
if (bobnum == 0) {
// clear panel area
- uint8 *p = _panel + y * 320 + x;
- for(uint32 j = 0; j < 32; ++j) {
- for(uint32 i = 0; i < 32; ++i) {
- *p++ = INK_BG_PANEL;
- }
- p += 320 - 32;
- }
+// _display->clear(panel, x, y, 32, 32, INK_BG_PANEL);
}
else {
// BobFrame *pbf = &_frames[bobnum];
@@ -391,7 +390,9 @@ void QueenGraphics::bobShrink(const BobFrame* pbf, uint16 percentage) {
src += pbf->width;
y_count &= 0xFFFF;
}
- }
+ }
+
+ debug(5, "Shrunk bob, buffer size = %d", new_w * new_h);
}
}
diff --git a/queen/graphics.h b/queen/graphics.h
index 7091224878..01a0adf37c 100644
--- a/queen/graphics.h
+++ b/queen/graphics.h
@@ -30,6 +30,8 @@
#define MAX_BANKS_NUMBER 18
#define MAX_BOBS_NUMBER 64
+#define BOB_SHRINK_BUF_SIZE 60000
+
struct BobFrame {
uint16 width, height;
@@ -51,7 +53,7 @@ struct BobSlot {
bool active;
uint16 x, y; //! current position
Box box; //! bounding box
- bool xflip;
+ bool xflip;
uint16 scale; //! shrinking percentage
uint16 frameNum; //! associated BobFrame
uint8 frameDir; //! 'direction' for the next frame (-1, 1)
@@ -88,16 +90,11 @@ struct BobSlot {
};
-//! Inks indexes
-enum {
- INK_BG_PANEL = 0xE2
-};
-
-
class QueenGraphics {
public:
QueenGraphics(QueenResource *resource);
+ ~QueenGraphics();
void bankLoad(const char *bankname, uint32 bankslot); // loadbank()
void bankUnpack(uint32 srcframe, uint32 dstframe, uint32 bankslot); // unpackbank()
@@ -118,7 +115,6 @@ public:
void frameErase(uint32 fslot);
-
private:
struct PackedBank {
@@ -126,19 +122,11 @@ private:
uint8 *data;
};
- struct ShrunkBobFrame {
- uint16 width;
- uint16 height;
- uint8 data[60000]; // FIXME: original buffer size, maybe it can be smaller
- };
-
BobFrame _frames[MAX_FRAMES_NUMBER]; //! unbanked bob frames
PackedBank _banks[MAX_BANKS_NUMBER]; //! banked bob frames
BobSlot _bobs[MAX_BOBS_NUMBER];
- BobSlot* _sortedBobs[MAX_BOBS_NUMBER + 1]; //! bobs displayed
- ShrunkBobFrame _shrinkBuffer;
- uint8 _ulines[201][20];
- uint8 _panel[320 * 50]; // FIXME: rather in QueenDisplay ?
+ BobSlot *_sortedBobs[MAX_BOBS_NUMBER + 1]; //! bobs displayed
+ BobFrame _shrinkBuffer;
QueenResource *_resource;