MOHAWK: Use explicit bitmap names for the dome sliders

This commit is contained in:
Bastien Bouclet 2017-02-04 15:25:37 +01:00 committed by Eugene Sandulenko
parent f334e6e38a
commit 7609ec0de8
7 changed files with 20 additions and 10 deletions

View File

@ -33,7 +33,7 @@ namespace Mohawk {
namespace RivenStacks {
BSpit::BSpit(MohawkEngine_Riven *vm) :
DomeSpit(vm, kStackBspit) {
DomeSpit(vm, kStackBspit, "bSliders.190", "bSliderBG.190") {
REGISTER_COMMAND(BSpit, xblabopenbook);
REGISTER_COMMAND(BSpit, xblabbookprevpage);

View File

@ -35,8 +35,10 @@ namespace RivenStacks {
static const uint32 kDomeSliderDefaultState = 0x01F00000;
static const uint32 kDomeSliderSlotCount = 25;
DomeSpit::DomeSpit(MohawkEngine_Riven *vm, uint16 id) :
RivenStack(vm, id) {
DomeSpit::DomeSpit(MohawkEngine_Riven *vm, uint16 id, const char *sliderBmpName, const char *sliderBgBmpName) :
RivenStack(vm, id),
_sliderBmpName(sliderBmpName),
_sliderBgBmpName(sliderBgBmpName) {
_sliderState = kDomeSliderDefaultState;
}
@ -204,7 +206,8 @@ void DomeSpit::drawDomeSliders(uint16 startHotspot) {
dstAreaRect.translate(-2, 0);
// Find out bitmap id
uint16 bitmapId = _vm->findResourceID(ID_TBMP, "*sliders*");
uint16 bitmapId = _vm->findResourceID(ID_TBMP, buildCardResourceName(_sliderBmpName));
uint16 bgBitmapId = _vm->findResourceID(ID_TBMP, buildCardResourceName(_sliderBgBmpName));
for (uint16 i = 0; i < kDomeSliderSlotCount; i++) {
RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + i);
@ -217,12 +220,16 @@ void DomeSpit::drawDomeSliders(uint16 startHotspot) {
if (_sliderState & (1 << (24 - i)))
_vm->_gfx->drawImageRect(bitmapId, srcRect, dstRect);
else
_vm->_gfx->drawImageRect(bitmapId + 1, srcRect, dstRect);
_vm->_gfx->drawImageRect(bgBitmapId, srcRect, dstRect);
}
_vm->_gfx->updateScreen();
}
Common::String DomeSpit::buildCardResourceName(const Common::String &name) const {
return Common::String::format("%d_%s", _vm->getCard()->getId(), name.c_str());
}
void DomeSpit::setDomeSliderState(uint32 sliderState) {
_sliderState = sliderState;
}

View File

@ -30,7 +30,7 @@ namespace RivenStacks {
class DomeSpit : public RivenStack {
public:
DomeSpit(MohawkEngine_Riven *vm, uint16 id);
DomeSpit(MohawkEngine_Riven *vm, uint16 id, const char *sliderBmpName, const char *sliderBgBmpName);
uint32 getDomeSliderState() const;
void setDomeSliderState(uint32 sliderState);
@ -43,8 +43,11 @@ protected:
void checkSliderCursorChange(uint16 startHotspot);
void dragDomeSlider(uint16 soundId, uint16 startHotspot);
void drawDomeSliders(uint16 startHotspot);
Common::String buildCardResourceName(const Common::String &name) const;
uint32 _sliderState;
Common::String _sliderBmpName;
Common::String _sliderBgBmpName;
};
} // End of namespace RivenStacks

View File

@ -33,7 +33,7 @@ namespace Mohawk {
namespace RivenStacks {
GSpit::GSpit(MohawkEngine_Riven *vm) :
DomeSpit(vm, kStackGspit) {
DomeSpit(vm, kStackGspit, "gsliders.190", "gsliderbg.190") {
REGISTER_COMMAND(GSpit, xgresetpins);
REGISTER_COMMAND(GSpit, xgrotatepins);

View File

@ -33,7 +33,7 @@ namespace Mohawk {
namespace RivenStacks {
JSpit::JSpit(MohawkEngine_Riven *vm) :
DomeSpit(vm, kStackJspit) {
DomeSpit(vm, kStackJspit, "jsliders.190", "jsliderbg.190") {
REGISTER_COMMAND(JSpit, xreseticons);
REGISTER_COMMAND(JSpit, xicon);

View File

@ -31,7 +31,7 @@ namespace Mohawk {
namespace RivenStacks {
PSpit::PSpit(MohawkEngine_Riven *vm) :
DomeSpit(vm, kStackPspit) {
DomeSpit(vm, kStackPspit, "psliders.25", "psliderbg.25") {
REGISTER_COMMAND(PSpit, xpisland990_elevcombo);
REGISTER_COMMAND(PSpit, xpscpbtn);

View File

@ -34,7 +34,7 @@ namespace Mohawk {
namespace RivenStacks {
TSpit::TSpit(MohawkEngine_Riven *vm) :
DomeSpit(vm, kStackTspit) {
DomeSpit(vm, kStackTspit, "tsliders.190", "tsliderbg.190") {
REGISTER_COMMAND(TSpit, xtexterior300_telescopedown);
REGISTER_COMMAND(TSpit, xtexterior300_telescopeup);