aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/prince/animation.cpp5
-rw-r--r--engines/prince/animation.h1
-rw-r--r--engines/prince/hero.cpp6
-rw-r--r--engines/prince/hero.h8
-rw-r--r--engines/prince/prince.cpp20
-rw-r--r--engines/prince/prince.h1
6 files changed, 25 insertions, 16 deletions
diff --git a/engines/prince/animation.cpp b/engines/prince/animation.cpp
index 0aa5d464d1..a4df4e30cc 100644
--- a/engines/prince/animation.cpp
+++ b/engines/prince/animation.cpp
@@ -57,11 +57,6 @@ void Animation::clear() {
}
}
-// TEMP
-int16 Animation::getZoom(uint16 offset) const {
- return READ_LE_UINT16(_data + offset);
-}
-
// AH_Loop
int16 Animation::getLoopCount() const {
return READ_LE_UINT16(_data + 2);
diff --git a/engines/prince/animation.h b/engines/prince/animation.h
index 941f1ba6dd..acf689e05f 100644
--- a/engines/prince/animation.h
+++ b/engines/prince/animation.h
@@ -48,7 +48,6 @@ public:
Graphics::Surface *getFrame(uint frameIndex);
int16 getFrameWidth(uint frameIndex) const;
int16 getFrameHeight(uint frameIndex) const;
- int16 getZoom(uint16 offset) const;
void clear();
private:
diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp
index 6576901838..b8e5780a4c 100644
--- a/engines/prince/hero.cpp
+++ b/engines/prince/hero.cpp
@@ -39,13 +39,13 @@ Hero::Hero(PrinceEngine *vm, GraphicsMan *graph) : _vm(vm), _graph(graph)
, _shadZoomFactor(0), _shadScaleValue(0), _shadLineLen(0), _shadDrawX(0), _shadDrawY(0)
, _frameXSize(0), _frameYSize(0), _scaledFrameXSize(0), _scaledFrameYSize(0)
{
- _zoomBitmap = new Animation();
+ _zoomBitmap = (byte *)malloc(kZoomBitmapLen);
_shadowBitmap = (byte *)malloc(2 * kShadowBitmapSize);
_shadowLine = new byte[kShadowLineArraySize];
}
Hero::~Hero() {
- delete _zoomBitmap;
+ free(_zoomBitmap);
free(_shadowBitmap);
delete[] _shadowLine;
}
@@ -552,7 +552,7 @@ void Hero::setScale(int8 zoomBitmapValue) {
}
void Hero::selectZoom() {
- int8 zoomBitmapValue = _zoomBitmap->getZoom(_middleY / 4 * kZoomBitmapWidth + _middleX / 4);
+ int8 zoomBitmapValue = *(_zoomBitmap + _middleY / 4 * kZoomBitmapWidth + _middleX / 4);
setScale(zoomBitmapValue);
}
diff --git a/engines/prince/hero.h b/engines/prince/hero.h
index 00a81bdc7e..839907a574 100644
--- a/engines/prince/hero.h
+++ b/engines/prince/hero.h
@@ -38,11 +38,13 @@ class GraphicsMan;
class Hero {
public:
- static const uint32 kMoveSetSize = 26;
- static const int16 kZoomStep = 4;
static const int16 kMaxPicWidth = 1280;
static const int16 kMaxPicHeight = 480;
+ static const uint32 kMoveSetSize = 26;
+ static const int16 kZoomStep = 4;
+ static const int32 kZoomBitmapLen = kMaxPicHeight / kZoomStep * kMaxPicWidth / kZoomStep;
static const int16 kZoomBitmapWidth = kMaxPicWidth / kZoomStep;
+ static const int16 kZoomBitmapHeight = kMaxPicHeight / kZoomStep;
static const int16 kShadowLineArraySize = 2 * 1280 * 4;
static const int32 kShadowBitmapSize = kMaxPicWidth * kMaxPicHeight / 8;
static const int16 kScreenWidth = 640;
@@ -178,7 +180,7 @@ public:
// AnimSet number of animation set
Common::Array<Animation *> _moveSet; // MoveAnims MoveSet
// TurnAnim ??
- Animation *_zoomBitmap; // change to sth else, not Animation ??
+ byte *_zoomBitmap;
byte *_shadowBitmap;
byte *_shadowLine;
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 74c9820e6a..5e1b49e48e 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -296,9 +296,7 @@ bool PrinceEngine::loadLocation(uint16 locationNr) {
_graph->setPalette(_roomBmp->getPalette());
}
- _mainHero->_zoomBitmap->clear();
- Resource::loadResource(_mainHero->_zoomBitmap, "zoom", false);
-
+ loadZoom(_mainHero->_zoomBitmap, _mainHero->kZoomBitmapLen, "zoom");
loadShadow(_mainHero->_shadowBitmap, _mainHero->kShadowBitmapSize, "shadow", "shadow2");
_picWindowX = 0;
@@ -475,8 +473,22 @@ bool PrinceEngine::loadAnim(uint16 animNr, bool loop) {
return true;
}
-bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *resourceName1, const char *resourceName2) {
+bool PrinceEngine::loadZoom(byte *zoomBitmap, uint32 dataSize, const char *resourceName) {
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
+ if (!stream) {
+ delete stream;
+ return false;
+ }
+ if (stream->read(zoomBitmap, dataSize) != dataSize) {
+ free(zoomBitmap);
+ delete stream;
+ return false;
+ }
+ delete stream;
+ return true;
+}
+bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *resourceName1, const char *resourceName2) {
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName1);
if (!stream) {
delete stream;
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index 5a32f8e580..8b840d3cab 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -176,6 +176,7 @@ public:
bool loadAnim(uint16 animNr, bool loop);
bool loadVoice(uint32 textSlot, uint32 sampleSlot, const Common::String &name);
bool loadSample(uint32 sampleSlot, const Common::String &name);
+ bool loadZoom(byte *zoomBitmap, uint32 dataSize, const char *resourceName);
bool loadShadow(byte *shadowBitmap, uint32 dataSize, const char *resourceName1, const char *resourceName2);
void playSample(uint16 sampleId, uint16 loopType);