// tango.zh
// Version 1.2.0


// Style-related constants and functions.

// Style attributes
const int TANGO_STYLE_BACKDROP_TYPE          = 0;
const int TANGO_STYLE_BACKDROP_DATA          = 1; // Complex only
const int TANGO_STYLE_BACKDROP_COLOR         = 1; // Color only
const int TANGO_STYLE_BACKDROP_TILE          = 1; // Frame and tile only
const int TANGO_STYLE_BACKDROP_COMBO         = 1; // Frame and combo only
const int TANGO_STYLE_BACKDROP_CSET          = 2; // Frame, tile, and combo only
const int TANGO_STYLE_BACKDROP_WIDTH         = 3; // Image and color only
const int TANGO_STYLE_BACKDROP_HEIGHT        = 4; // Image and color only
const int TANGO_STYLE_TEXT_FONT              = 5;
const int TANGO_STYLE_TEXT_X                 = 6;
const int TANGO_STYLE_TEXT_Y                 = 7;
const int TANGO_STYLE_TEXT_WIDTH             = 8;
const int TANGO_STYLE_TEXT_HEIGHT            = 9;
const int TANGO_STYLE_TEXT_CSET              = 10; // Default
const int TANGO_STYLE_TEXT_COLOR             = 11; // Default (built-in fonts)
const int TANGO_STYLE_TEXT_SPEED             = 12; // Default
const int TANGO_STYLE_TEXT_SFX               = 13; // Default
const int TANGO_STYLE_TEXT_END_SFX           = 14;
const int TANGO_STYLE_MENU_CHOICE_INDENT     = 15;
const int TANGO_STYLE_MENU_CURSOR_COMBO      = 16;
const int TANGO_STYLE_MENU_CURSOR_CSET       = 17;
const int TANGO_STYLE_MENU_CURSOR_WIDTH      = 18;
const int TANGO_STYLE_MENU_CURSOR_HEIGHT     = 19;
const int TANGO_STYLE_MENU_CURSOR_MOVE_SFX   = 20;
const int TANGO_STYLE_MENU_SELECT_SFX        = 21;
const int TANGO_STYLE_MENU_CANCEL_SFX        = 22;
const int TANGO_STYLE_MENU_SCROLL_UP_COMBO   = 23;
const int TANGO_STYLE_MENU_SCROLL_UP_CSET    = 24;
const int TANGO_STYLE_MENU_SCROLL_UP_X       = 25;
const int TANGO_STYLE_MENU_SCROLL_UP_Y       = 26;
const int TANGO_STYLE_MENU_SCROLL_DOWN_COMBO = 27;
const int TANGO_STYLE_MENU_SCROLL_DOWN_CSET  = 28;
const int TANGO_STYLE_MENU_SCROLL_DOWN_X     = 29;
const int TANGO_STYLE_MENU_SCROLL_DOWN_Y     = 30;
const int TANGO_STYLE_MORE_COMBO             = 31;
const int TANGO_STYLE_MORE_CSET              = 32;
const int TANGO_STYLE_MORE_X                 = 33;
const int TANGO_STYLE_MORE_Y                 = 34;
const int TANGO_STYLE_FLAGS                  = 35;
const int __TANGO_SIZEOF_STYLE               = 36;

// Style flags
const int TANGO_FLAG_ENABLE_SPEEDUP     = 0000000001b;
const int TANGO_FLAG_ENABLE_SUPER_SPEED = 0000000010b;
const int TANGO_FLAG_AUTO_ADVANCE       = 0000000100b;
const int TANGO_FLAG_CARRY_OVER         = 0000001000b;
const int TANGO_FLAG_BLOCK_INPUT        = 0000010000b;
const int TANGO_FLAG_LINE_BY_LINE       = 0000100000b;
const int TANGO_FLAG_INSTANTANEOUS      = 0001000000b;
const int TANGO_FLAG_PERSISTENT         = 0010000000b;
const int TANGO_FLAG_CENTERED           = 0100000000b;
const int TANGO_FLAG_FREEZE_SCREEN      = 1000000000b;

// Backdrop types
const int TANGO_BACKDROP_CLEAR            = 0;
const int TANGO_BACKDROP_COLOR            = 1;
const int TANGO_BACKDROP_COLOR_TRANS      = 2;
const int TANGO_BACKDROP_TILE             = 3;
const int TANGO_BACKDROP_TILE_TRANS       = 4;
const int TANGO_BACKDROP_COMBO            = 5;
const int TANGO_BACKDROP_COMBO_TRANS      = 6;
const int TANGO_BACKDROP_COMPLEX          = 7;

// Complex frame drawing constants
const int TANGO_DRAW_TILE        = 1;
const int TANGO_DRAW_TILE_TRANS  = 2;
const int TANGO_DRAW_COMBO       = 3;
const int TANGO_DRAW_COMBO_TRANS = 4;
const int TANGO_DRAW_RECT        = 5;
const int TANGO_DRAW_RECT_TRANS  = 6;
const int TANGO_DRAW_TEXT        = 7;
const int TANGO_DRAW_TEXT_CENTER = 8;
const int TANGO_DRAW_TEXT_RIGHT  = 9;
const int TANGO_DRAW_END         = 0;

const int TANGO_TILE_ID     = 1; // Used for both tiles and combos
const int TANGO_TILE_CSET   = 2;
const int TANGO_TILE_X      = 3;
const int TANGO_TILE_Y      = 4;
const int TANGO_TILE_WIDTH  = 5;
const int TANGO_TILE_HEIGHT = 6;

const int TANGO_RECT_CSET   = 1;
const int TANGO_RECT_COLOR  = 2;
const int TANGO_RECT_X      = 3;
const int TANGO_RECT_Y      = 4;
const int TANGO_RECT_WIDTH  = 5;
const int TANGO_RECT_HEIGHT = 6;

const int TANGO_TEXT_STRING = 1;
const int TANGO_TEXT_FONT   = 2;
const int TANGO_TEXT_CSET   = 3;
const int TANGO_TEXT_COLOR  = 4;
const int TANGO_TEXT_X      = 5;
const int TANGO_TEXT_Y      = 6;

const int __TANGO_SIZEOF_DRAW_DATA = 7;


void Tango_SetStyleAttribute(int style, int attribute, int value)
{
    if(__Tango_ValidateStyle(style))
        __Tango_Styles[style*__TANGO_SIZEOF_STYLE+attribute]=value;
}

int Tango_GetStyleAttribute(int style, int attribute)
{
    if(!__Tango_ValidateStyle(style))
        return TANGO_INVALID;
    
    return __Tango_Styles[style*__TANGO_SIZEOF_STYLE+attribute];
}

int Tango_GetSlotStyle(int slot)
{
    if(!__Tango_ValidateSlot(slot))
        return TANGO_INVALID;
    
    return __Tango_SlotData[slot*__TANGO_SIZEOF_DATA+__TSDIDX_STYLE];
}

void Tango_SetSlotStyle(int slot, int style)
{
    if(__Tango_ValidateSlot(slot) && __Tango_ValidateStyle(style))
        __Tango_SlotData[slot*__TANGO_SIZEOF_DATA+__TSDIDX_STYLE]=style;
}

int Tango_GetSlotStyleAttribute(int slot, int attribute)
{
    if(!__Tango_ValidateSlot(slot))
        return TANGO_INVALID;
    
    int style=__Tango_SlotData[slot*__TANGO_SIZEOF_DATA+__TSDIDX_STYLE];
    return __Tango_Styles[style*__TANGO_SIZEOF_STYLE+attribute];
}

void Tango_ClearStyle(int style)
{
    if(!__Tango_ValidateStyle(style))
        return;
    
    int styleStart=style*__TANGO_SIZEOF_STYLE;
    
    for(int i=0; i<__TANGO_SIZEOF_STYLE; i++)
        __Tango_Styles[styleStart+i]=0;
}
