diff options
author | Andrew Kurushin | 2005-04-03 15:32:04 +0000 |
---|---|---|
committer | Andrew Kurushin | 2005-04-03 15:32:04 +0000 |
commit | 8ea88c95d663fac08a1492c2d3c7138e7392dbbc (patch) | |
tree | 60869aa13063d9dcff93ade2a4f7fd3992d4fef8 /saga | |
parent | b507231f7135f0af2a27b047f1982685736e0e7b (diff) | |
download | scummvm-rg350-8ea88c95d663fac08a1492c2d3c7138e7392dbbc.tar.gz scummvm-rg350-8ea88c95d663fac08a1492c2d3c7138e7392dbbc.tar.bz2 scummvm-rg350-8ea88c95d663fac08a1492c2d3c7138e7392dbbc.zip |
- fixed tile doors drawing
- right mouse action fixed
svn-id: r17347
Diffstat (limited to 'saga')
-rw-r--r-- | saga/isomap.cpp | 23 | ||||
-rw-r--r-- | saga/isomap.h | 3 | ||||
-rw-r--r-- | saga/music.cpp | 2 | ||||
-rw-r--r-- | saga/objectmap.cpp | 21 | ||||
-rw-r--r-- | saga/render.cpp | 6 | ||||
-rw-r--r-- | saga/saga.cpp | 2 | ||||
-rw-r--r-- | saga/script.cpp | 10 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 7 | ||||
-rw-r--r-- | saga/sthread.cpp | 2 |
9 files changed, 54 insertions, 22 deletions
diff --git a/saga/isomap.cpp b/saga/isomap.cpp index 63d77a7cbe..484ee5ef3b 100644 --- a/saga/isomap.cpp +++ b/saga/isomap.cpp @@ -230,7 +230,7 @@ void IsoMap::loadMulti(const byte * resourcePointer, size_t resourceLength) { if (_multiTable == NULL) { memoryError("IsoMap::loadMulti"); } - debug(0,"resourceLength=%d but should be %d",resourceLength, 14*_multiCount + 2); + for (i = 0; i < _multiCount; i++) { multiTileEntryData = &_multiTable[i]; readS.readUint32();//skip @@ -370,7 +370,6 @@ int16 IsoMap::findMulti(int16 tileIndex, int16 absU, int16 absV, int16 absH) { warning("something terrible happened"); return 1; } - return tileIndex; } } @@ -606,7 +605,7 @@ void IsoMap::drawSpritePlatform(SURFACE *ds, uint16 platformIndex, const Point & int16 u, v; Point s; Point s0; - int16 tileIndex; + uint16 tileIndex; Location copyLocation(location); if (_tilePlatformsCount <= platformIndex) { @@ -646,7 +645,7 @@ void IsoMap::drawSpritePlatform(SURFACE *ds, uint16 platformIndex, const Point & tileIndex = tilePlatform->tiles[u][v]; if (tileIndex != 0) { if (tileIndex & SAGA_MULTI_TILE) { - tileIndex = findMulti(tileIndex, absU + u, absU + v, absH); + tileIndex = findMulti(tileIndex, absU + u, absV + v, absH); } drawTile(ds, tileIndex, s, ©Location); @@ -661,7 +660,7 @@ void IsoMap::drawPlatform(SURFACE *ds, uint16 platformIndex, const Point &point, int16 u, v; Point s; Point s0; - int16 tileIndex; + uint16 tileIndex; if (_tilePlatformsCount <= platformIndex) { error("IsoMap::drawPlatform wrong platformIndex"); @@ -698,7 +697,7 @@ void IsoMap::drawPlatform(SURFACE *ds, uint16 platformIndex, const Point &point, tileIndex = tilePlatform->tiles[u][v]; if (tileIndex > 1) { if (tileIndex & SAGA_MULTI_TILE) { - tileIndex = findMulti(tileIndex, absU + u, absU + v, absH); + tileIndex = findMulti(tileIndex, absU + u, absV + v, absH); } drawTile(ds, tileIndex, s, NULL); @@ -1342,6 +1341,17 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio } } +void IsoMap::setTileDoorState(int doorNumber, int doorState) { + MultiTileEntryData *multiTileEntryData; + + if ((doorNumber < 0) || (doorNumber >= _multiCount)) { + error("setTileDoorState: doorNumber >= _multiCount"); + } + + multiTileEntryData = &_multiTable[doorNumber]; + multiTileEntryData->currentState = doorState; +} + static const int16 directions[8][2] = { { 16, 16}, { 16, 0}, @@ -1354,6 +1364,7 @@ static const int16 directions[8][2] = { }; + bool IsoMap::nextTileTarget(ActorData* actor) { uint16 dir; diff --git a/saga/isomap.h b/saga/isomap.h index ebb8aa083c..971d53ba52 100644 --- a/saga/isomap.h +++ b/saga/isomap.h @@ -166,7 +166,8 @@ public: void placeOnTileMap(const Location &start, Location &result, int16 distance, uint16 direction); void findTilePath(ActorData* actor, const Location &start, const Location &end); bool nextTileTarget(ActorData* actor); - + void setTileDoorState(int doorNumber, int doorState); + private: void drawTiles(SURFACE *ds, const Location *location); void drawMetaTile(SURFACE *ds, uint16 metaTileIndex, const Point &point, int16 absU, int16 absV); diff --git a/saga/music.cpp b/saga/music.cpp index 0e239fa81c..70fe3b0c8f 100644 --- a/saga/music.cpp +++ b/saga/music.cpp @@ -268,7 +268,7 @@ void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) { stopMusic(); break; default: - warning("Unhandled meta event: %02x", type); + //warning("Unhandled meta event: %02x", type); break; } } diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp index 4a037e98c0..0ba295ce35 100644 --- a/saga/objectmap.cpp +++ b/saga/objectmap.cpp @@ -133,13 +133,26 @@ bool HitZone::hitTest(const Point &testPoint) { } void HitZone::draw(SURFACE *ds, int color) { - int i, pointsCount; + int i, pointsCount, j; + Location location; HitZone::ClickArea *clickArea; Point *points; for (i = 0; i < _clickAreasCount; i++) { clickArea = &_clickAreas[i]; pointsCount = clickArea->pointsCount; - points = clickArea->points; + if (_vm->_scene->getFlags() & kSceneFlagISO) { + points = (Point*)malloc(sizeof(Point) * pointsCount); + for (j = 0; j < pointsCount; j++) { + location.u() = clickArea->points[j].x; + location.v() = clickArea->points[j].y; + location.z = 0; + _vm->_isoMap->tileCoordsToScreenPoint(location, points[j]); + } + // + } else { + points = clickArea->points; + } + if (pointsCount == 2) { // 2 points represent a box drawFrame(ds, &points[0], &points[1], color); @@ -149,6 +162,10 @@ void HitZone::draw(SURFACE *ds, int color) { drawPolyLine(ds, points, pointsCount, color); } } + if (_vm->_scene->getFlags() & kSceneFlagISO) { + free(points); + } + } } diff --git a/saga/render.cpp b/saga/render.cpp index 457168ca28..d10c9e8671 100644 --- a/saga/render.cpp +++ b/saga/render.cpp @@ -124,15 +124,15 @@ int Render::drawScene() { if (_vm->_interface->getMode() != kPanelFade) { // Display scene maps, if applicable + + // Draw queued actors + _vm->_actor->drawActors(); if (getFlags() & RF_OBJECTMAP_TEST) { if (_vm->_scene->_objectMap) _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, kITEColorBrightWhite, kITEColorBlack); if (_vm->_scene->_actionMap) _vm->_scene->_actionMap->draw(backbuf_surface, mouse_pt, kITEColorRed, kITEColorBlack); } - - // Draw queued actors - _vm->_actor->drawActors(); if (getFlags() & RF_ACTOR_PATH_TEST) { _vm->_actor->drawPathTest(); } diff --git a/saga/saga.cpp b/saga/saga.cpp index 52882b2df5..9aeba8cd8a 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -390,7 +390,7 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin error("SagaEngine::loadStrings wrong strings table"); } stringsTable.strings[i] = (const char *)stringsTable.stringsPointer + offset; - debug(9, "string[%i]=%s", i, stringsTable.strings[i]); + //debug(9, "string[%i]=%s", i, stringsTable.strings[i]); i++; } stringsTable.stringsCount = stringsCount; diff --git a/saga/script.cpp b/saga/script.cpp index 7f65c8c696..f1f6e13734 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -743,10 +743,12 @@ void Script::whichObject(const Point& mousePoint) { newRightButtonVerb = _leftButtonVerb = kVerbWalkTo; } } else { - if (_firstObjectSet) { - objectId = ID_NOTHING; - } else { - newRightButtonVerb = _leftButtonVerb = kVerbLookAt; + if (newRightButtonVerb == kVerbLookOnly) { + if (_firstObjectSet) { + objectId = ID_NOTHING; + } else { + newRightButtonVerb = _leftButtonVerb = kVerbLookAt; + } } } diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index cd97643057..53bb5077e8 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -42,6 +42,7 @@ #include "saga/objectmap.h" #include "saga/scene.h" +#include "saga/isomap.h" namespace Saga { @@ -583,7 +584,7 @@ void Script::sfScriptOpenDoor(SCRIPTFUNC_PARAMS) { doorNumber = thread->pop(); if (_vm->_scene->getFlags() & kSceneFlagISO) { - //todo: it + _vm->_isoMap->setTileDoorState(doorNumber, 1); } else { _vm->_scene->setDoorState(doorNumber, 0); } @@ -596,7 +597,7 @@ void Script::sfScriptCloseDoor(SCRIPTFUNC_PARAMS) { doorNumber = thread->pop(); if (_vm->_scene->getFlags() & kSceneFlagISO) { - //todo: it + _vm->_isoMap->setTileDoorState(doorNumber, 0); } else { _vm->_scene->setDoorState(doorNumber, 0xff); } @@ -1319,7 +1320,7 @@ void Script::sfSetDoorState(SCRIPTFUNC_PARAMS) { doorState = thread->pop(); if (_vm->_scene->getFlags() & kSceneFlagISO) { - //todo: it + _vm->_isoMap->setTileDoorState(doorNumber, doorState); } else { _vm->_scene->setDoorState(doorNumber, doorState); } diff --git a/saga/sthread.cpp b/saga/sthread.cpp index 244546f29e..dc759be65c 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -228,7 +228,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) { operandName = #opName; \ } - debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize()); +// debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize()); operandName=""; switch (operandChar) { CASEOP(opNextBlock) |