const std::vector <float> & REPLAY::PlayFrame(CAR & car) { if (!GetPlaying()) { return inputbuffer; } frame++; assert(inputbuffer.size() == CARINPUT::GAME_ONLY_INPUTS_START_HERE); assert((unsigned int) version_info.inputs_supported == CARINPUT::GAME_ONLY_INPUTS_START_HERE); //fast forward through the inputframes until we're up to date while (cur_inputframe < inputframes.size() && inputframes[cur_inputframe].GetFrame() <= frame) { ProcessPlayInputFrame(inputframes[cur_inputframe]); cur_inputframe++; } //fast forward through the stateframes until we're up to date while (cur_stateframe < stateframes.size() && stateframes[cur_stateframe].GetFrame() <= frame) { if (stateframes[cur_stateframe].GetFrame() == frame) ProcessPlayStateFrame(stateframes[cur_stateframe], car); cur_stateframe++; } //detect end of input if (cur_stateframe == stateframes.size() && cur_inputframe == inputframes.size()) { StopPlaying(); } return inputbuffer; }
bool Replay::CarState::PlayFrame(CarDynamics & car) { frame++; assert(inputbuffer.size() == CarInput::INVALID); // fast forward through the inputframes until we're up to date while (cur_inputframe < inputframes.size() && inputframes[cur_inputframe].GetFrame() <= frame) { ProcessPlayInputFrame(inputframes[cur_inputframe]); cur_inputframe++; } // fast forward through the stateframes until we're up to date while (cur_stateframe < stateframes.size() && stateframes[cur_stateframe].GetFrame() <= frame) { if (stateframes[cur_stateframe].GetFrame() == frame) ProcessPlayStateFrame(stateframes[cur_stateframe], car); cur_stateframe++; } return (cur_stateframe != stateframes.size() || cur_inputframe != inputframes.size()); }
bool REPLAY::CARSTATE::PlayFrame(CAR & car) { frame++; assert(inputbuffer.size() == CARINPUT::GAME_ONLY_INPUTS_START_HERE); // fast forward through the inputframes until we're up to date while (cur_inputframe < inputframes.size() && inputframes[cur_inputframe].GetFrame() <= frame) { ProcessPlayInputFrame(inputframes[cur_inputframe]); cur_inputframe++; } // fast forward through the stateframes until we're up to date while (cur_stateframe < stateframes.size() && stateframes[cur_stateframe].GetFrame() <= frame) { if (stateframes[cur_stateframe].GetFrame() == frame) ProcessPlayStateFrame(stateframes[cur_stateframe], car); cur_stateframe++; } return (cur_stateframe != stateframes.size() || cur_inputframe != inputframes.size()); }