mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 07:14:59 +00:00
MOHAWK: Remove the RivenHotspot enabled field
This commit is contained in:
parent
6b988670e8
commit
17f1903833
@ -516,7 +516,7 @@ bool RivenConsole::Cmd_Hotspots(int argc, const char **argv) {
|
||||
RivenHotspot *hotspot = _vm->_hotspots[i];
|
||||
debugPrintf("Hotspot %d, index %d, BLST ID %d (", i, hotspot->index, hotspot->blstID);
|
||||
|
||||
if (hotspot->enabled)
|
||||
if (hotspot->isEnabled())
|
||||
debugPrintf("enabled");
|
||||
else
|
||||
debugPrintf("disabled");
|
||||
|
@ -258,7 +258,7 @@ void MohawkEngine_Riven::handleEvents() {
|
||||
_showHotspots = !_showHotspots;
|
||||
if (_showHotspots) {
|
||||
for (uint16 i = 0; i < _hotspots.size(); i++)
|
||||
_gfx->drawRect(_hotspots[i]->rect, _hotspots[i]->enabled);
|
||||
_gfx->drawRect(_hotspots[i]->rect, _hotspots[i]->isEnabled());
|
||||
needsUpdate = true;
|
||||
} else
|
||||
refreshCard();
|
||||
@ -415,7 +415,7 @@ void MohawkEngine_Riven::refreshCard() {
|
||||
|
||||
if (_showHotspots)
|
||||
for (uint16 i = 0; i < _hotspots.size(); i++)
|
||||
_gfx->drawRect(_hotspots[i]->rect, _hotspots[i]->enabled);
|
||||
_gfx->drawRect(_hotspots[i]->rect, _hotspots[i]->isEnabled());
|
||||
|
||||
// Now we need to redraw the cursor if necessary and handle mouse over scripts
|
||||
updateCurrentHotspot();
|
||||
@ -446,7 +446,7 @@ void MohawkEngine_Riven::updateZipMode() {
|
||||
// Check if a zip mode hotspot is enabled by checking the name/id against the ZIPS records.
|
||||
|
||||
for (uint32 i = 0; i < _hotspots.size(); i++) {
|
||||
if (_hotspots[i]->zipModeHotspot) {
|
||||
if (_hotspots[i]->isZip()) {
|
||||
if (_vars["azip"] != 0) {
|
||||
// Check if a zip mode hotspot is enabled by checking the name/id against the ZIPS records.
|
||||
Common::String hotspotName = getName(HotspotNames, _hotspots[i]->name_resource);
|
||||
@ -460,9 +460,9 @@ void MohawkEngine_Riven::updateZipMode() {
|
||||
break;
|
||||
}
|
||||
|
||||
_hotspots[i]->enabled = foundMatch;
|
||||
_hotspots[i]->enable(foundMatch);
|
||||
} else // Disable the hotspot if zip mode is disabled
|
||||
_hotspots[i]->enabled = false;
|
||||
_hotspots[i]->enable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -470,7 +470,7 @@ void MohawkEngine_Riven::updateZipMode() {
|
||||
void MohawkEngine_Riven::checkHotspotChange() {
|
||||
RivenHotspot *hotspot = nullptr;
|
||||
for (uint16 i = 0; i < _hotspots.size(); i++)
|
||||
if (_hotspots[i]->enabled && _hotspots[i]->rect.contains(_eventMan->getMousePos())) {
|
||||
if (_hotspots[i]->isEnabled() && _hotspots[i]->rect.contains(_eventMan->getMousePos())) {
|
||||
hotspot = _hotspots[i];
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ RivenHotspot::RivenHotspot(MohawkEngine_Riven *vm, Common::ReadStream *stream) :
|
||||
}
|
||||
|
||||
void RivenHotspot::loadFromStream(Common::ReadStream *stream) {
|
||||
enabled = true;
|
||||
_flags = kFlagEnabled;
|
||||
|
||||
blstID = stream->readUint16BE();
|
||||
name_resource = stream->readSint16BE();
|
||||
@ -218,7 +218,7 @@ void RivenHotspot::loadFromStream(Common::ReadStream *stream) {
|
||||
if (left >= right || top >= bottom) {
|
||||
warning("Invalid hotspot: (%d, %d, %d, %d)", left, top, right, bottom);
|
||||
left = top = right = bottom = 0;
|
||||
enabled = 0;
|
||||
enable(false);
|
||||
}
|
||||
|
||||
rect = Common::Rect(left, top, right, bottom);
|
||||
@ -227,7 +227,7 @@ void RivenHotspot::loadFromStream(Common::ReadStream *stream) {
|
||||
mouse_cursor = stream->readUint16BE();
|
||||
index = stream->readUint16BE();
|
||||
_u1 = stream->readSint16BE();
|
||||
zipModeHotspot = stream->readUint16BE();
|
||||
_flags |= stream->readUint16BE();
|
||||
|
||||
// Read in the scripts now
|
||||
_scripts = _vm->_scriptMan->readScripts(stream);
|
||||
@ -242,4 +242,20 @@ void RivenHotspot::runScript(uint16 scriptType) {
|
||||
}
|
||||
}
|
||||
|
||||
bool RivenHotspot::isEnabled() const {
|
||||
return (_flags & kFlagEnabled) != 0;
|
||||
}
|
||||
|
||||
void RivenHotspot::enable(bool e) {
|
||||
if (e) {
|
||||
_flags |= kFlagEnabled;
|
||||
} else {
|
||||
_flags &= ~kFlagEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
bool RivenHotspot::isZip() const {
|
||||
return (_flags & kFlagZip) != 0;
|
||||
}
|
||||
|
||||
} // End of namespace Mohawk
|
||||
|
@ -108,22 +108,34 @@ public:
|
||||
/** Run one of the hotspot's scripts */
|
||||
void runScript(uint16 scriptType);
|
||||
|
||||
/** Enable or disable the hotspot */
|
||||
void enable(bool e);
|
||||
|
||||
/** Can the hotspot be interacted with? */
|
||||
bool isEnabled() const;
|
||||
|
||||
/** Is the hotspot's purpose to zip to another card */
|
||||
bool isZip() const;
|
||||
|
||||
uint16 blstID;
|
||||
int16 name_resource;
|
||||
uint16 index;
|
||||
Common::Rect rect;
|
||||
uint16 mouse_cursor;
|
||||
int16 zipModeHotspot;
|
||||
|
||||
bool enabled; // TODO: Remove
|
||||
|
||||
private:
|
||||
enum {
|
||||
kFlagZip = 1,
|
||||
kFlagEnabled = 2
|
||||
};
|
||||
|
||||
void loadFromStream(Common::ReadStream *stream);
|
||||
|
||||
MohawkEngine_Riven *_vm;
|
||||
|
||||
uint16 _u0;
|
||||
int16 _u1;
|
||||
uint16 _flags;
|
||||
RivenScriptList _scripts;
|
||||
};
|
||||
|
||||
|
@ -316,12 +316,12 @@ void RivenExternal::checkDomeSliders(uint16 resetSlidersHotspot, uint16 openDome
|
||||
// Let's see if we're all matched up...
|
||||
if (_vm->_vars["adomecombo"] == _sliderState) {
|
||||
// Set the button hotspot to the open dome hotspot
|
||||
_vm->_hotspots[resetSlidersHotspot]->enabled = false;
|
||||
_vm->_hotspots[openDomeHotspot]->enabled = true;
|
||||
_vm->_hotspots[resetSlidersHotspot]->enable(false);
|
||||
_vm->_hotspots[openDomeHotspot]->enable(true);
|
||||
} else {
|
||||
// Set the button hotspot to the reset sliders hotspot
|
||||
_vm->_hotspots[resetSlidersHotspot]->enabled = true;
|
||||
_vm->_hotspots[openDomeHotspot]->enabled = false;
|
||||
_vm->_hotspots[resetSlidersHotspot]->enable(true);
|
||||
_vm->_hotspots[openDomeHotspot]->enable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,13 +450,13 @@ void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) {
|
||||
|
||||
// Set hotspots depending on the page
|
||||
if (page == 1) {
|
||||
_vm->_hotspots[1]->enabled = false;
|
||||
_vm->_hotspots[2]->enabled = false;
|
||||
_vm->_hotspots[3]->enabled = true;
|
||||
_vm->_hotspots[1]->enable(false);
|
||||
_vm->_hotspots[2]->enable(false);
|
||||
_vm->_hotspots[3]->enable(true);
|
||||
} else {
|
||||
_vm->_hotspots[1]->enabled = true;
|
||||
_vm->_hotspots[2]->enabled = true;
|
||||
_vm->_hotspots[3]->enabled = false;
|
||||
_vm->_hotspots[1]->enable(true);
|
||||
_vm->_hotspots[2]->enable(true);
|
||||
_vm->_hotspots[3]->enable(false);
|
||||
}
|
||||
|
||||
// Draw the image of the page
|
||||
@ -515,13 +515,13 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) {
|
||||
|
||||
// Set hotspots depending on the page
|
||||
if (page == 1) {
|
||||
_vm->_hotspots[1]->enabled = false;
|
||||
_vm->_hotspots[2]->enabled = false;
|
||||
_vm->_hotspots[3]->enabled = true;
|
||||
_vm->_hotspots[1]->enable(false);
|
||||
_vm->_hotspots[2]->enable(false);
|
||||
_vm->_hotspots[3]->enable(true);
|
||||
} else {
|
||||
_vm->_hotspots[1]->enabled = true;
|
||||
_vm->_hotspots[2]->enabled = true;
|
||||
_vm->_hotspots[3]->enabled = false;
|
||||
_vm->_hotspots[1]->enable(true);
|
||||
_vm->_hotspots[2]->enable(true);
|
||||
_vm->_hotspots[3]->enable(false);
|
||||
}
|
||||
|
||||
// Draw the image of the page
|
||||
@ -950,8 +950,8 @@ void RivenExternal::xbait(uint16 argc, uint16 *argv) {
|
||||
if (_vm->_hotspots[9]->rect.contains(_vm->_system->getEventManager()->getMousePos())) {
|
||||
_vm->_vars["bbait"] = 1;
|
||||
_vm->getCurCard()->drawPicture(4);
|
||||
_vm->_hotspots[3]->enabled = false; // Disable bait hotspot
|
||||
_vm->_hotspots[9]->enabled = true; // Enable baitplate hotspot
|
||||
_vm->_hotspots[3]->enable(false); // Disable bait hotspot
|
||||
_vm->_hotspots[9]->enable(true); // Enable baitplate hotspot
|
||||
}
|
||||
}
|
||||
|
||||
@ -1009,12 +1009,12 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) {
|
||||
if (_vm->_hotspots[9]->rect.contains(_vm->_system->getEventManager()->getMousePos())) {
|
||||
_vm->_vars["bbait"] = 1;
|
||||
_vm->getCurCard()->drawPicture(4);
|
||||
_vm->_hotspots[3]->enabled = false; // Disable bait hotspot
|
||||
_vm->_hotspots[9]->enabled = true; // Enable baitplate hotspot
|
||||
_vm->_hotspots[3]->enable(false); // Disable bait hotspot
|
||||
_vm->_hotspots[9]->enable(true); // Enable baitplate hotspot
|
||||
} else {
|
||||
_vm->_vars["bbait"] = 0;
|
||||
_vm->_hotspots[3]->enabled = true; // Enable bait hotspot
|
||||
_vm->_hotspots[9]->enabled = false; // Disable baitplate hotspot
|
||||
_vm->_hotspots[3]->enable(true); // Enable bait hotspot
|
||||
_vm->_hotspots[9]->enable(false); // Disable baitplate hotspot
|
||||
}
|
||||
}
|
||||
|
||||
@ -1995,8 +1995,8 @@ void RivenExternal::xschool280_playwhark(uint16 argc, uint16 *argv) {
|
||||
}
|
||||
|
||||
// Enable the correct hotspots for the movement now
|
||||
_vm->_hotspots[2]->enabled = !_vm->_hotspots[2]->enabled;
|
||||
_vm->_hotspots[3]->enabled = !_vm->_hotspots[3]->enabled;
|
||||
_vm->_hotspots[2]->enable(!_vm->_hotspots[2]->isEnabled());
|
||||
_vm->_hotspots[3]->enable(!_vm->_hotspots[3]->isEnabled());
|
||||
|
||||
// Update the cursor
|
||||
_vm->updateCurrentHotspot();
|
||||
@ -2157,9 +2157,9 @@ void RivenExternal::xooffice30_closebook(uint16 argc, uint16 *argv) {
|
||||
_vm->_video->playMovieBlockingRiven(1);
|
||||
|
||||
// Set the hotspots into their correct states
|
||||
_vm->_hotspots[2]->enabled = false;
|
||||
_vm->_hotspots[5]->enabled = false;
|
||||
_vm->_hotspots[6]->enabled = true;
|
||||
_vm->_hotspots[2]->enable(false);
|
||||
_vm->_hotspots[5]->enable(false);
|
||||
_vm->_hotspots[6]->enable(true);
|
||||
|
||||
// We now need to draw PLST 1 and refresh, but PLST 1 is
|
||||
// drawn when refreshing anyway, so don't worry about that.
|
||||
@ -2484,7 +2484,7 @@ void RivenExternal::xtisland390_covercombo(uint16 argc, uint16 *argv) {
|
||||
|
||||
// If we have hit the correct 5 buttons in a row, activate the hotspot to open up the
|
||||
// telescope cover.
|
||||
_vm->_hotspots[9]->enabled = (correctDigits == 5);
|
||||
_vm->_hotspots[9]->enable(correctDigits == 5);
|
||||
}
|
||||
|
||||
// Atrus' Journal and Trap Book are added to inventory
|
||||
|
@ -361,7 +361,7 @@ void RivenSimpleCommand::enableHotspot(uint16 op, uint16 argc, uint16 *argv) {
|
||||
for (uint16 i = 0; i < _vm->_hotspots.size(); i++) {
|
||||
if (_vm->_hotspots[i]->blstID == argv[0]) {
|
||||
debug(2, "Enabling hotspot with BLST ID %d", argv[0]);
|
||||
_vm->_hotspots[i]->enabled = true;
|
||||
_vm->_hotspots[i]->enable(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ void RivenSimpleCommand::disableHotspot(uint16 op, uint16 argc, uint16 *argv) {
|
||||
for (uint16 i = 0; i < _vm->_hotspots.size(); i++) {
|
||||
if (_vm->_hotspots[i]->blstID == argv[0]) {
|
||||
debug(2, "Disabling hotspot with BLST ID %d", argv[0]);
|
||||
_vm->_hotspots[i]->enabled = false;
|
||||
_vm->_hotspots[i]->enable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ void RivenSimpleCommand::activateBLST(uint16 op, uint16 argc, uint16 *argv) {
|
||||
if (argv[0] == index)
|
||||
for (uint16 j = 0; j < _vm->_hotspots.size(); j++)
|
||||
if (_vm->_hotspots[j]->blstID == hotspotID)
|
||||
_vm->_hotspots[j]->enabled = (enabled == 1);
|
||||
_vm->_hotspots[j]->enable(enabled == 1);
|
||||
}
|
||||
|
||||
delete blst;
|
||||
|
Loading…
x
Reference in New Issue
Block a user