Subversion Repositories Games.Chess Giants

Rev

Rev 153 | Rev 181 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 153 Rev 171
Line 861... Line 861...
861
                  else
861
                  else
862
                  {
862
                  {
863
                     // height is a sine positive, max height is proportional to travelled distance
863
                     // height is a sine positive, max height is proportional to travelled distance
864
                     movement_diffco = abs(currentmove->target[1] - currentmove->source[1]);
864
                     movement_diffco = abs(currentmove->target[1] - currentmove->source[1]);
865
                     movement_diffli = abs(currentmove->target[0] - currentmove->source[0]);
865
                     movement_diffli = abs(currentmove->target[0] - currentmove->source[0]);
866
                     movement_maxheight = 0.5f + (float)movement_diffco + (float)movement_diffli;
866
                     movement_maxheight = 0.5f + (float) movement_diffco + (float) movement_diffli;
867
                     if (currentmove->part == PART_KNIGHT)
867
                     if (currentmove->part == PART_KNIGHT)
868
                        movement_maxheight *= 2.0f; // knights jump high
868
                        movement_maxheight *= 2.0f; // knights jump high
869
                     else if ((currentmove->part == PART_KING) && (movement_diffco == 2))
869
                     else if ((currentmove->part == PART_KING) && (movement_diffco == 2))
870
                        movement_maxheight *= 5.0f; // kings jump VERY high when castling too
870
                        movement_maxheight *= 5.0f; // kings jump VERY high when castling too
871
                     else if (movement_maxheight > 5.0f)
871
                     else if (movement_maxheight > 5.0f)
872
                        movement_maxheight = 5.0f; // all other parts just hover above the ground
872
                        movement_maxheight = 5.0f; // all other parts just hover above the ground
873
                     current_z = 0.04f + (float)sin(MATH_PI * movement_ratio) * movement_maxheight; // part height
873
                     current_z = 0.04f + (float) sin (MATH_PI * movement_ratio) * movement_maxheight; // part height
874
                     current_p = (boardslot->color == COLOR_BLACK ? -1 : 1) * min(current_z * 3.0f, 10.0f); // part inclination
874
                     current_p = (boardslot->color == COLOR_BLACK ? -1 : 1) * min(current_z * 3.0f, 10.0f); // part inclination
875
                  }
875
                  }
876
 
876
 
877
                  // make this part move realistically
877
                  // make this part move realistically
878
                  Scene_AddPart (scene, boardslot->part, boardslot->color, current_x, current_y, current_z, 0.0f, current_p);
878
                  Scene_AddPart (scene, boardslot->part, boardslot->color, current_x, current_y, current_z, 0.0f, current_p);
Line 1095... Line 1095...
1095
   scene->gui.is_partspick_displayed = (board->game_state == STATE_SETUPPOSITION ? true : false);
1095
   scene->gui.is_partspick_displayed = (board->game_state == STATE_SETUPPOSITION ? true : false);
1096
 
1096
 
1097
   //////////////////////////
1097
   //////////////////////////
1098
   // error and notifications
1098
   // error and notifications
1099
 
1099
 
1100
   // is the current player a computer AND are we playing a game right now
1100
   // is the current player a computer AND it is not idle AND are we playing a game right now
1101
   // AND has the computer been thinking for more than 5 seconds AND is there no "thinking" text yet ?
1101
   // AND has the computer been thinking for more than 5 seconds AND is there no "thinking" text yet ?
1102
   if ((board->players[Board_ColorToMove (board)].type == PLAYER_COMPUTER) && (board->game_state == STATE_PLAYING)
1102
   if ((board->players[Board_ColorToMove (board)].type == PLAYER_COMPUTER) && (board->players[Board_ColorToMove (board)].sleep_time < current_time)
1103
       && (board->lastmove_time + 5.0f < current_time) && !scene->gui.central_text.is_displayed)
1103
       && (board->game_state == STATE_PLAYING) && (board->lastmove_time + 5.0f < current_time) && !scene->gui.central_text.is_displayed)
1104
   {
1104
   {
1105
      Scene_UpdateText (&scene->gui.central_text, RGBA_TO_RGBACOLOR (255, 255, 255, 191), DURATION_INFINITE, true, LOCALIZE (L"Thinking")); // if so, display the "thinking" phrase in the middle of the screen
1105
      Scene_UpdateText (&scene->gui.central_text, RGBA_TO_RGBACOLOR (255, 255, 255, 191), DURATION_INFINITE, true, LOCALIZE (L"Thinking")); // if so, display the "thinking" phrase in the middle of the screen
1106
      scene->gui.want_spinwheel = true; // start spinning wheel
1106
      scene->gui.want_spinwheel = true; // start spinning wheel
1107
   }
1107
   }
1108
 
1108