Skip to content

Commit

Permalink
PRINCE: dialogDat loading
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jul 3, 2014
1 parent e853e44 commit a9a8eb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion engines/prince/prince.cpp
Expand Up @@ -117,6 +117,7 @@ PrinceEngine::~PrinceEngine() {
delete _variaTxt;
delete[] _talkTxt;
delete[] _invTxt;
delete[] _dialogDat;
delete _graph;
delete _room;

Expand Down Expand Up @@ -255,6 +256,17 @@ void PrinceEngine::init() {

loadAllInv();

Common::SeekableReadStream *dialogDatStream = SearchMan.createReadStreamForMember("dialog.dat");
if (!dialogDatStream) {
error("Can't load dialogDatStream");
return;
}
_dialogDatSize = dialogDatStream->size();
_dialogDat = new byte[_dialogDatSize];
dialogDatStream->read(_dialogDat, _dialogDatSize);

delete dialogDatStream;

_optionsPic = new Graphics::Surface();
_optionsPic->create(_optionsWidth, _optionsHeight, Graphics::PixelFormat::createFormatCLUT8());
Common::Rect picRect(0, 0, _optionsWidth, _optionsHeight);
Expand Down Expand Up @@ -2369,7 +2381,7 @@ void PrinceEngine::doTalkAnim(int animNumber, int slot, AnimType animType) {
}
}
} else if (animType == kBackgroundAnimation) {
if (animNumber < _backAnimList.size()) {
if ((uint)animNumber < _backAnimList.size()) {
int currAnim = _backAnimList[animNumber]._seq._currRelative;
Anim &backAnim = _backAnimList[animNumber].backAnims[currAnim];
if (backAnim._animData != nullptr) {
Expand Down
3 changes: 3 additions & 0 deletions engines/prince/prince.h
Expand Up @@ -398,6 +398,9 @@ class PrinceEngine : public Engine {
void inventoryRightMouseButton();
void dialogLeftMouseButton(int dialogSelected, const char *s);

uint32 _dialogDatSize;
byte *_dialogDat;

bool _dialogFlag;
int _dialogWidth;
int _dialogHeight;
Expand Down

0 comments on commit a9a8eb0

Please sign in to comment.