Ticket #12601: space-ship-puzzle-fuzzy-logic-ver2.diff

File space-ship-puzzle-fuzzy-logic-ver2.diff, 2.6 KB (added by AspireONE-zz, 3 years ago)

same as before, but this time as function.

  • engines/mohawk/myst_stacks/myst.cpp

    diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
    index de9a375..8af9684 100644
    a b uint16 Myst::rocketSliderGetSound(uint16 pos) {  
    22922292        return (uint16)(9530 + (pos - 216) * 35.0 / 61.0);
    22932293}
    22942294
     2295
     2296uint16 Myst::rocketCheckSolutionLogicHelper(uint16 sound1, uint16 sound2, uint16 logictype) {
     2297
     2298        debugN("helper: %i %i %i (diff:%02i) ",sound1, sound2 , logictype, abs(sound1-sound2));
     2299        if (logictype==0) {
     2300
     2301                if (sound1 != sound2) {
     2302                        debugN("strict : false \n");
     2303                        return false;
     2304                }
     2305
     2306        } else {
     2307
     2308               if ( abs(sound1-sound2)>=5) {
     2309                        debugN(" fuzzy : false \n");
     2310                        return false;
     2311                }
     2312
     2313        }
     2314
     2315        debugN("either : true \n");
     2316        return true;
     2317
     2318}
     2319
    22952320void Myst::rocketCheckSolution() {
    22962321        _vm->_cursor->hideCursor();
    22972322
    void Myst::rocketCheckSolution() {  
    23022327        _vm->_sound->playEffect(soundId);
    23032328        _rocketSlider1->drawConditionalDataToScreen(2);
    23042329        _vm->wait(250);
    2305         if (soundId != 9558)
     2330        if ( !rocketCheckSolutionLogicHelper(soundId,9558,0) )
    23062331                solved = false;
    23072332
    23082333        soundId = rocketSliderGetSound(_rocketSlider2->_pos.y);
    23092334        _vm->_sound->playEffect(soundId);
    23102335        _rocketSlider2->drawConditionalDataToScreen(2);
    23112336        _vm->wait(250);
    2312         if (soundId != 9546)
     2337        if ( !rocketCheckSolutionLogicHelper(soundId,9546,1) )
    23132338                solved = false;
    23142339
    23152340        soundId = rocketSliderGetSound(_rocketSlider3->_pos.y);
    23162341        _vm->_sound->playEffect(soundId);
    23172342        _rocketSlider3->drawConditionalDataToScreen(2);
    23182343        _vm->wait(250);
    2319         if (soundId != 9543)
     2344        if ( !rocketCheckSolutionLogicHelper(soundId,9543,1) )
    23202345                solved = false;
    23212346
    23222347        soundId = rocketSliderGetSound(_rocketSlider4->_pos.y);
    23232348        _vm->_sound->playEffect(soundId);
    23242349        _rocketSlider4->drawConditionalDataToScreen(2);
    23252350        _vm->wait(250);
    2326         if (soundId != 9553)
     2351        if ( !rocketCheckSolutionLogicHelper(soundId,9553,1) )
    23272352                solved = false;
    23282353
    23292354        soundId = rocketSliderGetSound(_rocketSlider5->_pos.y);
    23302355        _vm->_sound->playEffect(soundId);
    23312356        _rocketSlider5->drawConditionalDataToScreen(2);
    23322357        _vm->wait(250);
    2333         if (soundId != 9560)
     2358        if ( !rocketCheckSolutionLogicHelper(soundId,9560,1) )
    23342359                solved = false;
    23352360
    23362361        _vm->_sound->stopEffect();
  • engines/mohawk/myst_stacks/myst.h

    diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
    index 3739630..6e8c9d9 100644
    a b protected:  
    312312
    313313        void rocketSliderMove();
    314314        uint16 rocketSliderGetSound(uint16 pos);
     315        uint16 rocketCheckSolutionLogicHelper(uint16 sound1, uint16 sound2, uint16 logictype);
    315316        void rocketCheckSolution();
    316317
    317318        void libraryBookPageTurnLeft();