aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2003-10-10 20:03:34 +0000
committerGregory Montoir2003-10-10 20:03:34 +0000
commit4675d193510d4e8191330132b6d58bc85ac5ac5a (patch)
treeed70dab20bb5a5355d9bb139baefc8317a7f3cf8 /queen
parentade93aabffb38f96fb70856111c742b91e8c71ae (diff)
downloadscummvm-rg350-4675d193510d4e8191330132b6d58bc85ac5ac5a.tar.gz
scummvm-rg350-4675d193510d4e8191330132b6d58bc85ac5ac5a.tar.bz2
scummvm-rg350-4675d193510d4e8191330132b6d58bc85ac5ac5a.zip
Graphics tweaks
svn-id: r10729
Diffstat (limited to 'queen')
-rw-r--r--queen/graphics.cpp28
-rw-r--r--queen/graphics.h5
-rw-r--r--queen/logic.cpp7
-rw-r--r--queen/logic.h6
4 files changed, 23 insertions, 23 deletions
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 0d65ffcfdb..06eb2ce802 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -19,7 +19,9 @@
*
*/
+#include "stdafx.h"
#include "queen/graphics.h"
+#include "queen/resource.h"
namespace Queen {
@@ -272,7 +274,6 @@ Graphics::Graphics(Resource *resource)
memset(_bobs, 0, sizeof(_bobs));
memset(_sortedBobs, 0, sizeof(_sortedBobs));
_sortedBobsCount = 0;
- memset(_texts, 0, sizeof(_texts));
_shrinkBuffer.data = new uint8[ BOB_SHRINK_BUF_SIZE ];
_backdrop = new uint8[ BACKDROP_W * BACKDROP_H ];
_panel = new uint8[ PANEL_W * PANEL_H ];
@@ -782,10 +783,7 @@ void Graphics::textSet(uint16 x, uint16 y, const char *text, bool outlined) {
pts->x = x;
pts->color = _curTextColor;
pts->outlined = outlined;
- if (pts->text != NULL) {
- free(pts->text);
- }
- pts->text = strdup(text);
+ pts->text = text;
}
}
@@ -794,7 +792,7 @@ void Graphics::textDrawAll() {
int y;
for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
const TextSlot *pts = &_texts[y];
- if (pts->text != NULL) {
+ if (!pts->text.isEmpty()) {
displayText(pts, y);
}
}
@@ -804,16 +802,13 @@ void Graphics::textDrawAll() {
void Graphics::textClear(uint16 y1, uint16 y2) {
while (y1 <= y2) {
- if (_texts[y1].text != NULL) {
- free(_texts[y1].text);
- _texts[y1].text = NULL;
- }
+ _texts[y1].text.clear();
++y1;
}
}
-uint16 Graphics::textLength(const char* text) {
+uint16 Graphics::textWidth(const char* text) const {
uint16 len = 0;
while (*text) {
@@ -866,10 +861,6 @@ void Graphics::backdropLoad(const char* name, uint16 room) {
_backdropWidth = READ_LE_UINT16(pcxbuf + 12);
_backdropHeight = READ_LE_UINT16(pcxbuf + 14);
- if (_backdropHeight == 150) {
- _fullscreen = false;
- }
-
if (room >= 90) {
_cameraBob = 0;
}
@@ -916,6 +907,11 @@ void Graphics::panelDraw() {
}
+void Graphics::panelClear() {
+ memset(_screen + SCREEN_W * ROOM_ZONE_HEIGHT, 0, PANEL_W * PANEL_H);
+}
+
+
void Graphics::readPCX(const uint8 *src, uint8 *dst, uint16 dstPitch, uint16 w, uint16 h) {
while (h--) {
@@ -1024,7 +1020,7 @@ void Graphics::update() {
void Graphics::displayText(const TextSlot *pts, uint16 y) {
uint16 x = pts->x;
- uint8 *str = (uint8*)pts->text;
+ const uint8 *str = (const uint8*)pts->text.c_str();
while (*str && x < GAME_SCREEN_WIDTH) {
const uint8 *pchr = FONT + (*str) * 8;
// if (_resource->_gameVersion->versionString[1] == 'F' && *str == 150) {
diff --git a/queen/graphics.h b/queen/graphics.h
index ee0c97dab6..3f29d98652 100644
--- a/queen/graphics.h
+++ b/queen/graphics.h
@@ -96,7 +96,7 @@ struct BobSlot {
struct TextSlot {
uint16 x;
uint8 color;
- char *text;
+ Common::String text;
bool outlined;
};
@@ -132,7 +132,7 @@ public:
void textSet(uint16 x, uint16 y, const char *text, bool outlined = true); // text()
void textDrawAll(); // drawtext()
void textClear(uint16 y1, uint16 y2); // blanktexts()
- uint16 textLength(const char* text); // textlen()
+ uint16 textWidth(const char* text) const; // textlen()
void frameErase(uint32 fslot);
void frameEraseAll(bool joe); // freeframes, freeallframes
@@ -142,6 +142,7 @@ public:
void panelLoad(); // loadpanel
void panelDraw();
+ void panelClear();
void boxDraw(const Box &b, uint8 color);
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 41f7782459..c0e9fae986 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -24,8 +24,8 @@
namespace Queen {
-Logic::Logic(Resource *resource)
- : _maxAnimatedFrame(0), _maxStaticFrame(0), _resource(resource) {
+Logic::Logic(Resource *resource, Graphics *graphics)
+ : _maxAnimatedFrame(0), _maxStaticFrame(0), _resource(resource), _graphics(graphics) {
_jas = _resource->loadFile("QUEEN.JAS", 20);
_joe.x = _joe.y = 0;
initialise();
@@ -264,7 +264,7 @@ WalkOffData *Logic::walkOffData(int index) {
return &_walkOffData[index];
}
-GraphicData *Logic::findGraphic(int index) {
+GraphicData *Logic::graphicData(int index) {
return &_graphicData[index];
}
@@ -457,6 +457,7 @@ uint16 Logic::objectForPerson(uint16 bobNum) {
if (bobcur == bobNum) {
return cur;
}
+ ++cur;
}
return 0;
}
diff --git a/queen/logic.h b/queen/logic.h
index 86f6831bd0..b4d48c58da 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -45,11 +45,12 @@ struct ZoneSlot {
class Graphics;
+class Resource;
class Logic {
public:
- Logic(Resource *resource);
+ Logic(Resource *resource, Graphics *graphics);
~Logic();
uint16 currentRoom();
@@ -58,7 +59,7 @@ public:
ObjectData* objectData(int index);
uint16 roomData(int room);
uint16 objMax(int room);
- GraphicData* findGraphic(int index);
+ GraphicData* graphicData(int index);
uint16 findBob(uint16 obj); // FIXME: move that to QueenDisplay ?
uint16 findFrame(uint16 obj); // FIXME: move that to QueenDisplay ?
@@ -145,6 +146,7 @@ protected:
uint16 _maxAnimatedFrame, _maxStaticFrame, _maxAnimatedFrameLen; // FMAXA, FMAX, FMAXALEN
Resource *_resource;
+ Graphics *_graphics;
void initialise();
};