Page 1 of 1

Viva La Samba semi-psuedo code.

Posted: Fri Sep 02, 2005 10:42 am
by Falco Girgis
I'm rewriting alot of Viva La Samba. It's going good, but it isn't as "standalone" as I'd like.

I started working on this "one function call" load+play song system in Precal. I haven't worked on it any, but I'm typing it up during Adv. C and I'll try it out when I get home (or at least start on it).

It assumes that you have a directory with all of the files required for the song/theme. Then there's some sort of text file with the filenames and crap of the files, object attributes, and customizable stuff that will affect your song.

I really don't want to have to make a whole graphical interface program to make this file, but at the same time, I know how much people hate DOS console apps like this. Maybe I could have an "on website" PHP generator that'll spit out what your text file should have? (or just give you the text file).

Anyway, I'll be thinking on that. But this is what I've got so far:

Code: Select all

void PlaySong("Directory") {
    open text file
    get file names, locations
    create a linked list of files

    loop through complete list once to find total filesize
    for overall loadbar;
    
    while(still loading files) {
        if(done with current file) {
            move pointer to next node;
        } else {
            continue streaming current node;
        }
        Draw Overall Load Bar;
        Draw File Load Bar;
    }

    /*Move nodes of overall linked list to 
      their appropriate locations.*/

    while(current_node) {
        switch(current_node->type) {
            case BACKGROUND:
                Level.bg = current_node;
                break;
            case OBJECT:
                Level.last_object->next = current_node;
                Level.last_object = current_node;
                break;
            case SPRITE:
                Level.last_sprite->next = current_node;
                Level.last_sprite = current_node;
                break;
            case MUSIC:
                Level.music = current_node;
                break;
        }
    }
    Texture background
    Texture sprites
    Texture objects
    Set initial values of all object variables

    while(not pushing start) {
        Draw: Loading complete - push start to play song.
    }

    Start Playing Song
    
    while(song isn't over) {
        UpdateSong();
        GetInput();
        DoCrapWithInput();
        DrawEverything();
    }

    While(not pushing start) {
        DisplayStats();
    }

    Save to VMU;

    //Go back to whatever called this here function.
}

Posted: Fri Sep 02, 2005 1:07 pm
by MarauderIIC
Error checking (ie at open file stage) is planned even though not in psuedo, I hope.

Posted: Fri Sep 02, 2005 3:29 pm
by JS Lemming
Gyro wrote:I really don't want to have to make a whole graphical interface program to make this file, but at the same time, I know how much people hate DOS console apps like this.
If all else fails I can whip you up a win app that does that stuff for them. That would also alow users to easily costumize their crap via radio buttons, check box's, pretty much anything (if such costumization is required).

I'll do it if you want. Just give me the file format and user options and such.

Posted: Fri Sep 02, 2005 3:46 pm
by Falco Girgis
Hold that thought. I might be ready for something like that by the end of this weekend.

And yeah, I had planned that, Mar.