Project

General

Profile

« Previous | Next » 

Revision 5ce579d2

Added by Leszek Koltunski 2 months ago

two bugfixes for configurable stickers

View differences:

src/main/java/org/distorted/objectlib/main/TwistyObject.java
147 147
  private boolean mThereAreDeciders;
148 148
  private TwistyLayerRotations mRotation;
149 149
  private int[] mColorTable;
150
  private int[] mOriginalColorTable;
150 151
  private float mTextureBorderMultiplier, mTextureCornerMultiplier;
151 152

  
152 153
///////////////////////////////////////////////////////////////////////////////////////////////////
......
228 229
      mNumCuts[i] = (mCuts==null || mCuts[i]==null ? 0 : mCuts[i].length);
229 230
      }
230 231

  
232
    mOriginalColorTable = getColorTable();
233
    mNumFaceColors = mOriginalColorTable.length;
234
    mColorTable = new int[mNumFaceColors];
231 235
    recreateFaceColors();
232 236
    mTextureBorderMultiplier = 1.0f;
233 237
    mTextureCornerMultiplier = 1.0f;
......
291 295

  
292 296
  public void recreateFaceColors()
293 297
    {
294
    int[] tmp = getColorTable();
295
    mNumFaceColors = tmp.length;
296
    mColorTable = new int[mNumFaceColors];
297
    for(int i=0; i<mNumFaceColors; i++) mColorTable[i] = tmp[i];
298
    for(int i=0; i<mNumFaceColors; i++) mColorTable[i] = mOriginalColorTable[i];
298 299
    }
299 300

  
300 301
///////////////////////////////////////////////////////////////////////////////////////////////////
......
1258 1259
  void repaintPuzzleFace(int cubit, int face, int newColor)
1259 1260
    {
1260 1261
    int oldColorIndex = getCubitFaceColor(cubit,face);
1262

  
1263
    if( oldColorIndex<0 || oldColorIndex>=mNumFaceColors )
1264
      {
1265
      android.util.Log.e("D", "error in TwistyObject.repaintPuzzleFace, index="+oldColorIndex);
1266
      return;
1267
      }
1268

  
1261 1269
    int oldColor = mColorTable[oldColorIndex];
1262 1270

  
1263 1271
    if( oldColor!=newColor )
1264 1272
      {
1273
      oldColor = mOriginalColorTable[oldColorIndex];
1265 1274
      changeColorInTexture(oldColor,newColor);
1266 1275
      mColorTable[oldColorIndex] = newColor;
1267 1276
      setTexture();
......
1699 1708
        {
1700 1709
        if( texture<mNumTextures-mNumOverrides )
1701 1710
          {
1702
          int color = mColorTable[texture%mNumFaceColors];
1711
          int color = mOriginalColorTable[texture%mNumFaceColors];
1703 1712

  
1704 1713
          if( color==oldColor )
1705 1714
            {

Also available in: Unified diff