Skip to content

Commit

Permalink
PRINCE: Map location update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jul 22, 2014
1 parent b6d8101 commit 2ffc9e1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
10 changes: 7 additions & 3 deletions engines/prince/debugger.cpp
Expand Up @@ -160,9 +160,13 @@ bool Debugger::Cmd_AddItem(int argc, const char **argv) {
DebugPrintf("Usage: %s <itemId>\n", argv[0]);
return true;
}

int itemId = strToInt(argv[1]);
_vm->addInv(0, itemId, true);
if (!strcmp(argv[1], "map")) {
_vm->addInv(0, 29, true);
_vm->_flags->setFlagValue(Flags::MapaUsable, 1);
} else {
int itemId = strToInt(argv[1]);
_vm->addInv(0, itemId, true);
}

return true;
}
Expand Down
4 changes: 4 additions & 0 deletions engines/prince/graphics.cpp
Expand Up @@ -39,6 +39,8 @@ GraphicsMan::GraphicsMan(PrinceEngine *vm)
_frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
_screenForInventory = new Graphics::Surface();
_screenForInventory->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
_mapScreen = new Graphics::Surface();
_mapScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
_shadowTable70 = new byte[256];
_shadowTable50 = new byte[256];
}
Expand All @@ -48,6 +50,8 @@ GraphicsMan::~GraphicsMan() {
delete _frontScreen;
_screenForInventory->free();
delete _screenForInventory;
_mapScreen->free();
delete _mapScreen;
delete[] _shadowTable70;
delete[] _shadowTable50;
}
Expand Down
1 change: 1 addition & 0 deletions engines/prince/graphics.h
Expand Up @@ -57,6 +57,7 @@ class GraphicsMan {

Graphics::Surface *_frontScreen;
Graphics::Surface *_screenForInventory;
Graphics::Surface *_mapScreen;
const Graphics::Surface *_roomBackground;

byte *_shadowTable70;
Expand Down
7 changes: 2 additions & 5 deletions engines/prince/object.cpp
Expand Up @@ -67,12 +67,9 @@ bool Object::loadFromStream(Common::SeekableReadStream &stream) {

const Common::String obStreamName = Common::String::format("OB%02d", stream.readUint16LE());
Common::SeekableReadStream *obStream = SearchMan.createReadStreamForMember(obStreamName);
if (!obStream) {
//error("Can't load %s", obStreamName.c_str());
return false;
if (obStream) {
loadSurface(*obStream);
}

loadSurface(*obStream);
delete obStream;

_mask = stream.readUint16LE();
Expand Down
12 changes: 10 additions & 2 deletions engines/prince/prince.cpp
Expand Up @@ -1467,7 +1467,10 @@ void PrinceEngine::clearBackAnimList() {
}

void PrinceEngine::grabMap() {
//TODO
_graph->_frontScreen->copyFrom(*_roomBmp->getSurface());
showObjects();
runDrawNodes();
_graph->_mapScreen->copyFrom(*_graph->_frontScreen);
}

void PrinceEngine::initZoomIn(int slot) {
Expand Down Expand Up @@ -1571,7 +1574,12 @@ void PrinceEngine::freeDrawNodes() {

void PrinceEngine::drawScreen() {
if (!_showInventoryFlag || _inventoryBackgroundRemember) {
const Graphics::Surface *roomSurface = _roomBmp->getSurface();
const Graphics::Surface *roomSurface;
if (_locationNr != 50) {
roomSurface = _roomBmp->getSurface();
} else {
roomSurface = _graph->_mapScreen;
}
Graphics::Surface visiblePart;
if (roomSurface) {
visiblePart = roomSurface->getSubArea(Common::Rect(_picWindowX, 0, roomSurface->w, roomSurface->h));
Expand Down

0 comments on commit 2ffc9e1

Please sign in to comment.