예제 #1
0
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;
}
예제 #2
0
void LoopingBuffer::SetVolume(float _level)
{
	volume_ = _level < 0 ? 0 : _level > 1 ? 1 : _level;
	if(GetPlaying())
	{
		SoundManager::Instance().SetVolume(channel_, volume_);
	}
}
예제 #3
0
void LoopingBuffer::Stop()
{
	if(GetPlaying())
	{
		SoundManager::Instance().StopChannel(channel_);
		channel_ = -1;
		running_count_--;
		Logger::DiagnosticOut() << "Active loops--= " << running_count_ << "\n";
	}
}
예제 #4
0
const std::vector<float> & Replay::PlayFrame(unsigned carid, CarDynamics & car)
{
	assert(carid < carstate.size());
	assert(unsigned(version_info.inputs_supported) == CarInput::INVALID);

	if (GetPlaying() && !carstate[carid].PlayFrame(car))
	{
		replaymode = IDLE;
	}
	return carstate[carid].inputbuffer;
}
예제 #5
0
파일: replay.cpp 프로젝트: Anth5/vdrift
const std::vector<float> & REPLAY::PlayFrame(unsigned carid, CAR & car)
{
	assert(carid < carstate.size());
	assert(unsigned(version_info.inputs_supported) == CARINPUT::GAME_ONLY_INPUTS_START_HERE);

	if (GetPlaying() && !carstate[carid].PlayFrame(car))
	{
		replaymode = IDLE;
	}
	return carstate[carid].inputbuffer;
}
예제 #6
0
void LoopingBuffer::Start()
{
	if(filename_.length() == 0)
		return;
	if(!GetPlaying())
	{
		channel_ = SoundManager::Instance().PlayLoopingSample(filename_);
		SoundManager::Instance().SetVolume(channel_, volume_);
		running_count_++;
		Logger::DiagnosticOut() << "Active loops++=" << running_count_ << "\n";
	}
}
예제 #7
0
		bool GetStopped(void) const { return !GetPlaying(); }