[Scummvm-cvs-logs] SF.net SVN: scummvm:[54416] scummvm/trunk/engines/mohawk
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Mon Nov 22 18:50:30 CET 2010
Revision: 54416
http://scummvm.svn.sourceforge.net/scummvm/?rev=54416&view=rev
Author: mthreepwood
Date: 2010-11-22 17:50:30 +0000 (Mon, 22 Nov 2010)
Log Message:
-----------
MOHAWK: Switch slider bitmap ID's to matching via string; fixes some versions
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/mohawk.cpp
scummvm/trunk/engines/mohawk/mohawk.h
scummvm/trunk/engines/mohawk/resource.cpp
scummvm/trunk/engines/mohawk/resource.h
scummvm/trunk/engines/mohawk/riven_external.cpp
scummvm/trunk/engines/mohawk/riven_external.h
Modified: scummvm/trunk/engines/mohawk/mohawk.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/mohawk.cpp 2010-11-22 10:23:53 UTC (rev 54415)
+++ scummvm/trunk/engines/mohawk/mohawk.cpp 2010-11-22 17:50:30 UTC (rev 54416)
@@ -93,15 +93,6 @@
return NULL;
}
-Common::SeekableReadStream *MohawkEngine::getResource(uint32 tag, const Common::String &resName) {
- for (uint32 i = 0; i < _mhk.size(); i++)
- if (_mhk[i]->hasResource(tag, resName))
- return _mhk[i]->getResource(tag, resName);
-
- error("Could not find a '%s' resource matching name '%s'", tag2str(tag), resName.c_str());
- return NULL;
-}
-
bool MohawkEngine::hasResource(uint32 tag, uint16 id) {
for (uint32 i = 0; i < _mhk.size(); i++)
if (_mhk[i]->hasResource(tag, id))
@@ -127,4 +118,13 @@
return 0;
}
+uint16 MohawkEngine::findResourceID(uint32 tag, const Common::String &resName) {
+ for (uint32 i = 0; i < _mhk.size(); i++)
+ if (_mhk[i]->hasResource(tag, resName))
+ return _mhk[i]->findResourceID(tag, resName);
+
+ error("Could not find a '%s' resource matching name '%s'", tag2str(tag), resName.c_str());
+ return 0xFFFF;
+}
+
} // End of namespace Mohawk
Modified: scummvm/trunk/engines/mohawk/mohawk.h
===================================================================
--- scummvm/trunk/engines/mohawk/mohawk.h 2010-11-22 10:23:53 UTC (rev 54415)
+++ scummvm/trunk/engines/mohawk/mohawk.h 2010-11-22 17:50:30 UTC (rev 54416)
@@ -100,10 +100,10 @@
VideoManager *_video;
virtual Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
- Common::SeekableReadStream *getResource(uint32 tag, const Common::String &resName);
bool hasResource(uint32 tag, uint16 id);
bool hasResource(uint32 tag, const Common::String &resName);
uint32 getResourceOffset(uint32 tag, uint16 id);
+ uint16 findResourceID(uint32 type, const Common::String &resName);
void pauseGame();
Modified: scummvm/trunk/engines/mohawk/resource.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/resource.cpp 2010-11-22 10:23:53 UTC (rev 54415)
+++ scummvm/trunk/engines/mohawk/resource.cpp 2010-11-22 17:50:30 UTC (rev 54416)
@@ -192,7 +192,7 @@
for (uint16 i = 0; i < _types[typeIndex].nameTable.num; i++)
if (_types[typeIndex].nameTable.entries[i].name.matchString(resName)) {
- index = i;
+ index = _types[typeIndex].nameTable.entries[i].index;
break;
}
@@ -206,6 +206,20 @@
return -1; // Not found
}
+uint16 MohawkArchive::findResourceID(uint32 type, const Common::String &resName) {
+ int typeIndex = getTypeIndex(type);
+
+ if (typeIndex < 0)
+ return 0xFFFF;
+
+ int idIndex = getIDIndex(typeIndex, resName);
+
+ if (idIndex < 0)
+ return 0xFFFF;
+
+ return _types[typeIndex].resTable.entries[idIndex].id;
+}
+
bool MohawkArchive::hasResource(uint32 tag, uint16 id) {
if (!_mhk)
return false;
@@ -273,37 +287,6 @@
return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
}
-Common::SeekableReadStream *MohawkArchive::getResource(uint32 tag, const Common::String &resName) {
- if (!_mhk)
- error("MohawkArchive::getResource(): No File in Use");
-
- int16 typeIndex = getTypeIndex(tag);
-
- if (typeIndex < 0)
- error("Could not find a tag of '%s' in file '%s'", tag2str(tag), _curFile.c_str());
-
- int16 idIndex = getIDIndex(typeIndex, resName);
-
- if (idIndex < 0)
- error("Could not find '%s' '%s' in file '%s'", tag2str(tag), resName.c_str(), _curFile.c_str());
-
- // Note: the fileTableIndex is based off 1, not 0. So, subtract 1
- uint16 fileTableIndex = _types[typeIndex].resTable.entries[idIndex].index - 1;
-
- // WORKAROUND: tMOV resources pretty much ignore the size part of the file table,
- // as the original just passed the full Mohawk file to QuickTime and the offset.
- // We need to do this because of the way Mohawk is set up (this is much more "proper"
- // than passing _mhk at the right offset). We may want to do that in the future, though.
- if (_types[typeIndex].tag == ID_TMOV) {
- if (fileTableIndex == _fileTableAmount)
- return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _mhk->size());
- else
- return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex + 1].offset);
- }
-
- return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
-}
-
void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) {
close();
_mhk = stream;
Modified: scummvm/trunk/engines/mohawk/resource.h
===================================================================
--- scummvm/trunk/engines/mohawk/resource.h 2010-11-22 10:23:53 UTC (rev 54415)
+++ scummvm/trunk/engines/mohawk/resource.h 2010-11-22 17:50:30 UTC (rev 54416)
@@ -186,8 +186,8 @@
virtual bool hasResource(uint32 tag, uint16 id);
virtual bool hasResource(uint32 tag, const Common::String &resName);
virtual Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
- virtual Common::SeekableReadStream *getResource(uint32 tag, const Common::String &resName);
virtual uint32 getOffset(uint32 tag, uint16 id);
+ virtual uint16 findResourceID(uint32 type, const Common::String &resName);
protected:
Common::SeekableReadStream *_mhk;
@@ -220,6 +220,7 @@
Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
Common::SeekableReadStream *getResource(uint32 tag, const Common::String &resName) { return 0; }
uint32 getOffset(uint32 tag, uint16 id);
+ uint16 findResourceID(uint32 type, const Common::String &resName) { return 0xFFFF; }
private:
struct OldType {
Modified: scummvm/trunk/engines/mohawk/riven_external.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven_external.cpp 2010-11-22 10:23:53 UTC (rev 54415)
+++ scummvm/trunk/engines/mohawk/riven_external.cpp 2010-11-22 17:50:30 UTC (rev 54416)
@@ -259,7 +259,7 @@
*_vm->getVar("domecheck") = 1;
}
-void RivenExternal::resetDomeSliders(uint16 bitmapId, uint16 soundId, uint16 startHotspot) {
+void RivenExternal::resetDomeSliders(uint16 soundId, uint16 startHotspot) {
// The rightmost slider should move left until it finds the next slider,
// then those two continue until they find the third slider. This continues
// until all five sliders have returned their starting slots.
@@ -280,7 +280,7 @@
// so we should redraw and play a tick sound
if (slidersFound) {
_vm->_sound->playSound(soundId);
- drawDomeSliders(bitmapId, startHotspot);
+ drawDomeSliders(startHotspot);
_vm->_system->delayMillis(100);
}
}
@@ -318,7 +318,7 @@
}
}
-void RivenExternal::dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 resetSlidersHotspot, uint16 openDomeHotspot, uint16 startHotspot) {
+void RivenExternal::dragDomeSlider(uint16 soundId, uint16 resetSlidersHotspot, uint16 openDomeHotspot, uint16 startHotspot) {
int16 foundSlider = -1;
for (uint16 i = 0; i < kDomeSliderSlotCount; i++) {
@@ -353,7 +353,7 @@
// Now play a click sound and redraw
_vm->_sound->playSound(soundId);
- drawDomeSliders(bitmapId, startHotspot);
+ drawDomeSliders(startHotspot);
} else if (foundSlider > 0 && !(_sliderState & (1 << (25 - foundSlider))) && _vm->_hotspots[foundSlider + startHotspot - 1].rect.contains(event.mouse)) {
// We've moved the slider left one space
_sliderState &= ~(_sliderState & (1 << (24 - foundSlider)));
@@ -362,7 +362,7 @@
// Now play a click sound and redraw
_vm->_sound->playSound(soundId);
- drawDomeSliders(bitmapId, startHotspot);
+ drawDomeSliders(startHotspot);
} else
_vm->_system->updateScreen(); // A normal update for the cursor
break;
@@ -380,7 +380,7 @@
checkDomeSliders(resetSlidersHotspot, openDomeHotspot);
}
-void RivenExternal::drawDomeSliders(uint16 bitmapId, uint16 startHotspot) {
+void RivenExternal::drawDomeSliders(uint16 startHotspot) {
Common::Rect dstAreaRect = Common::Rect(200, 250, 420, 319);
// On pspit, the rect is different by two pixels
@@ -388,6 +388,9 @@
if (_vm->getCurStack() == pspit)
dstAreaRect.translate(-2, 0);
+ // Find out bitmap id
+ uint16 bitmapId = _vm->findResourceID(ID_TBMP, "*sliders*");
+
for (uint16 i = 0; i < kDomeSliderSlotCount; i++) {
Common::Rect srcRect = _vm->_hotspots[startHotspot + i].rect;
srcRect.translate(-dstAreaRect.left, -dstAreaRect.top); // Adjust the rect so it's in the destination area
@@ -934,11 +937,11 @@
}
void RivenExternal::xbisland190_resetsliders(uint16 argc, uint16 *argv) {
- resetDomeSliders(701, 41, 2);
+ resetDomeSliders(41, 2);
}
void RivenExternal::xbisland190_slidermd(uint16 argc, uint16 *argv) {
- dragDomeSlider(701, 41, 27, 28, 2);
+ dragDomeSlider(41, 27, 28, 2);
}
void RivenExternal::xbisland190_slidermw(uint16 argc, uint16 *argv) {
@@ -1057,11 +1060,11 @@
}
void RivenExternal::xgisland25_resetsliders(uint16 argc, uint16 *argv) {
- resetDomeSliders(161, 16, 2);
+ resetDomeSliders(16, 2);
}
void RivenExternal::xgisland25_slidermd(uint16 argc, uint16 *argv) {
- dragDomeSlider(161, 16, 29, 30, 2);
+ dragDomeSlider(16, 29, 30, 2);
}
void RivenExternal::xgisland25_slidermw(uint16 argc, uint16 *argv) {
@@ -1341,11 +1344,11 @@
}
void RivenExternal::xjdome25_resetsliders(uint16 argc, uint16 *argv) {
- resetDomeSliders(_vm->getFeatures() & GF_DVD ? 547 : 548, 81, 2);
+ resetDomeSliders(81, 2);
}
void RivenExternal::xjdome25_slidermd(uint16 argc, uint16 *argv) {
- dragDomeSlider(_vm->getFeatures() & GF_DVD ? 547: 548, 81, 29, 28, 2);
+ dragDomeSlider(81, 29, 28, 2);
}
void RivenExternal::xjdome25_slidermw(uint16 argc, uint16 *argv) {
@@ -1784,11 +1787,11 @@
}
void RivenExternal::xpisland25_resetsliders(uint16 argc, uint16 *argv) {
- resetDomeSliders(58, 10, 6);
+ resetDomeSliders(10, 6);
}
void RivenExternal::xpisland25_slidermd(uint16 argc, uint16 *argv) {
- dragDomeSlider(58, 10, 31, 5, 6);
+ dragDomeSlider(10, 31, 5, 6);
}
void RivenExternal::xpisland25_slidermw(uint16 argc, uint16 *argv) {
@@ -2168,11 +2171,11 @@
}
void RivenExternal::xtisland5056_resetsliders(uint16 argc, uint16 *argv) {
- resetDomeSliders(_vm->getFeatures() & GF_DVD ? 813 : 798, 37, 3);
+ resetDomeSliders(37, 3);
}
void RivenExternal::xtisland5056_slidermd(uint16 argc, uint16 *argv) {
- dragDomeSlider(_vm->getFeatures() & GF_DVD ? 813 : 798, 37, 29, 30, 3);
+ dragDomeSlider(37, 29, 30, 3);
}
void RivenExternal::xtisland5056_slidermw(uint16 argc, uint16 *argv) {
Modified: scummvm/trunk/engines/mohawk/riven_external.h
===================================================================
--- scummvm/trunk/engines/mohawk/riven_external.h 2010-11-22 10:23:53 UTC (rev 54415)
+++ scummvm/trunk/engines/mohawk/riven_external.h 2010-11-22 17:50:30 UTC (rev 54416)
@@ -65,11 +65,11 @@
void runCredits(uint16 video);
void runDomeCheck();
void runDomeButtonMovie();
- void resetDomeSliders(uint16 bitmapId, uint16 soundId, uint16 startHotspot);
+ void resetDomeSliders(uint16 soundId, uint16 startHotspot);
void checkDomeSliders(uint16 resetSlidersHotspot, uint16 openDomeHotspot);
void checkSliderCursorChange(uint16 startHotspot);
- void dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 resetSlidersHotspot, uint16 openDomeHotspot, uint16 startHotspot);
- void drawDomeSliders(uint16 bitmapId, uint16 startHotspot);
+ void dragDomeSlider(uint16 soundId, uint16 resetSlidersHotspot, uint16 openDomeHotspot, uint16 startHotspot);
+ void drawDomeSliders(uint16 startHotspot);
void drawMarbles();
void setMarbleHotspots();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list