About Store Forum Documentation Contact



Post Reply 
[Solved] Radio stations
Author Message
Harry Offline
Member

Post: #1
[Solved] Radio stations
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.
(This post was last modified: 02-14-2011 11:25 AM by Harry.)
11-02-2009 05:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Radio stations
please check Sound.h header file,

Sound::time, Sound::fade*
11-02-2009 10:44 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Radio stations
Ok, thanks. I used some simple methods and I think that everything is finished:

http://www.sendspace.com/file/aqbjmi

What do you think about this?
11-03-2009 03:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply