carlito913 / editor-on-fire

Automatically exported from code.google.com/p/editor-on-fire
Other
0 stars 0 forks source link

Import GP tracks as different difficulties #266

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I figured that the shortest route possible for me to get going without issue 
265 would be to sequence the song in GP6 which while it doesn't support the 
ideas expressed in 265, I'm more familiar with and it supports BPM independent 
sequencing, repeat signs and a display mode where the different tracks in the 
song can be displayed at the same time and other editing features making my 
life easier.

I also figured that the structure of the song doesn't change between 
difficulties, so I might as well use GP6 to clone the track and in the new 
track replace notes with pauses to create the easier levels. This is then 
repeated to create as many difficulty levels that seems appropriate, each in 
it's own track in the gp6 song.

I was surprised to find that it was not possible to import different GP6 tracks 
into different difficulties in EOF though. Would this be easy to implement?

As a work around I importing the hardest level into the "Real Guitar" track, 
then import the one of the other levels into the "Real Guitar 22" track and 
copy paste it into the appropriate difficulty in the "Real Guitar" track, which 
works but is a little cumbersome.

Cheers

Original issue reported on code.google.com by quarns...@gmail.com on 27 Apr 2013 at 7:45

GoogleCodeExporter commented 8 years ago
This functionality could be added, it's related to something else on the big 
to-do list.

Original comment by raynebc on 27 Apr 2013 at 5:47

GoogleCodeExporter commented 8 years ago
FWIW I sat down and wrote something up myself (mostly cut'n'pasted from 
eof_gp_import_track) that appears to do what I want:

int eof_gp_import_all() {
    int selected, tracknum, ctr;
    if(eof_song && eof_song->track[eof_selected_track]->track_format == EOF_PRO_GUITAR_TRACK_FORMAT)
    {   //Only perform this action if a pro guitar/bass track is active

        if(!gp_import_undo_made)
        {   //If an undo state wasn't already made
            eof_prepare_undo(EOF_UNDO_TYPE_NONE);   //Make one now
            gp_import_undo_made = 1;
        }
        eof_clear_input();
        key[KEY_Y] = 0;
        key[KEY_N] = 0;

        for(ctr = eof_song->text_events; ctr > 0; ctr--)
        {   //For each of the project's text events (in reverse order)
            if(eof_song->text_event[ctr - 1]->track == eof_selected_track)
            {   //If the text event is assigned to the track being replaced
                eof_song_delete_text_event(eof_song, ctr - 1);  //Delete it
            }
        }
        unsigned long tracknum = eof_song->track[eof_selected_track]->tracknum;

        eof_parsed_gp_file->track[0]->parent = eof_song->pro_guitar_track[tracknum]->parent;
        for(ctr = 0; ctr < eof_song->pro_guitar_track[tracknum]->notes; ctr++)
        {   //For each note in the active track
            free(eof_song->pro_guitar_track[tracknum]->note[ctr]);  //Free its memory
        }

        free(eof_song->pro_guitar_track[tracknum]); //Free the active track
        eof_song->pro_guitar_track[tracknum] = eof_parsed_gp_file->track[0];    //Replace it with the track imported from the Guitar Pro file

        //Correct the track's tuning array from absolute to relative
        for(ctr = 0; ctr < 6; ctr++)
        {   //For each of the 6 supported strings
            int default_tuning = eof_lookup_default_string_tuning_absolute(eof_song->pro_guitar_track[tracknum], eof_selected_track, ctr);  //Get the default absolute tuning for this string
            if(default_tuning >= 0)
            {   //If the default tuning was found
                eof_song->pro_guitar_track[tracknum]->tuning[ctr] -= default_tuning;    //Convert the tuning to relative
                eof_song->pro_guitar_track[tracknum]->tuning[ctr] %= 12;    //Ensure the stored value is bounded to [-11,11]
            }
        }
        free(eof_parsed_gp_file->names[0]); //Free the imported track's name
        for (ctr = 0; ctr < eof_parsed_gp_file->track[0]->notes; ctr++) {
            eof_parsed_gp_file->track[0]->note[ctr]->type = 0;
        }
        eof_song->pro_guitar_track[tracknum]->parent->difficulty = eof_parsed_gp_file->numtracks;
        eof_song->pro_guitar_track[tracknum]->parent->numdiffs = eof_parsed_gp_file->numtracks;
        eof_song->pro_guitar_track[tracknum]->parent->flags |= EOF_TRACK_FLAG_UNLIMITED_DIFFS;

        for (selected = 1; selected < eof_parsed_gp_file->numtracks; selected++)
        {
            free(eof_parsed_gp_file->names[selected]);  //Free the imported track's name
            for (ctr = 0; ctr < eof_parsed_gp_file->track[selected]->notes; ctr++) {
                EOF_PRO_GUITAR_NOTE *note = eof_pro_guitar_track_add_note(eof_song->pro_guitar_track[tracknum]);
                memcpy(note, eof_parsed_gp_file->track[selected]->note[ctr], sizeof(EOF_PRO_GUITAR_NOTE));
                note->type = selected;
            }
        }
        eof_parsed_gp_file->numtracks = 0;
    }
}

Original comment by quarns...@gmail.com on 17 Jun 2013 at 12:03

GoogleCodeExporter commented 8 years ago
Completed in r1159.

Original comment by raynebc on 18 Jun 2013 at 8:35