Viva La Samba semi-psuedo code.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Viva La Samba semi-psuedo code.

Post 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.
}
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post by MarauderIIC »

Error checking (ie at open file stage) is planned even though not in psuedo, I hope.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post 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.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post 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.
Post Reply