I want make a radio stations in FV. Actually I've got sth like this:
Code:
void Radio()
{
Memb<Game::Obj*> obj;
Vec testPos=Players[0].pos()-Vec(0,Players[0].ctrl.height()/2,0);
Game::World.objQuery(obj,Ball(3,testPos),OBJ_STATIC);
REPA(obj)
if(Static *sta=CAST(Static,obj[i]))
if(sta->radio==ITEM_RADIO && sta->mesh && Dist(testPos,sta->mesh->box*sta->matrixScaled())<=Players[0].ctrl.radius()+3.0f)
{
radioPos=sta->pos();// if item is active item
}
if(Dist(Players[0].pos(),radioPos)<=3)
{
// change radio station
if(Kb.bp(KB_RBRACKET)){radioNumber+=1;radioPlaying=false;};
if(Kb.bp(KB_LBRACKET)){radioNumber-=1;radioPlaying=false;};
// min/max radio station
if(radioNumber>2)radioNumber=0;
if(radioNumber<0)radioNumber=2;
// show and set radio station name
comText->show();
comText->set(radioName);
// show window with instructions
comWindow->show();
comTextIn->show();
comTextIn->set("Radiostacje \n Aby zmienić stację naciśnij [ lub ]");
}else
{
comText ->hide();
comWindow->hide();
comTextIn->hide();
}
// radio station name and playlist
if(radioNumber==0 && !radioPlaying)
{
radioName="Party 105";
sound.play("sfx/Radio/Cascada - Fever.ogg",radioPos,2,true);
radioPlaying=true;
}
if(radioNumber==1 && !radioPlaying)
{
radioName="Chicago News";
sound.play("",radioPos,2,true);
radioPlaying=true;
}
if(radioNumber==2 && !radioPlaying)
{
radioName="FF Radio";
sound.play("sfx/Radio/Saragossa Band - Agadou.ogg",radioPos,2,true);
radioPlaying=true;
}
}
And have some questions about this:
1. I put in Ini radioPos=NULL but still when I start game, music and windows are in Vec(0,0,0) position.
2. How can I make sth like this: I go to one radio and I've got turn on station number 1 then I go to another radio and I've got another random radio station, but when I go back to this first radio this first radio station is still playing.
3. When I change radio stations music is starting from begin. Is it possible to make sth like fading between changing stations?
Pleas give me instructions how do this.