Project

General

Profile

« Previous | Next » 

Revision a20e56fc

Added by Leszek Koltunski over 2 years ago

(hopefully!) finally fix the long-standing bug where people could cheat and submit impossible records.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectControl.java
479 479
        }
480 480
      }
481 481

  
482
///////////////////////////////////////////////////////////////////////////////////////////////////
483

  
484
    private void switchTouchControl(int oldMode, int newMode)
485
      {
486
      if( newMode==MODE_REPLACE )
487
        {
488
        if( mTouchControlBackup!=null )
489
          {
490
          TouchControl tmp = mTouchControlBackup;
491
          mTouchControlBackup = mTouchControl;
492
          mTouchControl = tmp;
493
          }
494
        else
495
          {
496
          mTouchControlBackup = mTouchControl;
497
          TwistyObject object = getObject();
498
          mTouchControl = new TouchControlShapeChanging(object);
499
          float ratio = object.getObjectRatio();
500
          mTouchControl.setObjectRatio(ratio);
501
          }
502
        }
503
      if( oldMode==MODE_REPLACE )
504
        {
505
        if( mTouchControlBackup!=null )
506
          {
507
          TouchControl tmp = mTouchControlBackup;
508
          mTouchControlBackup = mTouchControl;
509
          mTouchControl = tmp;
510
          }
511
        else
512
          {
513
          mTouchControlBackup = mTouchControl;
514
          TwistyObject object = getObject();
515
          mTouchControl = object.getTouchControl();
516
          float ratio = object.getObjectRatio();
517
          mTouchControl.setObjectRatio(ratio);
518
          }
519
        }
520
      }
521

  
482 522
///////////////////////////////////////////////////////////////////////////////////////////////////
483 523

  
484 524
    void setTouchControl(TwistyObject object)
......
749 789
      }
750 790

  
751 791
///////////////////////////////////////////////////////////////////////////////////////////////////
792
// if one or more fingers currently touch the screen, and we just pressed the 'scramble' button, do
793
// not scramble - otherwise a kind of a cheat is possible where user touches the screen, starts
794
// scrambling, then lifts the finger and the act of lifting screws the scrambling - no further
795
// scrambles take any effect!
752 796

  
753 797
    public void scrambleObject(int num)
754 798
      {
755
      mPreRender.scrambleObject(num);
799
      if( !mBeginningRotation && !mContinuingRotation )
800
        {
801
        mPreRender.scrambleObject(num);
802
        }
756 803
      }
757 804

  
758 805
///////////////////////////////////////////////////////////////////////////////////////////////////
......
847 894
      mPreRender.setTextureMap(cubit,face,newColor);
848 895
      }
849 896

  
850
///////////////////////////////////////////////////////////////////////////////////////////////////
851

  
852
    private void switchTouchControl(int oldMode, int newMode)
853
      {
854
      if( newMode==MODE_REPLACE )
855
        {
856
        if( mTouchControlBackup!=null )
857
          {
858
          TouchControl tmp = mTouchControlBackup;
859
          mTouchControlBackup = mTouchControl;
860
          mTouchControl = tmp;
861
          }
862
        else
863
          {
864
          mTouchControlBackup = mTouchControl;
865
          TwistyObject object = getObject();
866
          mTouchControl = new TouchControlShapeChanging(object);
867
          float ratio = object.getObjectRatio();
868
          mTouchControl.setObjectRatio(ratio);
869
          }
870
        }
871
      if( oldMode==MODE_REPLACE )
872
        {
873
        if( mTouchControlBackup!=null )
874
          {
875
          TouchControl tmp = mTouchControlBackup;
876
          mTouchControlBackup = mTouchControl;
877
          mTouchControl = tmp;
878
          }
879
        else
880
          {
881
          mTouchControlBackup = mTouchControl;
882
          TwistyObject object = getObject();
883
          mTouchControl = object.getTouchControl();
884
          float ratio = object.getObjectRatio();
885
          mTouchControl.setObjectRatio(ratio);
886
          }
887
        }
888
      }
889

  
890 897
///////////////////////////////////////////////////////////////////////////////////////////////////
891 898

  
892 899
    public boolean onTouchEvent(MotionEvent event, int mode)

Also available in: Unified diff