Subversion Repositories Games.Chess Giants

Rev

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

Rev 81 Rev 136
Line 107... Line 107...
107
   float deviation_distance;
107
   float deviation_distance;
108
   float turnspeed_yaw;
108
   float turnspeed_yaw;
109
   float turnspeed_pitch;
109
   float turnspeed_pitch;
110
   float turnspeed_distance;
110
   float turnspeed_distance;
111
 
111
 
112
   // do we NOT want autorotation OR are we NOT playing yet OR are we still in animation ?
112
   // (do we NOT want autorotation AND has the game started) OR are we NOT playing yet OR are we still in animation ?
113
   if (!options.want_autorotateon1vs1 || (the_board.game_state < STATE_PLAYING) || (current_time < animation_endtime + 1.0f))
113
   if ((!options.want_autorotateon1vs1 && (the_board.move_count > 1))
-
 
114
       || (the_board.game_state < STATE_PLAYING)
-
 
115
       || (current_time < animation_endtime + 1.0f))
114
      return (false); // if so, don't rotate anything
116
      return (false); // if so, don't rotate anything
115
 
117
 
116
   // compute what's left to turn yet
118
   // compute what's left to turn yet
117
   deviation_yaw = WrapAngle (player->view_yaw - current_yaw);
119
   deviation_yaw = WrapAngle (player->view_yaw - current_yaw);
118
   deviation_pitch = WrapAngle (player->view_pitch - current_pitch);
120
   deviation_pitch = WrapAngle (player->view_pitch - current_pitch);
Line 120... Line 122...
120
 
122
 
121
   // compute the new turn speed
123
   // compute the new turn speed
122
   turnspeed_yaw = ((float) options.rotate_speed * deviation_yaw) * min (frame_time, 0.01f);
124
   turnspeed_yaw = ((float) options.rotate_speed * deviation_yaw) * min (frame_time, 0.01f);
123
   turnspeed_pitch = ((float) options.rotate_speed * deviation_pitch) * min (frame_time, 0.01f);
125
   turnspeed_pitch = ((float) options.rotate_speed * deviation_pitch) * min (frame_time, 0.01f);
124
   turnspeed_distance = ((float) options.rotate_speed * deviation_distance) * min (frame_time, 0.01f);
126
   turnspeed_distance = ((float) options.rotate_speed * deviation_distance) * min (frame_time, 0.01f);
-
 
127
 
-
 
128
   // HACK: FIXME: if we're leaving closeup mode, reevaluate the board
-
 
129
   if ((current_distance == CLOSEUP_VIEW_DISTANCE) && (turnspeed_distance != 0))
-
 
130
      the_board.reevaluate = true; // FIXME FIXME ugly yuk
125
 
131
 
126
   // move the aim cursor
132
   // move the aim cursor
127
   current_yaw = WrapAngle (current_yaw + turnspeed_yaw);
133
   current_yaw = WrapAngle (current_yaw + turnspeed_yaw);
128
   current_pitch = WrapAngle (current_pitch + turnspeed_pitch);
134
   current_pitch = WrapAngle (current_pitch + turnspeed_pitch);
129
   current_distance = current_distance + turnspeed_distance;
135
   current_distance = current_distance + turnspeed_distance;
Line 165... Line 171...
165
 
171
 
166
         // rewind game 1 move back
172
         // rewind game 1 move back
167
         the_board.moves = (boardmove_t *) SAFE_realloc (the_board.moves, the_board.move_count, max (1, the_board.move_count - 1), sizeof (boardmove_t), false);
173
         the_board.moves = (boardmove_t *) SAFE_realloc (the_board.moves, the_board.move_count, max (1, the_board.move_count - 1), sizeof (boardmove_t), false);
168
         the_board.move_count = max (1, the_board.move_count - 1); // figure out how many moves we have now
174
         the_board.move_count = max (1, the_board.move_count - 1); // figure out how many moves we have now
169
         the_board.viewed_move = the_board.move_count - 1; // take us back to the last move
175
         the_board.viewed_move = the_board.move_count - 1; // take us back to the last move
170
 
-
 
-
 
176
         the_board.game_state = STATE_PLAYING; // remember the game is now playing (in case we wanted to cancel the closing move of a finished game, this opens the game again)
171
         do_update = true; // update the 3D scene
177
         do_update = true; // update the 3D scene
172
      }
178
      }
173
   }
179
   }
174
 
180
 
175
   return (do_update); // finished, return whether we update the scene or not
181
   return (do_update); // finished, return whether we update the scene or not