示例#1
0
void frontcredits_draw(void)
{
    struct CreditsItem *credit;
    TbBool did_draw;
    int fontid;
    long i;
    long h;
    const char *text;
    credits_offset -= credits_scroll_speed;
    frontend_copy_background();

    lbDisplay.DrawFlags = Lb_SPRITE_OUTLINE | Lb_TEXT_HALIGN_CENTER;
    LbTextSetWindow(0, 0, lbDisplay.PhysicalScreenWidth, lbDisplay.PhysicalScreenHeight);
    fontid = 1;
    LbTextSetFont(frontend_font[fontid]);
    h = credits_offset;
    did_draw = h > 0;
    for (i = 0; campaign.credits[i].kind != CIK_None; i++)
    {
        if (h >= lbDisplay.PhysicalScreenHeight)
          break;
        credit = &campaign.credits[i];
        if (credit->font != fontid)
        {
          fontid = credit->font;
          LbTextSetFont(frontend_font[fontid]);
        }
        int ln_height;
        ln_height = -LbTextLineHeight() * units_per_pixel / 16;
        if (h > ln_height)
        {
            switch (credit->kind)
            {
            case CIK_GStringId:
                text = gui_string(credit->num);
                break;
            case CIK_CStringId:
                text = cmpgn_string(credit->num);
                break;
            case CIK_DirectText:
                text = credit->str;
                break;
            default:
                text = "";
                break;
            }
            LbTextDrawResized(0, h, units_per_pixel, text);
            did_draw = 1;
        }
        h += ln_height + 2 * units_per_pixel / 16;
    }
    if (!did_draw)
    {
        credits_end = 1;
        credits_offset = lbDisplay.PhysicalScreenHeight;
    }
}
示例#2
0
void frontnet_draw_small_scroll_selection_box(struct GuiButton *gbtn, long font_idx, const char *text)
{
    struct TbSprite *spr;
    int pos_x, pos_y;
    pos_x = gbtn->scr_pos_x;
    pos_y = gbtn->scr_pos_y;
    spr = &frontend_sprite[55];
    int fs_units_per_px;
    fs_units_per_px = gbtn->height * 16 / spr->SHeight;
    LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, spr);
    pos_x += spr->SWidth * fs_units_per_px / 16;
    spr = &frontend_sprite[56];
    LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, spr);
    pos_x += spr->SWidth * fs_units_per_px / 16;
    LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, spr);
    pos_x += spr->SWidth * fs_units_per_px / 16;
    spr = &frontend_sprite[60];
    LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, spr);
    if (text != NULL)
    {
        LbTextSetFont(frontend_font[font_idx]);
        lbDisplay.DrawFlags = 0;
        int tx_units_per_px;
        tx_units_per_px = (gbtn->height*13/14) * 16 / LbTextLineHeight();
        int height;
        height = LbTextLineHeight() * tx_units_per_px / 16;
        LbTextSetWindow(gbtn->scr_pos_x + 13*fs_units_per_px/16, gbtn->scr_pos_y, gbtn->width - 26*fs_units_per_px/16, height);
        LbTextDrawResized(0, 0, tx_units_per_px, text);
    }
}
示例#3
0
void frontnet_draw_net_session_players(struct GuiButton *gbtn)
{
    int i;
    i = frontend_button_caption_font(gbtn, 0);
    lbDisplay.DrawFlags = 0;
    LbTextSetFont(frontend_font[i]);
    int tx_units_per_px;
    tx_units_per_px = gbtn->height * 16 / (2*LbTextLineHeight());
    const struct TbSprite *spr;
    spr = &frontend_sprite[21];
    int fs_units_per_px;
    fs_units_per_px = gbtn->height * 16 / (2*(spr->SHeight*13/8));
    int height;
    height = LbTextLineHeight() * tx_units_per_px / 16;
    long netplyr_idx;
    int shift_y;
    netplyr_idx = net_player_scroll_offset;
    for (shift_y=0; shift_y < gbtn->height; shift_y += height, netplyr_idx++)
    {
        const char *text;
        text = net_player[netplyr_idx].name;
        if (netplyr_idx >= net_number_of_enum_players)
            break;
        spr = &frontend_sprite[21+netplyr_idx];
        i = height - spr->SHeight * fs_units_per_px / 16;
        LbSpriteDrawResized(gbtn->scr_pos_x, gbtn->scr_pos_y + shift_y + abs(i)/2, fs_units_per_px, spr);
        LbTextSetWindow(gbtn->scr_pos_x, shift_y + gbtn->scr_pos_y, gbtn->width - spr->SWidth * fs_units_per_px / 16, height);
        LbTextDrawResized(spr->SWidth * fs_units_per_px / 16, 0, tx_units_per_px, text);
    }
}
示例#4
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;
}
示例#5
0
void message_draw(void)
{
    int i,h;
    long x,y;
    SYNCDBG(7,"Starting");
    LbTextSetFont(winfont);
    int tx_units_per_px;
    tx_units_per_px = (22 * units_per_pixel) / LbTextLineHeight();
    int ps_units_per_px;
    {
        struct TbSprite *spr;
        spr = &gui_panel_sprites[488];
        ps_units_per_px = (22 * units_per_pixel) / spr->SHeight;
    }
    h = LbTextLineHeight();
    x = 148*units_per_pixel/16;
    y = 28*units_per_pixel/16;
    for (i=0; i < game.active_messages_count; i++)
    {
        LbTextSetWindow(0, 0, MyScreenWidth, MyScreenHeight);
        set_flag_word(&lbDisplay.DrawFlags,Lb_TEXT_ONE_COLOR,false);
        LbTextDrawResized(x+32*units_per_pixel/16, y, tx_units_per_px, game.messages[i].text);
        draw_gui_panel_sprite_left(x, y, ps_units_per_px, 488+game.messages[i].plyr_idx);
        y += h*units_per_pixel/16;
    }
}
void frontstory_draw(void)
{
    frontend_copy_background();
    LbTextSetWindow(70*units_per_pixel/16, 70*units_per_pixel/16, (640-2*70)*units_per_pixel/16, (480-2*70)*units_per_pixel/16);
    LbTextSetFont(frontstory_font);
    lbDisplay.DrawFlags = Lb_TEXT_HALIGN_CENTER;
    int tx_units_per_px;
    tx_units_per_px = (26 * units_per_pixel) / LbTextLineHeight();
    LbTextDrawResized(0, 0, tx_units_per_px, get_string(frontstory_text_no));
}
示例#7
0
void frontcredits_input(void)
{
    int fontid;
    credits_scroll_speed = 1 * units_per_pixel / 16;
    fontid = 1;
    int speed;
    if ( lbKeyOn[KC_DOWN] )
    {
        LbTextSetFont(frontend_font[fontid]);
        speed = LbTextLineHeight() * units_per_pixel / 16;
        credits_scroll_speed = speed;
    } else
    if ((lbKeyOn[KC_UP]) && (credits_offset <= 0))
    {
        LbTextSetFont(frontend_font[fontid]);
        speed = -LbTextLineHeight() * units_per_pixel / 16;
        if (speed <= credits_offset)
          speed = credits_offset;
        credits_scroll_speed = speed;
    }
}
void gui_draw_all_boxes(void)
{
  struct GuiBox *gbox;
  SYNCDBG(5,"Starting");
  lbDisplay.DrawFlags = Lb_TEXT_ONE_COLOR;
  LbTextSetFont(font_sprites);
  gbox = gui_get_lowest_priority_box();
  while (gbox != NULL)
  {
    gui_draw_box(gbox);
    gbox = gui_get_next_highest_priority_box(gbox);
  }
}
struct GuiBox *gui_create_box(long x, long y, struct GuiBoxOption *optn_list)
{
  struct GuiBox *gbox;
  gbox = gui_allocate_box_structure();
  if (gbox == NULL)
    return NULL;
  // Setting gui font - will be required to properly calculate box dimensions
  LbTextSetFont(font_sprites);
  gbox->optn_list = optn_list;
  gbox->pos_x = x;
  gbox->pos_y = y;
  gbox->width = gui_calculate_box_width(gbox);
  gbox->height = gui_calculate_box_height(gbox);
  return gbox;
}
void frontend_draw_invert_mouse(struct GuiButton *gbtn)
{
    int font_idx;
    font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button);
    LbTextSetFont(frontend_font[font_idx]);
    LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, gbtn->height);
    int tx_units_per_px;
    tx_units_per_px = gbtn->height * 16 / LbTextLineHeight();
    const char *text;
    if (settings.first_person_move_invert) {
        text = get_string(GUIStr_On);
    } else {
        text = get_string(GUIStr_Off);
    }
    LbTextDrawResized(0, 0, tx_units_per_px, text);
}
示例#11
0
void frontbirthday_draw(void)
{
    frontend_copy_background();
    LbTextSetWindow(70, 70, 500, 340);
    LbTextSetFont(frontstory_font);
    lbDisplay.DrawFlags = Lb_SPRITE_OUTLINE;
    const char *name=get_team_birthday();
    if ( name != NULL )
    {
        unsigned short line_pos;
        line_pos = LbTextLineHeight();
        LbTextDraw(0, 170-line_pos, get_string(GUIStr_HappyBirthday));
        LbTextDraw(0, 170, name);
    } else
    {
        frontend_set_state(FeSt_INTRO);
    }
}
示例#12
0
void frontnet_draw_messages(struct GuiButton *gbtn)
{
    int font_idx;
    font_idx = frontend_button_caption_font(gbtn, 0);
    LbTextSetFont(frontend_font[font_idx]);
    lbDisplay.DrawFlags = 0;
    // While setting scale, aim for 4 lines of text
    int tx_units_per_px;
    tx_units_per_px = gbtn->height * 16 / (4*LbTextLineHeight());
    struct TbSprite *spr;
    spr = &frontend_sprite[21];
    int fs_units_per_px;
    fs_units_per_px = gbtn->height * 16 / (4*(spr->SHeight*13/8));
    int font_height;
    font_height = LbTextLineHeight() * tx_units_per_px / 16;
    int y;
    y = 0;
    int netmsg_id;
    for (netmsg_id=net_message_scroll_offset; netmsg_id < net_number_of_messages; netmsg_id++)
    {
        if (y + font_height/2 > gbtn->height)
            break;
        struct NetMessage *nmsg;
        nmsg = &net_message[netmsg_id];
        int num_active;
        num_active = 0;
        int i;
        for (i = nmsg->plyr_idx; i > 0; i--)
        {
          if ( net_player_info[i].active)
            num_active++;
        }

        spr = &frontend_sprite[21+num_active];

        i = font_height - spr->SHeight * fs_units_per_px / 16;
        LbSpriteDrawResized(gbtn->scr_pos_x, y + gbtn->scr_pos_y + (i >> 1), fs_units_per_px, spr);

        LbTextSetWindow(gbtn->scr_pos_x, y + gbtn->scr_pos_y, gbtn->width, min(font_height, gbtn->height-y));
        LbTextDrawResized(spr->SWidth * fs_units_per_px / 16, 0, tx_units_per_px, nmsg->text);

        y += font_height;
    }
}
示例#13
0
void draw_overlay_compass(long base_x, long base_y)
{
    unsigned short flg_mem;
    flg_mem = lbDisplay.DrawFlags;
    LbTextSetFont(winfont);
    lbDisplay.DrawFlags |= Lb_SPRITE_TRANSPAR4;
    LbTextSetWindow(0, 0, MyScreenWidth, MyScreenHeight);
    int units_per_px;
    units_per_px = (16*status_panel_width + 140/2) / 140;
    int tx_units_per_px;
    tx_units_per_px = (22 * units_per_px) / LbTextLineHeight();
    int w,h;
    w = (LbSprFontCharWidth(lbFontPtr,'/')*tx_units_per_px/16) / 2;
    h = (LbSprFontCharHeight(lbFontPtr,'/')*tx_units_per_px/16) / 2 + 2*units_per_px/16;
    struct PlayerInfo *player;
    player = get_my_player();
    const struct Camera *cam;
    cam = player->acamera;
    int center_x, center_y;
    int shift_x, shift_y;
    center_x = base_x*units_per_px/16 + MapDiagonalLength/2;
    center_y = base_y*units_per_px/16 + MapDiagonalLength/2;
    shift_x = (-(MapDiagonalLength*7/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = (-(MapDiagonalLength*7/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, get_string(GUIStr_MapN));
    }
    shift_x = ( (MapDiagonalLength*7/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = ( (MapDiagonalLength*7/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, get_string(GUIStr_MapS));
    }
    shift_x = ( (MapDiagonalLength*7/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = (-(MapDiagonalLength*7/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, get_string(GUIStr_MapE));
    }
    shift_x = (-(MapDiagonalLength*7/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = ( (MapDiagonalLength*7/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, get_string(GUIStr_MapW));
    }
    lbDisplay.DrawFlags = flg_mem;
}
示例#14
0
void draw_overlay_compass(long base_x, long base_y)
{
    unsigned short flg_mem;
    flg_mem = lbDisplay.DrawFlags;
    LbTextSetFont(winfont);
    lbDisplay.DrawFlags |= Lb_SPRITE_TRANSPAR4;
    LbTextSetWindow(0, 0, MyScreenWidth, MyScreenHeight);
    int units_per_px;
    units_per_px = (16*status_panel_width + 70) / 140;
    int tx_units_per_px;
    tx_units_per_px = (22 * units_per_px) / LbTextLineHeight();
    int w,h;
    w = (LbSprFontCharWidth(lbFontPtr,'/')*tx_units_per_px/16) / 2;
    h = (LbSprFontCharHeight(lbFontPtr,'/')*tx_units_per_px/16) / 2 + 2*units_per_px/16;
    struct PlayerInfo *player;
    player = get_my_player();
    struct Camera *cam;
    cam = player->acamera;
    int center_x, center_y;
    int shift_x, shift_y;
    center_x = base_x*units_per_px/16 + PANNEL_MAP_RADIUS*units_per_px/16;
    center_y = base_y*units_per_px/16 + PANNEL_MAP_RADIUS*units_per_px/16;
    shift_x = ((-(PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = ((-(PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, gui_strings[877]);
    }
    shift_x = (( (PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = (( (PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, gui_strings[879]);
    }
    shift_x = (( (PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = ((-(PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, gui_strings[878]);
    }
    shift_x = ((-(PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbCosL(cam->orient_a)) >> LbFPMath_TrigmBits;
    shift_y = (( (PANNEL_MAP_RADIUS*7/8)*units_per_px/16) * LbSinL(cam->orient_a)) >> LbFPMath_TrigmBits;
    if (LbScreenIsLocked()) {
        LbTextDrawResized(center_x + shift_x - w, center_y + shift_y - h, tx_units_per_px, gui_strings[880]);
    }
    lbDisplay.DrawFlags = flg_mem;
}
示例#15
0
void frontend_draw_load_game_button(struct GuiButton *gbtn)
{
    int i;
    i = frontend_load_game_button_to_index(gbtn);
    if (i < 0)
        return;
    // Select font to draw
    int font_idx;
    font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button);
    LbTextSetFont(frontend_font[font_idx]);
    lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT;
    // Set drawing window and draw the text
    int tx_units_per_px;
    tx_units_per_px = (gbtn->height*13/11) * 16 / LbTextLineHeight();
    int height;
    height = LbTextLineHeight() * tx_units_per_px / 16;
    LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height);
    LbTextDrawResized(0, 0, tx_units_per_px, save_game_catalogue[i].textname);
}
示例#16
0
void frontnet_draw_service_button(struct GuiButton *gbtn)
{
  int srvidx;
  // Find and verify selected network service
  srvidx = (long)gbtn->content + net_service_scroll_offset - 45;
  if (srvidx >= net_number_of_services)
    return;
  // Select font to draw
  int font_idx;
  font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button);
  LbTextSetFont(frontend_font[font_idx]);
  lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT;
  // Set drawing window and draw the text
  int tx_units_per_px;
  tx_units_per_px = gbtn->height * 16 / LbTextLineHeight();
  int height;
  height = LbTextLineHeight() * tx_units_per_px / 16;
  LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height);
  LbTextDrawResized(0, 0, tx_units_per_px, net_service[srvidx]);
}
示例#17
0
void frontnet_draw_session_button(struct GuiButton *gbtn)
{
    long sessionIndex;
    long febtn_idx;
    long height;

    febtn_idx = (long)gbtn->content;
    sessionIndex = net_session_scroll_offset + febtn_idx - 45;
    if ((sessionIndex < 0) || (sessionIndex >= net_number_of_sessions))
        return;
    int font_idx;
    font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button);
    LbTextSetFont(frontend_font[font_idx]);
    lbDisplay.DrawFlags = 0;
    int tx_units_per_px;
    tx_units_per_px = gbtn->height * 16 / LbTextLineHeight();
    height = LbTextLineHeight() * tx_units_per_px / 16;
    LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height);
    LbTextDrawResized(0, 0, tx_units_per_px, net_session[sessionIndex]->text);
}
示例#18
0
/**
 * Captures the screen to make a gameplay movie or screenshot image.
 * @return Returns 0 if no capturing was performed, nonzero otherwise.
 */
TbBool perform_any_screen_capturing(void)
{
    TbBool captured=0;
    if ((game.system_flags & GSF_CaptureSShot) != 0)
    {
        captured |= cumulative_screen_shot();
        set_flag_byte(&game.system_flags,GSF_CaptureSShot,false);
    }
    if ((game.system_flags & GSF_CaptureMovie) != 0)
    {
        captured |= movie_record_frame();
    }
    // Draw a text with bitmap font
    if (captured) {
        //Set font; if winfont isn't loaded, it should be NULL, so text will just be invisible
        LbTextSetFont(winfont);
        LbTextDraw(600*units_per_pixel/16, 4*units_per_pixel/16, "REC");
    }
    return captured;
}
示例#19
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();
    }
}
示例#20
0
void frontnet_draw_comport_button(struct GuiButton *gbtn)
{
    int i;
    int febtn_idx;
    febtn_idx = (long)gbtn->content;
    i = net_comport_scroll_offset + febtn_idx - 45;
    if (i < number_of_comports)
    {
        int font_idx;
        font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button);
        LbTextSetFont(frontend_font[font_idx]);
        lbDisplay.DrawFlags = 0;
        const char *text;
        text = get_net_comport_text(i);
        int tx_units_per_px;
        tx_units_per_px = (gbtn->height*13/14) * 16 / LbTextLineHeight();
        int height;
        height = LbTextLineHeight() * tx_units_per_px / 16;
        LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height);
        LbTextDrawResized(0, 0, tx_units_per_px, text);
    }
}
示例#21
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;
}
示例#22
0
TbBool draw_text_box(const char *text)
{
    long spritesy,spritesx;
    long box_width,box_height;
    long startx,starty;
    long n;
    LbTextSetFont(frontend_font[1]);
    n = LbTextStringWidth(text);
    if (n < (4*108)) {
        spritesy = 1;
        spritesx = n / 108;
    } else {
        spritesx = 4;
        spritesy = n / (3*108);
    }
    if (spritesy > 4) {
      ERRORLOG("Text too long for error box");
    }
    if (spritesx < 2) {
        spritesx = 2;
    } else
    if (spritesx > 4) {
        spritesx = 4;
    }
    box_width = (108 * spritesx + 18) * units_per_pixel / 16;
    box_height = 92 * units_per_pixel / 16;
    startx = (lbDisplay.PhysicalScreenWidth - box_width) / 2;
    starty = (lbDisplay.PhysicalScreenHeight - box_height) / 2;
    draw_message_box_at(startx, starty, box_width, box_height, spritesx, spritesy);
    // Draw the text inside box
    lbDisplay.DrawFlags = Lb_TEXT_HALIGN_CENTER;
    int tx_units_per_px;
    tx_units_per_px = ((box_height/4)*13/11) * 16 / LbTextLineHeight();
    LbTextSetWindow(startx, starty, box_width, box_height);
    n = LbTextLineHeight() * tx_units_per_px / 16;
    return LbTextDrawResized(0, (box_height - spritesy * n) / 2, tx_units_per_px, text);
}
示例#23
0
void frontnet_draw_session_selected(struct GuiButton *gbtn)
{
    //_DK_frontnet_draw_session_selected(gbtn);
    struct TbSprite *spr;
    long pos_x, pos_y;
    int i;
    pos_x = gbtn->scr_pos_x;
    pos_y = gbtn->scr_pos_y;
    int fs_units_per_px;
    fs_units_per_px = simple_frontend_sprite_height_units_per_px(gbtn, 56, 100);
    spr = &frontend_sprite[55];
    for (i=0; i < 6; i++)
    {
        LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, spr);
        pos_x += spr->SWidth * fs_units_per_px / 16;
        spr++;
    }
    if (net_session_index_active >= 0)
    {
        const char *text;
        text = net_session[net_session_index_active]->text;
        i = frontend_button_caption_font(gbtn, 0);
        if (text != NULL)
        {
            lbDisplay.DrawFlags = 0;
            LbTextSetFont(frontend_font[i]);
            // Set drawing window and draw the text
            int tx_units_per_px;
            tx_units_per_px = (gbtn->height*13/14) * 16 / LbTextLineHeight();
            int h;
            h = LbTextLineHeight()*tx_units_per_px/16;
            LbTextSetWindow(gbtn->scr_pos_x + 13*fs_units_per_px/16, gbtn->scr_pos_y, gbtn->width - 26*fs_units_per_px/16, h);
            LbTextDrawResized(0, 0, tx_units_per_px, text);
        }
    }
}
示例#24
0
/**
 * Displays easter egg messages on screen.
 */
void draw_eastegg(void)
{
  char *text;
  static long px[2]={0,0},py[2]={0,0};
  static long vx[2]={0,0},vy[2]={0,0};
  long i,k;
  SYNCDBG(5,"Starting");
  LbTextSetWindow(0, 0, MyScreenWidth, MyScreenHeight);
  if (eastegg_skeksis_cntr >= eastegg_skeksis_codes.length)
  {
      unsigned char pos;
      eastegg_skeksis_cntr++;
      LbTextSetFont(winfont);
      text=buf_sprintf("Dene says a big 'Hello' to Goth Buns, Tarts and Barbies");
      lbDisplay.DrawFlags = Lb_TEXT_ONE_COLOR;
      for (i=0; i<30; i+=2)
      {
        pos = game.play_gameturn - i;
        lbDisplay.DrawColour = pos;
        LbTextDraw((LbCosL(16*(long)pos) / 512 + 120) / pixel_size,
          (LbSinL(32*(long)pos) / 512 + 200) / pixel_size, text);
      }
      set_flag_word(&lbDisplay.DrawFlags,Lb_TEXT_ONE_COLOR,false);
      pos=game.play_gameturn;
      LbTextDraw((LbCosL(16*(long)pos) / 512 + 120) / pixel_size,
        (LbSinL(32*(long)pos) / 512 + 200) / pixel_size, text);
      if (eastegg_skeksis_cntr >= 255)
        eastegg_skeksis_cntr = 0;
  }

  if (game.eastegg01_cntr >= eastegg_feckoff_codes.length)
  {
    LbTextSetWindow(0/pixel_size, 0/pixel_size, MyScreenWidth/pixel_size, MyScreenHeight/pixel_size);
    lbDisplay.DrawFlags &= ~Lb_TEXT_ONE_COLOR;
    LbTextSetFont(winfont);
    i = 0;
    text = buf_sprintf("Simon says Hi to everyone he knows...");
    px[i] += vx[i];
    if (px[i] < 0)
    {
      px[i] = 0;
      vx[i] = -vx[i];
    }
    py[i] += vy[i];
    if (py[i] < 0)
    {
      py[i] = 0;
      vy[i] = -vy[i];
    }
    k = pixel_size*LbTextStringWidth(text);
    if (px[i]+k  >= MyScreenWidth)
    {
      vx[i] = -vx[i];
      px[i] = MyScreenWidth-k-1;
    }
    k = pixel_size*LbTextStringHeight(text);
    if (py[i]+k >= MyScreenHeight)
    {
      vy[i] = -vy[i];
      py[i] = MyScreenHeight-k-1;
    }
    if (LbScreenIsLocked())
    {
      LbTextDraw(px[i]/pixel_size, py[i]/pixel_size, text);
    }
    play_non_3d_sample_no_overlap(90);
  }
  if ((game.flags_font & FFlg_AlexCheat) == 0)
    return;

  if (game.eastegg02_cntr >= eastegg_jlw_codes.length)
  {
    LbTextSetWindow(0/pixel_size, 0/pixel_size, MyScreenWidth/pixel_size, MyScreenHeight/pixel_size);
    lbDisplay.DrawFlags &= ~Lb_TEXT_ONE_COLOR;
    LbTextSetFont(winfont);
    i = 1;
    text = buf_sprintf("Alex, hopefully lying on a beach with Jo, says Hi");
    px[i] += vx[i];
    if (px[i] < 0)
    {
      px[i] = 0;
      vx[i] = -vx[i];
    }
    py[i] += vy[i];
    if (py[i] < 0)
    {
      py[i] = 0;
      vy[i] = -vy[i];
    }
    k = pixel_size * LbTextStringWidth(text);
    if (px[i]+k >= MyScreenWidth)
    {
      vx[i] = -vx[i];
      px[i] = MyScreenWidth-k-1;
    }
    k = pixel_size * LbTextStringHeight(text);
    if (py[i]+k >= MyScreenHeight)
    {
      vy[i] = -vy[i];
      py[i] = MyScreenHeight-k-1;
    }
    if (LbScreenIsLocked())
      LbTextDraw(px[i]/pixel_size, py[i]/pixel_size, text);
    play_non_3d_sample_no_overlap(90);
  }
}
示例#25
0
/**
 * Processes GUI Boxes inputs.
 * @return Returns true if the input event was captured by a GUI Box.
 */
short gui_process_inputs(void)
{
    long mouse_y,mouse_x;
    struct GuiBox *gbox;
    struct GuiBox *hpbox;
    struct GuiBoxOption *goptn;
    short result;
    SYNCDBG(8,"Starting");
    mouse_x = GetMouseX();
    mouse_y = GetMouseY();
    result = false;
    hpbox = gui_get_highest_priority_box();
    goptn = NULL;
    if (dragging_box.gbox != NULL)
    {
      if (left_button_held)
      {
        if (hpbox != dragging_box.gbox)
        {
          gui_remove_box_from_list(dragging_box.gbox);
          gui_insert_box_at_list_top(dragging_box.gbox);
        }
        dragging_box.gbox->pos_x = mouse_x - dragging_box.start_x;
        dragging_box.gbox->pos_y = mouse_y - dragging_box.start_y;
      } else
      {
        dragging_box.gbox = NULL;
        left_button_released = 0;
      }
      result = true;
    } else
    if (left_button_clicked)
    {
      LbTextSetFont(font_sprites);
      gbox = gui_get_box_point_over(left_button_clicked_x, left_button_clicked_y);
      if (gbox != NULL)
      {
        goptn = gui_get_box_option_point_over(gbox, left_button_clicked_x, left_button_clicked_y);
        if (gbox != hpbox)
        {
          gui_remove_box_from_list(gbox);
          gui_insert_box_at_list_top(gbox);
          left_button_clicked = 0;
        } else
        if (goptn == NULL)
        {
          dragging_box.gbox = hpbox;
          dragging_box.start_x = left_button_clicked_x - gbox->pos_x;
          dragging_box.start_y = left_button_clicked_y - gbox->pos_y;
          left_button_clicked = 0;
        }
        result = true;
      }
    } else
    if (left_button_released)
    {
      gbox = gui_get_box_point_over(left_button_clicked_x, left_button_clicked_y);
      if (gbox != NULL)
      {
        LbTextSetFont(font_sprites);
        goptn = gui_get_box_option_point_over(gbox, left_button_clicked_x, left_button_clicked_y);
        if ((gbox == hpbox) && (goptn != NULL))
        {
          gui_process_option_inputs(hpbox, goptn);
        }
        result = true;
      }
    }
    if (right_button_released)
    {
      gbox = gui_get_box_point_over(left_button_clicked_x, left_button_clicked_y);
      if (gbox != NULL)
      {
        LbTextSetFont(font_sprites);
        goptn = gui_get_box_option_point_over(gbox, left_button_clicked_x, left_button_clicked_y);
        if ((gbox == hpbox) && (goptn != NULL))
        {
          gui_process_option_inputs(hpbox, goptn);
        }
        result = true;
      }
    }
/* These are making incorrect mouse function in possesion - thus disabled
    if (hpbox != NULL)
    {
      if (is_key_pressed(KC_UP,KM_NONE))
      {
        goptn = gui_move_active_box_option(hpbox,-1);
        clear_key_pressed(KC_UP);
        result = true;
      } else
      if (is_key_pressed(KC_DOWN,KM_NONE))
      {
        goptn = gui_move_active_box_option(hpbox,1);
        clear_key_pressed(KC_DOWN);
        result = true;
      }
      if (is_key_pressed(KC_PGUP,KM_NONE))
      {
        goptn = gui_move_active_box_option(hpbox,-2);
        clear_key_pressed(KC_PGUP);
        result = true;
      }
      if (is_key_pressed(KC_PGDOWN,KM_NONE))
      {
        goptn = gui_move_active_box_option(hpbox,2);
        clear_key_pressed(KC_PGDOWN);
        result = true;
      }
    }
*/
    SYNCDBG(9,"Returning %s",result?"true":"false");
    return result;
}
示例#26
0
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;
        }
    }
}
示例#27
0
void frontend_draw_high_score_table(struct GuiButton *gbtn)
{
    struct TbSprite *spr;
    struct TbSprite *swpspr;
    long pos_x,pos_y;
    long col1_width,col2_width,col3_width,col4_width;
    long i,k;
    // Detect scaling factor is quite complicated for this item
    int fs_units_per_px;
    {
        int orig_size;
        orig_size = 0;
        spr = &frontend_sprite[33];
        for (i=0; i < 6; i++)
        {
            orig_size += spr->SWidth;
            spr++;
        }
        fs_units_per_px = (gbtn->width * 16 + orig_size/2) / orig_size;
    }
    // Draw the high scores area - top
    pos_x = gbtn->scr_pos_x;
    pos_y = gbtn->scr_pos_y;
    spr = &frontend_sprite[25];
    swpspr = spr;
    for (i=6; i > 0; i--)
    {
        LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, swpspr);
        pos_x += swpspr->SWidth * fs_units_per_px / 16;
        swpspr++;
    }
    pos_y += spr->SHeight * fs_units_per_px / 16;
    // Draw the high scores area - filling
    k = 12;
    while (k > 0)
    {
        if (k < 3)
          i = 33;
        else
          i = 40;
        spr = &frontend_sprite[i];
        pos_x = gbtn->scr_pos_x;
        swpspr = spr;
        for (i=6; i > 0; i--)
        {
          LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, swpspr);
          pos_x += swpspr->SWidth * fs_units_per_px / 16;
          swpspr++;
        }
        pos_y += spr->SHeight * fs_units_per_px / 16;
        if (k < 3)
          k--;
        else
          k -= 3;
    }
    // Draw the high scores area - bottom
    pos_x = gbtn->scr_pos_x;
    spr = &frontend_sprite[47];
    swpspr = spr;
    for (i=6; i > 0; i--)
    {
        LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, swpspr);
        pos_x += swpspr->SWidth * fs_units_per_px / 16;
        swpspr++;
    }
    LbTextSetFont(frontend_font[1]);
    lbDisplay.DrawFlags = 0;
    spr = &frontend_sprite[33];
    pos_x = gbtn->scr_pos_x + spr->SWidth * fs_units_per_px / 16;
    spr = &frontend_sprite[25];
    pos_y = gbtn->scr_pos_y + (spr->SHeight + 3) * fs_units_per_px / 16;
    int tx_units_per_px;
    // The GUI item height should be 11 lines of text
    tx_units_per_px = gbtn->height * 16 / (11*(LbTextLineHeight()));
    col1_width = LbTextStringWidth("99") * tx_units_per_px / 16;
    col2_width = LbTextStringWidth(" 99999") * tx_units_per_px / 16;
    col3_width = LbTextStringWidth(" 999") * tx_units_per_px / 16;
    col4_width = LbTextCharWidth('-') * tx_units_per_px / 16;
    for (k=0; k < VISIBLE_HIGH_SCORES_COUNT-1; k++)
    {
        draw_high_score_entry(k, pos_x, pos_y, col1_width, col2_width, col3_width, col4_width, tx_units_per_px);
        pos_y += LbTextLineHeight() * tx_units_per_px / 16;
    }
    if (high_score_entry_input_active > k)
      draw_high_score_entry(high_score_entry_input_active, pos_x, pos_y, col1_width, col2_width, col3_width, col4_width, tx_units_per_px);
    else
      draw_high_score_entry(k, pos_x, pos_y, col1_width, col2_width, col3_width, col4_width, tx_units_per_px);
}
示例#28
0
/**
 * Does high score table new entry input.
 * @return True if the entry input is active, false otherwise.
 */
TbBool frontend_high_score_table_input(void)
{
    struct HighScore *hscore;
    char chr;
    long i;
    if (high_score_entry_input_active >= campaign.hiscore_count)
        high_score_entry_input_active  = -1;
    if (high_score_entry_input_active < 0)
        return false;
    if (lbInkey == KC_BACK)
    {
        // Delete previous character
        if (high_score_entry_index > 0)
        {
            i = high_score_entry_index-1;
            while (high_score_entry[i] != '\0') {
                high_score_entry[i] = high_score_entry[i+1];
                i++;
            }
            high_score_entry_index -= 1;
        }
        clear_key_pressed(KC_BACK);
        return true;
    }
    if (lbInkey == KC_DELETE)
    {
        // Delete next character
        i = high_score_entry_index;
        while (high_score_entry[i] != '\0') {
            high_score_entry[i] = high_score_entry[i+1];
            i++;
        }
        clear_key_pressed(KC_DELETE);
        return true;
    }
    if (lbInkey == KC_LEFT)
    {
        // Move cursor left
        if (high_score_entry_index > 0) {
            high_score_entry_index--;
        }
        clear_key_pressed(KC_LEFT);
        return true;
    }
    if (lbInkey == KC_RIGHT)
    {
        // Move cursor right
        i = high_score_entry_index;
        if (high_score_entry[i] != '\0') {
            high_score_entry_index++;
        }
        clear_key_pressed(KC_RIGHT);
        return true;
    }
    if ((lbInkey == KC_HOME) || (lbInkey == KC_PGUP))
    {
        // Move cursor to beginning.
        high_score_entry_index = 0;
        clear_key_pressed(lbInkey);
    }
    if ((lbInkey == KC_END) || (lbInkey == KC_PGDOWN))
    {
        // Move cursor to end.
        while (high_score_entry[high_score_entry_index] != '\0')
        {
            high_score_entry_index++;
        }
        clear_key_pressed(lbInkey);
    }
    if ((lbInkey == KC_RETURN) || (lbInkey == KC_NUMPADENTER) || (lbInkey == KC_ESCAPE))
    {
        hscore = &campaign.hiscore_table[high_score_entry_input_active];
        if (lbInkey == KC_ESCAPE) {
            strncpy(hscore->name, get_string(GUIStr_TeamLeader), HISCORE_NAME_LENGTH);
        } else {
            strncpy(hscore->name, high_score_entry, HISCORE_NAME_LENGTH);
        }
        high_score_entry_input_active = -1;
        save_high_score_table();
        clear_key_pressed(lbInkey);
        return true;
    }
    if (high_score_entry_index < HISCORE_NAME_LENGTH)
    {
        chr = key_to_ascii(lbInkey, key_modifiers);
        if (chr != 0)
        {
            int entry_len;
            entry_len = strlen(high_score_entry);
            LbTextSetFont(frontend_font[1]);
            i = LbTextCharWidth(chr);
            if ((entry_len < (HISCORE_NAME_LENGTH - 1)) &&
                ((i > 0) && (i + LbTextStringWidth(high_score_entry) < 308)))
            {
                i = entry_len;
                high_score_entry[i+1] = '\0';
                while (i > high_score_entry_index) {
                    high_score_entry[i] = high_score_entry[i-1];
                    i--;
                }
                high_score_entry[i] = chr;
                high_score_entry_index = i + 1;
                clear_key_pressed(lbInkey);
                return true;
            }
        }
    }
    // No input, but return true to make sure other input functions are skipped
    return true;
}
void frontend_draw_define_key(struct GuiButton *gbtn)
{
    long content, key_id;
    content = (long)gbtn->content;
    key_id = define_key_scroll_offset - content - 1;
    if (key_id >= GAME_KEYS_COUNT) {
        return;
    }
    unsigned char code;
    code = settings.kbkeys[key_id].code;
    long i;
    char chbuf[4];
    const char * keyname;
    i = key_to_string[code];
    if (i >= 0)
    {
        keyname = get_string(i);
    } else
    {
        chbuf[0] = -(char)i;
        chbuf[1] = 0;
        keyname = chbuf;
    }
    if (frontend_mouse_over_button == content) {
        LbTextSetFont(frontend_font[2]);
    } else {
        LbTextSetFont(frontend_font[1]);
    }
    lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT;
    int tx_units_per_px;
    // This text is a bit condensed - button size is smaller than text height
    tx_units_per_px = (gbtn->height*13/11) * 16 / LbTextLineHeight();
    LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, gbtn->height);
    int height;
    height = LbTextLineHeight() * tx_units_per_px / 16;
    LbTextDrawResized(0, (gbtn->height - height) / 2, tx_units_per_px, get_string(definable_key_string[key_id]));
    unsigned char mods;
    mods = settings.kbkeys[key_id].mods;
    lbDisplay.DrawFlags = Lb_TEXT_HALIGN_RIGHT;

    char text[255];
    text[0] = '\0';
    if (mods & KMod_CONTROL)
    {
        strcat(text, get_string(GUIStr_KeyControl));
        strcat(text, " ");
    }
    if (mods & KMod_ALT)
    {
        strcat(text, get_string(GUIStr_KeyAlt));
        strcat(text, " ");
    }
    if (mods & KMod_SHIFT)
    {
        strcat(text, get_string(GUIStr_KeyShift));
        strcat(text, " ");
    }

    const char *keytext;
    switch (code)
    {
      case KC_LSHIFT:
      case KC_RSHIFT:
        keytext = get_string(GUIStr_KeyShift);
        break;
      case KC_LCONTROL:
      case KC_RCONTROL:
        keytext = get_string(GUIStr_KeyControl);
        break;
      case KC_LALT:
      case KC_RALT:
        keytext = get_string(GUIStr_KeyAlt);
        break;
      default:
        keytext = keyname;
        break;
    }
    strcat(text, keytext);
    height = LbTextLineHeight() * tx_units_per_px / 16;
    LbTextDrawResized(0, (gbtn->height - height) / 2, tx_units_per_px, text);
}