aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/prince/hero.h5
-rw-r--r--engines/prince/mob.h4
-rw-r--r--engines/prince/prince.cpp67
-rw-r--r--engines/prince/prince.h19
4 files changed, 90 insertions, 5 deletions
diff --git a/engines/prince/hero.h b/engines/prince/hero.h
index 5b8391c10c..31ffac3b6a 100644
--- a/engines/prince/hero.h
+++ b/engines/prince/hero.h
@@ -35,6 +35,7 @@ namespace Prince {
class Animation;
class PrinceEngine;
class GraphicsMan;
+struct InventoryItem;
class Hero {
public:
@@ -173,8 +174,8 @@ public:
uint16 _currHeight; // height of current anim phase
- // Inventory array of items
- // Inventory2 array of items
+ Common::Array<int> _inventory; // Inventory array of items
+ Common::Array<int> _inventory2; // Inventory2 array of items
// Font subtitiles font
// Color subtitiles color
// AnimSet number of animation set
diff --git a/engines/prince/mob.h b/engines/prince/mob.h
index 36630eb6eb..1c095c2fc4 100644
--- a/engines/prince/mob.h
+++ b/engines/prince/mob.h
@@ -66,6 +66,10 @@ public:
bool _visible;
uint16 _type;
+ uint16 _x1; // initialize this?
+ uint16 _y1;
+ uint16 _x2;
+ uint16 _y2;
uint16 _mask;
Common::Rect _rect;
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 529e17d7fd..346342462d 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -78,7 +78,8 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)
Engine(syst), _gameDescription(gameDesc), _graph(nullptr), _script(nullptr), _interpreter(nullptr), _flags(nullptr),
_locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr), testAnimNr(0), testAnimFrame(0),
_frameNr(0), _cursor1(nullptr), _cursor2(nullptr), _font(nullptr),
- _suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince") {
+ _suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince"),
+ _invLineX(134), _invLineY(176), _invLine(5), _invLines(3), _invLineW(70), _invLineH(76), _invLineSkipX(2), _invLineSkipY(3) {
// Debug/console setup
DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
@@ -107,6 +108,7 @@ PrinceEngine::~PrinceEngine() {
delete _suitcaseBmp;
delete _variaTxt;
delete[] _talkTxt;
+ delete[] _invTxt;
delete _graph;
delete _room;
@@ -206,6 +208,17 @@ void PrinceEngine::init() {
delete talkTxtStream;
+ Common::SeekableReadStream *invTxtStream = SearchMan.createReadStreamForMember("invtxt.dat");
+ if (!invTxtStream) {
+ error("Can't load invTxtStream");
+ return;
+ }
+ _invTxtSize = invTxtStream->size();
+ _invTxt = new byte[_invTxtSize];
+ invTxtStream->read(_invTxt, _invTxtSize);
+
+ delete invTxtStream;
+
_roomBmp = new Image::BitmapDecoder();
_room = new Room();
@@ -1141,7 +1154,7 @@ void PrinceEngine::drawScreen() {
_graph->draw(0, 0, &visiblePart);
}
- Graphics::Surface *mainHeroSurface;
+ Graphics::Surface *mainHeroSurface = NULL;
if (_mainHero->_visible) {
mainHeroSurface = _mainHero->getSurface();
if (mainHeroSurface) {
@@ -1201,6 +1214,56 @@ void PrinceEngine::drawScreen() {
_graph->update();
}
+void PrinceEngine::rememberScreenInv() {
+
+}
+
+void PrinceEngine::prepareInventoryToView() {
+ int invItem = _mainHero->_inventory.size();
+ _invLine = invItem / 3;
+ if (invItem % 3 != 0) {
+ _invLine++;
+ }
+ if (_invLine < 4) {
+ _invLine = 4;
+ }
+ _maxInvW = (374 - 2 * _invLine) / _invLine;
+ _invLineW = _maxInvW - 2;
+
+ rememberScreenInv();
+
+ int currInvX = _invLineX;
+ int currInvY = _invLineY;
+
+ int item = 0;
+ for (int i = 0 ; i < _invLines; i++) {
+ for (int j = 0; j < _invLine; j++) {
+ Mob tempMobItem;
+ tempMobItem._mask = _mainHero->_inventory[item] - 1;
+ tempMobItem._x1 = currInvX + _picWindowX; //picWindowX2 ?
+ tempMobItem._x2 = currInvX + _picWindowX + _invLineW - 1; // picWindowX2 ?
+ tempMobItem._y1 = currInvY;
+ tempMobItem._y2 = currInvY + _invLineH - 1;
+ //tempMobItem._name = ;
+ //tempMobItem._examText = ;
+ _invMobList.push_back(tempMobItem);
+ currInvX += _invLineW + _invLineSkipX;
+ item++;
+ }
+ currInvX = _invLineX;
+ currInvY += _invLineSkipY + _invLineH;
+ }
+ //moblistcreated:
+ //mov w [edi.Mob_Visible],-1
+ //mov eax,d InvMobList
+ //mov d MobListAddr,eax
+ //mov d MobPriAddr,o InvMobPri
+}
+
+void PrinceEngine::displayInventory() {
+
+}
+
void PrinceEngine::mainLoop() {
changeCursor(0);
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index 41281dc64e..4e1073b375 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -265,6 +265,23 @@ public:
void showMask(int maskNr, Graphics::Surface *originalRoomSurface);
void clsMasks();
+ uint32 _invTxtSize;
+ byte *_invTxt;
+
+ int _invLineX;
+ int _invLineY;
+ int _invLine;
+ int _invLines;
+ int _invLineW;
+ int _invLineH;
+ int _maxInvW;
+ int _invLineSkipX;
+ int _invLineSkipY;
+
+ void rememberScreenInv();
+ void prepareInventoryToView();
+ void displayInventory();
+
int testAnimNr;
int testAnimFrame;
@@ -316,8 +333,8 @@ private:
Common::Array<Mob> _mobList;
Common::Array<Object *> _objList;
Common::Array<Mask> _maskList;
-
Common::Array<DrawNode> _drawNodeList;
+ Common::Array<Mob> _invMobList;
bool _flicLooped;