/* FINAL DRAGON TEXT DISPLAY MODULE 4/25/05
JESSE HARRIS
DISPLAY TEXT ON SCREEN FOR NPC
*/
#include <mygba.h>
#include <hel.h>

extern TCustomTextInfo g_TextInfo;
extern u8 sprites[127];
u8 hita = 0;
u8 mytextdelay = 0;
u8 mytextshowcursor = 0;

extern u16 delay;

int myText()
{   //if you hit A exit
    hel_PadReadState();
    if(hel_Pad.Held.A && !delay)
    {
        hita = 1;
        delay = 20;
    }
    //if you hit A exit
    if(delay == 1  && hita)
    {
        ham_SetBgVisible(2,0);
        hel_CustomTextClear(&g_TextInfo);
        //ham_SetObjVisible(sprites[0], 1);
        for(int x = 0; x < 119; x++)
        {
            ham_SetObjVisible(sprites[x], 1);
        }
        mytextdelay = 0;
        mytextshowcursor = 0;
        delay=20;
        hita = 0;
        return 1;
    }
    //displays flashing PRESS A
    if(mytextdelay)
    {
        mytextdelay--;
    }
    else
    {
        if(mytextshowcursor)
        {
        hel_CustomTextPrint(&g_TextInfo, 1, 18, "Press A");
        mytextshowcursor = 0;
        }
        else
        {
        hel_CustomTextPrint(&g_TextInfo, 1, 18, "       ");
        mytextshowcursor = 1;
        }
    mytextdelay = 30;
    }
    //end flashing

    //wait for delay to read keystrokes
    if(delay)
    {
        delay--;
        return 0;
    }

    return 0;
}


/* END OF FILE */
