示例#1
0
void draw_resurrect_creature(struct GuiButton *gbtn)
{
    unsigned short flg_mem;
    flg_mem = lbDisplay.DrawFlags;
    lbDisplay.DrawFlags = Lb_SPRITE_TRANSPAR4;
    LbDrawBox(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, gbtn->height, 0);
    LbTextSetFont(winfont);
    LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, gbtn->height);
    struct Dungeon *dungeon;
    dungeon = get_my_dungeon();
    int i;
    i = selected_resurrect_creature(dungeon, gbtn);
    int tx_units_per_px;
    tx_units_per_px = ((gbtn->height*22/26) * 16) / LbTextLineHeight();
    if (i != -1)
    {
        struct CreatureStorage *cstore;
        cstore = &dungeon->dead_creatures[i];
        struct CreatureData *crdata;
        crdata = creature_data_get(cstore->model);
        lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT;
        LbTextDrawResizedFmt(0, 0, tx_units_per_px, " %s", get_string(crdata->namestr_idx));
        lbDisplay.DrawFlags = Lb_TEXT_HALIGN_RIGHT;
        LbTextDrawResizedFmt(0, 0, tx_units_per_px, "%s %d ", get_string(GUIStr_MnuLevel), (int)(cstore->explevel + 1));
    }
    lbDisplay.DrawFlags = flg_mem;
}
示例#2
0
void draw_out_of_sync_box(long a1, long a2, long box_width)
{
    long min_width,max_width;
    long ornate_width,ornate_height;
    long x,y;
    long text_x,text_y,text_h;
    min_width = 2*a1;
    max_width = 2*a2;
    if (min_width > max_width)
    {
        min_width = max_width;
    }
    if (min_width < 0)
    {
        min_width = 0;
    }
    int units_per_px;
    units_per_px = units_per_pixel;
    if (LbScreenLock() == Lb_SUCCESS)
    {
        ornate_width =  200*units_per_px/16;
        ornate_height = 100*units_per_px/16;
        x = box_width + (MyScreenWidth-box_width-ornate_width) / 2;
        y = (MyScreenHeight-ornate_height) / 2;
        draw_ornate_slab64k(x, y, units_per_px, ornate_width, ornate_height);
        LbTextSetFont(winfont);
        lbDisplay.DrawFlags = Lb_TEXT_HALIGN_CENTER;
        LbTextSetWindow(x, y, ornate_width, ornate_height);
        int tx_units_per_px;
        tx_units_per_px = (22 * units_per_px) / LbTextLineHeight();
        text_h = LbTextLineHeight()*tx_units_per_px/16;
        text_x = x + 100*units_per_px/16 - max_width;
        text_y = y +  58*units_per_px/16;
        LbTextDrawResized(0, 50*units_per_px/16 - text_h, tx_units_per_px, get_string(GUIStr_NetResyncing));
        LbDrawBox(text_x, text_y, 2*max_width, 16*units_per_px/16, 0);
        LbDrawBox(text_x, text_y, 2*min_width, 16*units_per_px/16, 133);
        LbScreenUnlock();
        LbScreenRender();
    }
}
示例#3
0
void draw_round_slab64k(long pos_x, long pos_y, int units_per_px, long width, long height)
{
    unsigned short drwflags_mem;
    drwflags_mem = lbDisplay.DrawFlags;
    lbDisplay.DrawFlags &= ~Lb_SPRITE_OUTLINE;
    lbDisplay.DrawFlags |= Lb_SPRITE_TRANSPAR4;
    LbDrawBox(pos_x + 4*units_per_px/16, pos_y + 4*units_per_px/16, width - 8*units_per_px/16, height - 8*units_per_px/16, 1);
    lbDisplay.DrawFlags &= ~Lb_SPRITE_TRANSPAR4;
    int x,y;
    struct TbSprite *spr;
    spr = &gui_panel_sprites[242];
    int ps_units_per_spr = 26*units_per_px/spr->SWidth;
    long i;
    for (i = 0; i < width - 68*units_per_px/16; i += 26*units_per_px/16)
    {
        x = pos_x + i + 34*units_per_px/16;
        y = pos_y;
        spr = &gui_panel_sprites[242];
        LbSpriteDrawResized(x, y, ps_units_per_spr, spr);
        y += height - 4*units_per_px/16;
        spr = &gui_panel_sprites[248];
        LbSpriteDrawResized(x, y, ps_units_per_spr, spr);
    }
    for (i = 0; i < height - 56*units_per_px/16; i += 20*units_per_px/16)
    {
        x = pos_x;
        y = pos_y + i + 28*units_per_px/16;
        spr = &gui_panel_sprites[244];
        LbSpriteDrawResized(x, y, ps_units_per_spr, spr);
        x += width - 4*units_per_px/16;
        spr = &gui_panel_sprites[246];
        LbSpriteDrawResized(x, y, ps_units_per_spr, spr);
    }
    x = pos_x + width - 34*units_per_px/16;
    y = pos_y + height - 28*units_per_px/16;
    spr = &gui_panel_sprites[241];
    LbSpriteDrawResized(pos_x, pos_y, ps_units_per_spr, spr);
    spr = &gui_panel_sprites[243];
    LbSpriteDrawResized(x,     pos_y, ps_units_per_spr, spr);
    spr = &gui_panel_sprites[247];
    LbSpriteDrawResized(pos_x, y,     ps_units_per_spr, spr);
    spr = &gui_panel_sprites[249];
    LbSpriteDrawResized(x,     y,     ps_units_per_spr, spr);
    lbDisplay.DrawFlags = drwflags_mem;
}
示例#4
0
void draw_transfer_creature(struct GuiButton *gbtn)
{
    unsigned long flgmem;
    if (gbtn == NULL)
      return;
    SYNCDBG(7,"Starting");
    flgmem = lbDisplay.DrawFlags;
    lbDisplay.DrawFlags = Lb_SPRITE_TRANSPAR4;
    LbTextSetFont(winfont);
    LbDrawBox(gbtn->scr_pos_x, gbtn->scr_pos_y,
        gbtn->width, gbtn->height, 0); // The 0 means black color
    LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y,
        gbtn->width, gbtn->height);
    struct Dungeon *dungeon;
    dungeon = get_my_dungeon();
    struct Thing *thing;
    thing = INVALID_THING;
    int listitm_idx;
    listitm_idx = selected_transfer_creature(dungeon, gbtn);
    int tx_units_per_px;
    tx_units_per_px = ((gbtn->height*22/26) * 16) / LbTextLineHeight();
    if (listitm_idx != -1)
    {
        thing = get_player_list_nth_creature_of_model(dungeon->creatr_list_start, 0, listitm_idx);
    }
    if (!thing_is_invalid(thing))
    {
        const struct CreatureControl *cctrl;
        cctrl = creature_control_get_from_thing(thing);
        const struct CreatureData *crdata;
        crdata = creature_data_get_from_thing(thing);
        lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT;
        LbTextDrawResizedFmt(0, 0, tx_units_per_px, " %s", get_string(crdata->namestr_idx));
        lbDisplay.DrawFlags = Lb_TEXT_HALIGN_RIGHT;
        LbTextDrawResizedFmt(0, 0, tx_units_per_px, "%s %d ", get_string(GUIStr_MnuLevel), (int)(cctrl->explevel+1));
    }
    lbDisplay.DrawFlags = flgmem;
}
void gui_draw_box(struct GuiBox *gbox)
{
    SYNCDBG(6,"Drawing box, first optn \"%s\"",gbox->optn_list->label);
    struct GuiBox *gbox_over;
    struct GuiBoxOption *goptn_over;
    struct GuiBoxOption *goptn;
    long lnheight;
    long mouse_x,mouse_y;
    long pos_x,pos_y;
    LbTextSetWindow(0, 0, MyScreenWidth/pixel_size, MyScreenHeight/pixel_size);
    mouse_x = GetMouseX();
    mouse_y = GetMouseY();
    goptn_over = NULL;
    gbox_over = gui_get_box_point_over(mouse_x, mouse_y);
    if (gbox_over != NULL)
    {
      goptn_over = gui_get_box_option_point_over(gbox_over, mouse_x, mouse_y);
    }

    LbTextSetFont(font_sprites);
    lnheight = pixel_size * LbTextLineHeight() + 2;
    pos_y = gbox->pos_y + 8;
    pos_x = gbox->pos_x + 8;
    if (gbox != gui_get_highest_priority_box())
    {
        lbDisplay.DrawFlags |= Lb_SPRITE_TRANSPAR4;
        LbDrawBox(gbox->pos_x/pixel_size, gbox->pos_y/pixel_size, gbox->width/pixel_size, gbox->height/pixel_size, colours[6][0][0]);
        if (lbDisplay.DrawFlags & Lb_SPRITE_OUTLINE)
        {
          LbDrawBox(gbox->pos_x/pixel_size, gbox->pos_y/pixel_size, gbox->width/pixel_size, gbox->height/pixel_size, colours[0][0][0]);
        } else
        {
          lbDisplay.DrawFlags ^= Lb_SPRITE_OUTLINE;
          LbDrawBox(gbox->pos_x/pixel_size, gbox->pos_y/pixel_size, gbox->width/pixel_size, gbox->height/pixel_size, colours[0][0][0]);
          lbDisplay.DrawFlags ^= Lb_SPRITE_OUTLINE;
        }
        lbDisplay.DrawFlags ^= Lb_SPRITE_TRANSPAR4;
        lbDisplay.DrawColour = colours[3][3][3];
        goptn = gbox->optn_list;
        while (goptn->label[0] != '!')
        {
          if (goptn->active_cb != NULL)
            goptn->field_26 = (goptn->active_cb)(gbox, goptn, &goptn->field_D);
          else
            goptn->field_26 = 1;
          if (!goptn->field_26)
            lbDisplay.DrawColour = colours[0][0][0];
          else
            lbDisplay.DrawColour = colours[3][3][3];
          if (LbScreenIsLocked())
          {
            LbTextDraw(pos_x/pixel_size, pos_y/pixel_size, goptn->label);
          }
          goptn++;
          pos_y += lnheight;
        }
    } else
    {
        lbDisplay.DrawFlags |= Lb_SPRITE_TRANSPAR4;
        LbDrawBox(gbox->pos_x/pixel_size, gbox->pos_y/pixel_size, gbox->width/pixel_size, gbox->height/pixel_size, colours[12][0][0]);
        if (lbDisplay.DrawFlags & Lb_SPRITE_OUTLINE)
        {
            LbDrawBox(gbox->pos_x/pixel_size, gbox->pos_y/pixel_size, gbox->width/pixel_size, gbox->height/pixel_size, colours[2][0][0]);
        } else
        {
            lbDisplay.DrawFlags ^= Lb_SPRITE_OUTLINE;
            LbDrawBox(gbox->pos_x/pixel_size, gbox->pos_y/pixel_size, gbox->width/pixel_size, gbox->height/pixel_size, colours[2][0][0]);
            lbDisplay.DrawFlags ^= Lb_SPRITE_OUTLINE;
        }
        lbDisplay.DrawFlags ^= Lb_SPRITE_TRANSPAR4;
        goptn = gbox->optn_list;
        while (goptn->label[0] != '!')
        {
            if (goptn->active_cb != NULL)
              goptn->field_26 = (goptn->active_cb)(gbox, goptn, &goptn->field_D);
            else
              goptn->field_26 = 1;
            if (!goptn->field_26)
              lbDisplay.DrawColour = colours[0][0][0];
            else
            if ( ((gbox == gbox_over) && (goptn == goptn_over) && (gbox != dragging_box.gbox)) ||
                 ((gbox != NULL) && (goptn->active != 0)) )
              lbDisplay.DrawColour = colours[15][15][15];
            else
              lbDisplay.DrawColour = colours[9][9][9];
            if (LbScreenIsLocked())
            {
              LbTextDraw(pos_x/pixel_size, pos_y/pixel_size, goptn->label);
            }
            goptn++;
            pos_y += lnheight;
        }
    }
}