aboutsummaryrefslogtreecommitdiff
path: root/engines/prince
diff options
context:
space:
mode:
authorlukaslw2014-06-01 02:58:27 +0200
committerlukaslw2014-06-22 20:08:31 +0200
commit6f19bd82f48ffb7c9f772c8b3112449df36ce6eb (patch)
treeda4a238633cc5f29598a1e9c10800a4cb8976099 /engines/prince
parent9933505bf5ed72894bfa696ae5b2d4085dc1c242 (diff)
downloadscummvm-rg350-6f19bd82f48ffb7c9f772c8b3112449df36ce6eb.tar.gz
scummvm-rg350-6f19bd82f48ffb7c9f772c8b3112449df36ce6eb.tar.bz2
scummvm-rg350-6f19bd82f48ffb7c9f772c8b3112449df36ce6eb.zip
PRINCE: Object class update, showObjects() beginning
Diffstat (limited to 'engines/prince')
-rw-r--r--engines/prince/graphics.cpp1
-rw-r--r--engines/prince/object.cpp8
-rw-r--r--engines/prince/object.h10
-rw-r--r--engines/prince/prince.cpp49
-rw-r--r--engines/prince/prince.h2
5 files changed, 58 insertions, 12 deletions
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp
index 46c52a86ca..679885f7b8 100644
--- a/engines/prince/graphics.cpp
+++ b/engines/prince/graphics.cpp
@@ -101,6 +101,7 @@ void GraphicsMan::drawMask(int32 posX, int32 posY, int32 width, int32 height, by
if ((maskData[tempMaskPostion] & maskCounter) != 0) {
byte orgPixel = *((byte*)originalRoomSurface->getBasePtr(x + posX, y + posY));
*((byte*)_frontScreen->getBasePtr(x + posX, y + posY)) = orgPixel;
+ //*((byte*)_frontScreen->getBasePtr(x + posX, y + posY)) = 0; // for debugging
}
}
}
diff --git a/engines/prince/object.cpp b/engines/prince/object.cpp
index 9386eaa496..11c553ffbc 100644
--- a/engines/prince/object.cpp
+++ b/engines/prince/object.cpp
@@ -32,7 +32,9 @@
namespace Prince {
-Object::Object() : _surface(NULL), _x(0), _y(0), _z(0), _overlay(0) {
+Object::Object() : _surface(NULL), _x(0), _y(0), _z(0), _mask(0),
+ _zoomInSource(0), _zoomInLen(0), _zoomInAddr(0), _zoomInTime(0)
+{
}
Object::~Object() {
@@ -73,12 +75,12 @@ bool Object::loadFromStream(Common::SeekableReadStream &stream) {
loadSurface(*obStream);
delete obStream;
- _overlay = stream.readUint16LE();
+ _mask = stream.readUint16LE();
_z = stream.readUint16LE();
stream.seek(pos + 16);
- debug("Object x %d, y %d, z %d overlay %d", _x, _y, _z, _overlay);
+ debug("Object x %d, y %d, z %d overlay %d", _x, _y, _z, _mask);
return true;
}
diff --git a/engines/prince/object.h b/engines/prince/object.h
index 66f2a725f8..5bc7c580da 100644
--- a/engines/prince/object.h
+++ b/engines/prince/object.h
@@ -33,9 +33,17 @@ public:
Object();
~Object();
+ int32 _x;
+ int32 _y;
+ int32 _z;
+ int32 _mask; // or flags
+ int32 _zoomInSource;
+ int32 _zoomInLen;
+ int32 _zoomInAddr;
+ int32 _zoomInTime;
+
bool loadFromStream(Common::SeekableReadStream &stream);
const Graphics::Surface *getSurface() const { return _surface; }
- uint16 _x, _y, _z, _overlay;
private:
void loadSurface(Common::SeekableReadStream &stream);
Graphics::Surface *_surface;
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 6a65ee162b..a82fe9569d 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -977,6 +977,44 @@ void PrinceEngine::clearBackAnimList() {
_backAnimList.clear();
}
+void PrinceEngine::showObjects() {
+ if (!_objList.empty()) {
+ for (uint i = 0; i < _objList.size(); i++) {
+ if ((_objList[i]->_mask & 32768) != 0) { // 8000h
+ _objList[i]->_zoomInTime--;
+ if (_objList[i]->_zoomInTime == 0) {
+ _objList[i]->_mask &= 32767; //7FFFh
+ } else {
+ // doZoomIn();
+ // mov edx, d [esi.Obj_ZoomInAddr]
+ }
+ }
+ if ((_objList[i]->_mask & 16384) != 0) { // 4000h
+ _objList[i]->_zoomInTime--;
+ if (_objList[i]->_zoomInTime == 0) {
+ _objList[i]->_mask &= 49151; //0BFFFh
+ } else {
+ // doZoomOut();
+ // mov edx, d [esi.Obj_ZoomInAddr]
+ }
+ }
+ const Graphics::Surface *objSurface = _objList[i]->getSurface();
+ if (spriteCheck(objSurface->w, objSurface->h, _objList[i]->_x, _objList[i]->_y)) {
+ if ((_objList[i]->_mask & 512) == 0) { // 0200h
+ int destX = _objList[i]->_x - _picWindowX;
+ int destY = _objList[i]->_y - _picWindowY;
+ _graph->drawTransparent(destX, destY, objSurface);
+ } else {
+ // showBackSprite();
+ }
+ }
+ if ((_objList[i]->_mask & 1) != 0) {
+ checkMasks(_objList[i]->_x, _objList[i]->_y, objSurface->w, objSurface->h, _objList[i]->_z);
+ }
+ }
+ }
+}
+
void PrinceEngine::drawScreen() {
const Graphics::Surface *roomSurface = _roomBmp->getSurface();
Graphics::Surface visiblePart;
@@ -1002,15 +1040,10 @@ void PrinceEngine::drawScreen() {
delete mainHeroSurface;
}
- /*
- if (!_objList.empty()) {
- for (int i = 0; i < _objList.size(); i++) {
- _graph->drawTransparent(_objList[i]->_x, _objList[i]->_y, _objList[i]->getSurface());
- }
- }
- */
-
showBackAnims();
+
+ showObjects();
+
if (roomSurface) {
insertMasks(&visiblePart);
}
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index 443a5bd148..15dfdb4b7b 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -171,6 +171,7 @@ struct Mask {
int16 getHeight() const {
return READ_LE_UINT16(_data + 6);
}
+
byte *getMask() const {
return (byte *)(_data + 8);
}
@@ -266,6 +267,7 @@ private:
bool spriteCheck(int sprWidth, int sprHeight, int destX, int destY);
void showSprite(Graphics::Surface *backAnimSurface, int destX, int destY);
void showSpriteShadow(Graphics::Surface *shadowSurface, int destX, int destY);
+ void showObjects();
void makeShadowTable(int brightness);
uint32 getTextWidth(const char *s);