/* FINAL DRAGON MENU 4/25/05
JESSE HARRIS
DISPLAYS MENU SCREEN AND PERFORMS FLASHING OF CHOICES
ALSO CHANGES GAME STATE BASED ON SELECTION
*/
#include <mygba.h>
#include <hel.h>

extern u16 delay;
bool isStart = true;
int light = 123;
int lightdelta = 1;
int color = 110;
int troubleshootdelay = 15;

int myMenu()
{
    hel_PadReadState();
    //move between the choices
    if(hel_Pad.Held.Select && !delay)
    {
        delay = 10;
        if(isStart)
            {
            //ham_FlipBGBuffer();
            ham_SetBgPalColRGB(110, 50, 50, 50);
            color=77;
            isStart = false;
            }
        else
            {
            //ham_FlipBGBuffer();
            ham_SetBgPalColRGB(77, 50, 50, 50);
            color = 110;
            isStart = true;
            }

    }
    //send call for new game
    if(hel_Pad.Held.Start && isStart == 1)
    {
    delay = 160;
    return 1;
    }
    //send call for load game
    if(hel_Pad.Held.Start && isStart == 0)
    {
    delay = 160;
    return 2;
    }
    //fade light in and out
    if(light >= 180)
        {
        lightdelta = -2;
        }
    if(light <= 80)
        {
        lightdelta = 2;
        }
    ham_SetBgPalColRGB(color, light, light, light);
    light = light + lightdelta;

    //wait for delay to disappearto record keystroke
    if(delay)
    {
        delay--;
    }
 
    return 0;
}


/* END OF FILE */
