Viva La Samba semi-psuedo code.
Posted: Fri Sep 02, 2005 10:42 am
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:
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.
}