/* This file was generated by scramble.py. */
#line 1 "src/menu.py"
#include "menu.h"
#define _scramble_max(x, y) ((y) > (x) ? (y) : (x))
#line 20
Menu menu;
static void _gradient(int x, int y, int w, int h, LandColor c1, LandColor c2);
static void _gradient3(int x, int y, int w, int h, float p2, LandColor c1, LandColor c2, LandColor c3);
static void _gradienth(int x, int y, int w, int h, LandColor c1, LandColor c2);
static void _circ(int cx, int cy, int cr, LandColor c1, LandColor c2);
static void _fancy_line(int x1, int y1, int x2, int y2, int s, int t);
static void _stats(int uid, int page);
static void _stats_box(int x, int w, str name, LandColor color, int uid, int page);
static void _frame(int * x_, int * y_, int * w_, int * h_, LandColor * back_);
#line 22
MenuItem* menu_item_new(str name, Kind * place, bool enabled) {
    MenuItem * item;
#line 23
    land_alloc(item);
    item->name = land_strdup(name);
    item->enabled = enabled;
    item->place = place;
    return item;
}
void menu_item_destroy(MenuItem * self) {
    land_free(self->name);
    land_free(self);
}
void menu_add_if(str item, Kind * place, bool enabled) {
    land_font_set(font_menu);
    int tw = land_text_get_width(item);
    menu.h += land_line_height() * 1.5;
    land_font_set(font_small);
    tw += land_text_get_width("99") /* cost */;
    tw += land_text_get_width(" upkeep");
#line 41
    if (tw > menu.w) {
        menu.w = tw;
    }
    if (place && place->cost > game->gold) {
        enabled = 0;
    }
#line 46
    land_array_add(menu.items, menu_item_new(item, place, enabled));
}
void menu_click(int x, int y) {
    land_scale_to_fit(1280, 720, 0);
    land_font_set(font_menu);
    float lh = land_line_height();
#line 53
    if (menu.shown) {
        int ix = x - menu.x;
        int iy = y - (menu.y + lh / 4);
        if (ix >= 0 && iy >= 0) {
            ix /= menu.w;
            iy /= lh * 1.5;
            if (ix == 0 && iy < land_array_count(menu.items)) {
                MenuItem * m = land_array_get(menu.items, iy);
                if (m->enabled) {
                    menu_show(menu.click_x, menu.click_y, m);
#line 62
                    return ;
                }
            }
        }
#line 64
        menu.shown = 0;
#line 64
        return ;
    }
    menu_show(x, y, menu_item_new("Main", NULL, 1));
}
void menu_clear(void) {
    if (menu.items) {
        {
#line 70
            LandArrayIterator __iter0__ = LandArrayIterator_first(menu.items);
#line 70
            for (MenuItem * i = LandArrayIterator_item(menu.items, &__iter0__); LandArrayIterator_next(menu.items, &__iter0__); i = LandArrayIterator_item(menu.items, &__iter0__)) {
                menu_item_destroy(i);
            }
        }
#line 72
        land_array_destroy(menu.items);
    }
#line 73
    menu.items = land_array_new();
}
void menu_show(int x, int y, MenuItem * item) {
    float lh = land_line_height();
    menu.w = 0;
    menu.h = lh * 0.5;
    menu.shown = 0;
    menu.click_x = x;
    menu.click_y = y;
#line 83
    char * name = land_strdup(item->name);
    Kind * place = item->place;
#line 86
    menu_clear();
#line 88
    if (land_equals(name, "Main")) {
        Tile * tile = dungeon_tile(game->dungeon, game->selx, game->sely);
        bool is_floor = tile->kind == 1 && tile->creature == 0;
        bool can_build = 0;
#line 93
        if (game->selx >= 3 && dungeon_kind(game->dungeon, game->selx, game->sely) == 2 && dungeon_kind(game->dungeon, game->selx, game->sely + 1) == 1) {
            can_build = 1;
        }
        if (can_build) {
            menu_add_if("Vendor", NULL, 1);
            menu_add_if("Quest Giver", NULL, 1);
        }
#line 99
        if (is_floor) {
            menu_add_if("Trap", NULL, 1);
            menu_add_if("Monster", NULL, 1);
        }
#line 102
        menu_add_if("Dungeon", NULL, 1);
        if (! can_build) {
            menu_add_if("Vendor", NULL, 0);
            menu_add_if("Quest Giver", NULL, 0);
        }
#line 106
        if (! is_floor) {
            menu_add_if("Trap", NULL, 0);
            menu_add_if("Monster", NULL, 0);
        }
    }
#line 110
    else if (land_equals(name, "Dungeon")) {
        menu_add_if("Utilities Bill", NULL, 1);
        menu_add_if("Level", NULL, 1);
        menu_add_if("System", NULL, 1);
    }
#line 114
    else if (land_equals(name, "Utilities Bill")) {
        game->show_bill = 1;
        game->paused = 1;
    }
#line 117
    else if (land_equals(name, "Level")) {
        for (int i = 1; i < 10; i += 1) {
            char mname [100];
            sprintf(mname, "Level %d", i);
            menu_add_if(mname, NULL, i != game->level && i <= game->level_unlocked);
        }
    }
#line 122
    else if (land_equals(name, "System")) {
        menu_add_if("Fullscreen", NULL, 1);
        menu_add_if("Music", NULL, 1);
        menu_add_if("Recreate Level", NULL, 1);
        menu_add_if("Restart Game", NULL, 1);
    }
#line 127
    else if (land_equals(name, "Restart Game")) {
        menu_add_if("Yes", NULL, 1);
        menu_add_if("No", NULL, 1);
    }
#line 130
    else if (land_equals(name, "Music")) {
        menu_add_if("Off", NULL, 1);
        menu_add_if("Quiet", NULL, 1);
        menu_add_if("Ambient", NULL, 1);
        menu_add_if("Loud", NULL, 1);
    }
#line 135
    else if (land_equals(name, "Off")) {
#line 135
        game_music_volume(0);
    }
#line 136
    else if (land_equals(name, "Quiet")) {
#line 136
        game_music_volume(1);
    }
#line 137
    else if (land_equals(name, "Ambient")) {
#line 137
        game_music_volume(2);
    }
#line 138
    else if (land_equals(name, "Loud")) {
#line 138
        game_music_volume(3);
    }
#line 139
    else if (land_equals(name, "Recreate Level")) {
        game_reset();
    }
#line 141
    else if (land_equals(name, "Fullscreen")) {
        land_display_toggle_fullscreen();
        goto done;
    }
#line 144
    else if (land_equals(name, "Yes")) {
        game_new();
        goto done;
    }
#line 147
    else if (land_equals(name, "Trap")) {
        menu_add_if("Loot Box", game->trap_box, 1);
        menu_add_if("Poison Trap", game->trap_poison, game->level >= 2);
        menu_add_if("Fire Trap", game->trap_fire, game->level >= 3);
        menu_add_if("Lightning Trap", game->trap_lightning, game->level >= 4);
    }
#line 152
    else if (land_equals(name, "Quest Giver")) {
        menu_add_if("Fetch Quest", game->quest1, 1);
        menu_add_if("Grind Quest", game->quest2, game->level >= 2);
        menu_add_if("Main Quest", game->quest3, game->level >= 3);
        menu_add_if("Boss Quest", game->quest4, game->level >= 4);
    }
#line 157
    else if (land_equals(name, "Vendor")) {
        menu_add_if("Potions", game->vendor_potion, 1);
        menu_add_if("Weapons", game->vendor_smith, 1);
        menu_add_if("Headwear", game->vendor_head, 1);
        menu_add_if("Apparel", game->vendor_shield, game->level >= 3);
    }
#line 162
    else if (land_equals(name, "Monster")) {
        menu_add_if("Giant Rat", game->rat, 1);
        menu_add_if("Troll", game->level < 5 ? game->troll : game->troll2, game->level >= 2);
        menu_add_if("Demonic Maniac", game->priest, game->level >= 4);
        menu_add_if("Dragon", game->dragon, game->level >= 7);
    }
#line 167
    else if (place) {
        game->gold -= place->cost;
        if (place->is_creature) {
            game_spawn_selected_monster(place);
        }
#line 170
        else {
#line 172
            data_play(DataBuild);
            game_place_selected_kind(place->kid);
            if (land_equals(name, "Fetch Quest")) {
                dungeon_add_quest(game->dungeon, 1, 1);
            }
#line 176
            else if (land_equals(name, "Grind Quest")) {
                dungeon_add_quest(game->dungeon, 2, 1);
            }
#line 178
            else if (land_equals(name, "Main Quest")) {
                dungeon_add_quest(game->dungeon, 3, 1);
            }
#line 180
            else if (land_equals(name, "Boss Quest")) {
                dungeon_add_quest(game->dungeon, 4, 1);
            }
        }
#line 182
        goto done;
    }
#line 183
    else if (land_starts_with(name, "Level ")) {
        int l = 0;
        sscanf(name, "Level %d", & l);
        game_change_level(l - game->level);
    }
#line 186
    else {
#line 188
        goto done;
    }
    if (land_array_is_empty(menu.items)) {
        goto done;
    }
    menu.shown = 1;
#line 195
    menu.w += lh;
#line 197
    x += 40;
    y -= menu.h / 2;
#line 200
    if (y < 10) {
        y = 10;
    }
#line 202
    if (y + menu.h > 720 - 10) {
        y = 720 - 10 - menu.h;
    }
#line 204
    if (x > 1280 - 10 - menu.w) {
        x -= 80 + menu.w;
    }
    menu.x = x;
    menu.y = y;
#line 210
    done:;
    land_free(name);
}
void menu_draw_hover_info(void) {
    if (! game->hover_cid) {
#line 214
        return ;
    }
#line 215
    Creature * c = dungeon_creature(game->dungeon, game->hover_cid);
#line 217
    land_font_set(font_small);
    land_color(1, 1, 0, 1);
    land_text_pos(game->mx, game->my - 30);
    Kind * k = kind_get(c->kid);
    land_print("%s (%s)", c->name, k->name);
}
void draw_pause_button(void) {
    float w = 30;
    float h = 30;
    float x = 4;
    float y = 720 - 4 - h;
    land_color(.9, .9, .9, .9);
    if (game->paused) {
        land_filled_triangle(x, y, x + w, y + h / 2, x, y + h);
    }
#line 230
    else {
#line 232
        land_filled_rectangle(x, y, x + w / 3, y + h);
        land_filled_rectangle(x + w - w / 3, y, x + w, y + h);
#line 235
        land_font_set(font_menu);
        land_text_pos(x + w + 15, y + 15);
        land_print_middle("5x");
    }
}
#line 239
bool menu_click_button(float mx, float my) {
#line 241
    if (game->title) {
        game->title = 0;
        return 1;
    }
    if (game->show_bill) {
        game->show_bill = 0;
        game->paused = 0;
#line 249
        float dx = menu.pay_x - mx;
        float dy = menu.pay_y - my;
        if (dx * dx + dy * dy <= menu.pay_r * menu.pay_r) {
            game_pay_bills();
            data_play(DataCoin);
        }
        return 1;
    }
    if (game->welcome) {
        game->welcome = 0;
        game->paused = 0;
        return 1;
    }
    if (game->over) {
        game_new();
        return 1;
    }
    // pause
    if (mx < 4 + 30 && my >= 720 - 4 - 30) {
        game->paused = ! game->paused;
        return 1;
    }
    // speed
    if (mx < 4 + 60 && my >= 720 - 4 - 30) {
        game->speed = 1;
        return 1;
    }
    return 0;
}
void menu_draw(void) {
#line 280
    if (game->title) {
        if (! menu.title) {
            menu.title = 1;
            menu.start_t = land_get_ticks();
            data_play(DataScroll);
        }
#line 285
        title_draw();
#line 285
        return ;
    }
    menu.title = 0;
#line 289
    if (game->over) {
        if (! menu.over) {
            menu.over = 1;
            menu.start_t = land_get_ticks();
            data_play(DataScroll);
        }
#line 294
        over_draw();
#line 294
        return ;
    }
    menu.over = 0;
#line 298
    if (game->show_bill) {
        if (! menu.bill) {
            menu.bill = 1;
            menu.start_t = land_get_ticks();
            data_play(DataScroll);
        }
#line 303
        bill_draw();
#line 303
        return ;
    }
    menu.bill = 0;
#line 307
    if (game->welcome) {
        if (! menu.welcome) {
            menu.welcome = 1;
            menu.start_t = land_get_ticks();
            data_play(DataScroll);
        }
#line 312
        welcome_draw();
#line 312
        return ;
    }
    menu.welcome = 0;
#line 316
    draw_pause_button();
#line 318
    if (! menu.shown) {
        menu_draw_hover_info();
#line 319
        return ;
    }
    land_thickness(1);
    land_color(.5, .5, .5, .5);
    land_filled_rectangle(menu.x, menu.y, menu.x + menu.w, menu.y + menu.h);
    float lh = land_line_height();
    float x = menu.x + lh * 0.5;
    float y = menu.y + lh * 0.5;
    {
#line 327
        LandArrayIterator __iter0__ = LandArrayIterator_first(menu.items);
#line 327
        for (MenuItem * m = LandArrayIterator_item(menu.items, &__iter0__); LandArrayIterator_next(menu.items, &__iter0__); m = LandArrayIterator_item(menu.items, &__iter0__)) {
            land_text_pos(x, y);
            if (m->place) {
                Kind * k = m->place;
                if (k->cost) {
                    land_font_set(font_small);
                    land_color(.5, .4, 0, 1);
                    land_write("%d", k->cost);
                }
            }
#line 335
            land_font_set(font_menu);
            land_color(0, 0, 0, .5);
            land_rectangle(x - 3, y - 3, x + menu.w - lh + 3, y + lh + 3);
            y += lh * 1.5;
            if (m->enabled) {
                land_color(0, 0, 0, 1);
                land_write(m->name);
            }
#line 341
            else {
#line 343
                land_color(0, 0, 0, 0.33);
                land_write(m->name);
            }
#line 345
            if (m->place) {
                Kind * k = m->place;
                bool upkeep = 0;
                for (int i = 0; i < 3; i += 1) {
                    if (k->upkeep [i]) {
                        upkeep = 1;
                    }
                }
#line 351
                if (upkeep) {
                    land_font_set(font_small);
                    land_color(1, 1, 1, 1);
                    land_text_pos(land_text_x_pos(), land_text_y_pos() - 4);
                    land_print(" upkeep");
#line 360
                    LandColor colors []={land_rgb(0, 0, .9), land_rgb(0, .75, 0), land_rgb(1, 1, 0.4),};
                    for (int i = 0; i < 3; i += 1) {
                        land_color_set(colors [i]);
                        land_write(" %d", k->upkeep [i]);
                    }
                }
            }
        }
    }
}
#line 365
static void _gradient(int x, int y, int w, int h, LandColor c1, LandColor c2) {
    float xy [] = {x, y, x + w, y, x + w, y + h, x, y + h};
    float rgba [] = {c1.r, c1.g, c1.b, c1.a, c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a, c2.r, c2.g, c2.b, c2.a};
    land_filled_colored_polygon(4, xy, rgba);
}
static void _gradient3(int x, int y, int w, int h, float p2, LandColor c1, LandColor c2, LandColor c3) {
    _gradient(x, y, w, h * p2, c1, c2);
    _gradient(x, y + h * p2, w, h - h * p2, c2, c3);
}
static void _gradienth(int x, int y, int w, int h, LandColor c1, LandColor c2) {
    float xy [] = {x, y, x + w, y, x + w, y + h, x, y + h};
    float rgba [] = {c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a, c2.r, c2.g, c2.b, c2.a, c1.r, c1.g, c1.b, c1.a};
    land_filled_colored_polygon(4, xy, rgba);
}
static void _circ(int cx, int cy, int cr, LandColor c1, LandColor c2) {
    float xy [34 * 2];
    float rgba [34 * 4];
    int n = 0;
    for (int i = 0; i < 34; i += 1) {
        float x, y;
        LandColor c;
        if (i == 0) {
            c = c1;
            x = cx;
            y = cy;
        }
#line 389
        else {
#line 391
            float a = (i - 1) * 2 * pi / 32;
            x = cx + cr * (- cos(a));
            y = cy + cr * sin(a);
            c = c2;
        }
#line 395
        xy [n * 2 + 0] = x;
        xy [n * 2 + 1] = y;
        rgba [n * 4 + 0] = c.r;
        rgba [n * 4 + 1] = c.g;
        rgba [n * 4 + 2] = c.b;
        rgba [n * 4 + 3] = c.a;
        n++;
    }
    land_filled_colored_polygon(n, xy, rgba);
}
static void _fancy_line(int x1, int y1, int x2, int y2, int s, int t) {
    float dx = x2 - x1;
    float dy = y2 - y1;
    float a = atan2(dx, dy);
    float d = sqrt(dx * dx + dy * dy);
    int n = d / s;
    float x = x1;
    float y = y1;
    float r = s * 0.4;
    float rs = s * 0.2;
    for (int i = 0; i < n; i += 1) {
        land_color(0, 0, 0, .5);
        x += dx * s / d / 2;
        y += dy * s / d / 2;
        land_arc(x - r, y - r, x + r, y + r, a + pi * 0.5, a + pi * 1.5);
#line 421
        land_color(0.2, 0, 0, .5);
        float ox = x - 2 * dy * r / d;
        float oy = y - 2 * dx * r / d;
        land_line(x - dy * r / d, y - dx * r / d, ox, oy);
        ox = x - (2 * r - 2) * dy / d;
        oy = y - (2 * r - 2) * dx / d;
        land_line(ox - dx * 2 / d, oy + dy * 2 / d, ox + dx * 2 / d, oy - dy * 2 / d);
#line 429
        land_color(0, 0, 0, .5);
        x += dx * s / d / 2;
        y += dy * s / d / 2;
        if (i != n - 1) {
            land_arc(x - rs, y - rs, x + rs, y + rs, a + pi * 0.5, a + pi * 1.5);
        }
    }
}
#line 435
static void _stats(int uid, int page) {
    int x = land_text_x_pos();
    int y = land_text_y_pos();
    land_font_set(font_small);
    land_color(0, 0, 0, .6);
    for (int kid = 0; kid < 100; kid += 1) {
        if (kid >= game->quest1->kid && kid <= game->quest4->kid) {
            if (page == 1) {
#line 442
                continue;
            }
        }
#line 442
        else {
#line 444
            if (page == 2) {
#line 444
                continue;
            }
        }
#line 445
        if (game->used_stats [uid] [kid]) {
            Kind * k = kind_get(kid);
            land_print("%s", k->name);
        }
    }
#line 448
    if (page != 1) {
        land_color(0, 0, 0, 1);
        land_print("   %s", "Total");
    }
    land_color(0, 0, 0, .6);
    land_text_pos(x + 125, y);
    for (int kid = 0; kid < 100; kid += 1) {
        if (kid >= game->quest1->kid && kid <= game->quest4->kid) {
            if (page == 1) {
#line 456
                continue;
            }
        }
#line 456
        else {
#line 458
            if (page == 2) {
#line 458
                continue;
            }
        }
#line 459
        if (game->used_stats [uid] [kid]) {
            land_print("%.2f", game->used_stats [uid] [kid] / 100.0);
        }
    }
#line 461
    if (page != 1) {
        land_color(0, 0, 0, 1);
        land_print("%3d", (99 + game->used [uid]) / 100);
    }
}
#line 465
static void _stats_box(int x, int w, str name, LandColor color, int uid, int page) {
    int y = land_text_y_pos();
    _fancy_line(x, y, x + w, y, 10, 0);
#line 469
    land_color_set(color);
    land_text_pos(x + w / 2, y);
    land_font_set(font_menu);
    land_print_center(name);
    land_text_set_x(x);
    _stats(uid, page);
}
//land_color(1, 0, 0, 1)
//land_rectangle(x, y, x + w, land_text_y_pos())
#line 479
static void _frame(int * x_, int * y_, int * w_, int * h_, LandColor * back_) {
    land_thickness(1);
    int w0 = 400;
    int h = 600;
    int x0 = 1280 / 2 - w0 / 2;
    int y = 720 / 2 - h / 2;
    int ss = 40;
    float br = 30;
    float so = 20;
#line 489
    int x = x0;
    int w = w0;
#line 492
    int t = land_get_ticks() - menu.start_t;
    if (t > 60) {
#line 493
        t = 60;
    }
#line 494
    float h2 = 80 + (h - 80) * t / 60;
#line 496
    LandColor back = land_rgb(0.9, 0.8, 0.5);
    LandColor backd = land_rgb(0.7, 0.6, 0.3);
    land_color_set(back);
    land_filled_rectangle(x, y, x + w, y + h2);
    _gradienth(x, y, 25, h2, backd, back);
    _gradienth(x + w - 25, y, 25, h2, back, backd);
    _circ(x - so - br / 2, y + ss / 2, br, back, backd);
    _circ(x + w + so + br / 2, y + ss / 2, br, back, backd);
    _circ(x + w + so + br / 2, y + h2 - ss / 2, br, back, backd);
    _circ(x - so - br / 2, y + h2 - ss / 2, br, back, backd);
    _gradient3(x - so, y, w + so * 2, ss, 0.5, backd, back, backd);
    _gradient3(x - so, y + h2 - ss, w + so * 2, ss, 0.5, backd, back, backd);
#line 509
    land_clip_transformed(x0 - 100, y - 100, x0 + w0 + 200, y + h2 - ss);
#line 511
    x += 30;
    y += ss + 20;
    w -= 60;
    h -= ss + ss + 20 + 20;
#line 516
    _fancy_line(x - 15, y - 5, x + w + 15, y - 5, 10, 0);
    _fancy_line(x + w + 15, y + h + 5, x - 15, y + h + 5, 10, 0);
#line 519
    _fancy_line(x - 10, y - 10, x - 10, y + h + 10, 10, 0);
    _fancy_line(x + w + 10, y + h + 10, x + w + 10, y - 10, 10, 0);
#line 522
    * x_ = x;
    * y_ = y;
    * w_ = w;
    * h_ = h;
    * back_ = back;
}
void bill_draw(void) {
    int x, y, w, h;
    LandColor back;
    land_clip_push();
    _frame(& x, & y, & w, & h, & back);
#line 534
    land_text_pos(x, y);
    land_color(0, 0, 0, 0.5);
    land_font_set(font_small);
    land_print("Dark Matter Inc.");
    land_print("Dungeon, Level 9");
    land_text_pos(x + w, y);
    land_print_right("The Underworld");
    land_print_right("666-666-6666");
#line 543
    land_text_pos(x + w / 2, y);
    land_font_set(font_menu);
    land_color(0, 0, 0, 1);
    land_print_center("Utilities Bill");
#line 548
    int y0 = land_text_y_pos() + 30;
#line 550
    land_text_set_y(y0);
    _stats_box(x, w / 2 - 20, "Water", land_rgb(0, 0, 0.5), Water, 0);
    int y2 = land_text_y_pos();
    land_text_set_y(y0);
    _stats_box(x + w / 2 + 20, w / 2 - 20, "Gas", land_rgb(0, 0.5, 0), Gas, 0);
    int y3 = land_text_y_pos();
#line 557
    y0 = _scramble_max(y2, y3) + 20;
    land_text_set_y(y0);
#line 560
    _stats_box(x, w / 2 - 20, "Electric", land_rgb(0.5, 0.5, 0), Electric, 1);
    y2 = land_text_y_pos();
    land_text_set_y(y0);
    _stats_box(x + w / 2 + 20, w / 2 - 20, "", land_rgb(0.5, 0.5, 0), Electric, 2);
    y3 = land_text_y_pos();
    y0 = _scramble_max(y2, y3);
#line 567
    y = y0 + 25;
    land_text_set_y(y);
    _fancy_line(x, y, x + w, y, 10, 0);
    land_color(1, 0, 0, 1);
    land_text_set_x(x + w / 2);
    land_font_set(font_menu);
    land_print_center("Amount owed: %d", game_outstanding());
#line 575
    y = land_text_y_pos() + 70;
#line 577
    float r = 40;
    menu.pay_x = x + w / 2;
    menu.pay_y = y;
    menu.pay_r = r;
    land_color(.5, 0, 0, 1);
    _circ(x + w / 2, y, r + 20, land_rgb(0.3, 0, 0), back);
    _circ(x + w / 2, y, r, land_rgb(0.5, 0, 0), land_rgb(0.3, 0, 0));
    land_color(1, 0, 0, 1);
    land_font_set(font_menu);
    land_text_pos(menu.pay_x, menu.pay_y);
    land_print_middle("Pay");
#line 589
    land_clip_pop();
}
void welcome_draw(void) {
    int x, y, w, h;
    LandColor back;
    land_clip_push();
    _frame(& x, & y, & w, & h, & back);
#line 597
    land_text_pos(x + w / 2, y);
    land_font_set(font_menu);
    land_color(0, 0, 0, 1);
    land_print_center("Welcome!");
#line 602
    land_font_set(font_small);
    land_text_set_x(x);
#line 607
    land_print_wordwrap(w, h, "\n"
        "Welcome, and congratulations to your new job at the Dungeon! I'm Roderick your new assistant. You have accepted the following full time position:\n"
        "");
#line 609
    LandColor ink = land_color_rgba(0.5, 0, 0, 0.9);
    land_font_set(font_menu);
    land_color_set(ink);
    land_text_set_x(x + w / 2);
    land_print_center("Dungeon Master");
    land_text_set_x(x);
#line 616
    land_color(0, 0, 0, 1);
    land_font_set(font_small);
    land_print("");
#line 621
    land_print_wordwrap(w, h, "Running a dungeon is easy. Make sure the monsters are well fed and the vendors are stocked up on health potions.\n"
        "The heroes will show up by themselves.\n"
        "");
#line 624
    land_print_wordwrap(w, h, "Really, this is the easiest job in the world.\n"
        "");
#line 629
    land_print_wordwrap(w, h, "Just one problem - the utility bill! ""Your predecessor overran the budget and the utility company turned off water, gas and electric. ""All the vendors left, half of our monsters perished and of course no heroes showed up any longer. ""Who wants to quest in a dungeon with no light and no water and no shops?\n");
#line 631
    land_print("Good luck!");
    land_print("");
#line 634
    land_write("Employment: ");
    land_color_set(ink);
    land_write("at will");
    land_color(0, 0, 0, 1);
    land_text_set_x(x + w / 2);
    land_write("On-call hours: ");
    land_color_set(ink);
    land_print("24/7");
    land_text_set_x(x);
#line 644
    land_color(0, 0, 0, 1);
    land_write("Vacation days: ");
    land_color_set(ink);
    land_write("0");
    land_color(0, 0, 0, 1);
    land_text_set_x(x + w / 2);
    land_write("Salary: ");
    land_color_set(ink);
    land_print("$2/hour + tips");
    land_text_set_x(x);
#line 655
    land_print("");
    land_color(0, 0, 0, 1);
    land_print_wordwrap(w, h, "Reminder: Leaving the dungeon or failing to pay the utility bill on time is reason for immediate termination.");
#line 659
    land_text_set_x(x + w);
    land_color_set(ink);
    land_print_right("Roderick");
#line 663
    land_clip_pop();
}
void over_draw(void) {
    int x, y, w, h;
    LandColor back;
    land_clip_push();
    _frame(& x, & y, & w, & h, & back);
#line 671
    land_text_pos(x + w / 2, y);
    land_font_set(font_menu);
    land_color(0, 0, 0, 1);
    land_print_center("You are fired!");
#line 676
    land_font_set(font_small);
    land_text_set_x(x);
#line 683
    land_print_wordwrap(w, h, "\n"
        "You have failed to pay the utility bill. This is not acceptable and we are terminating you immediately.\n"
        "\n"
        "We have also terminated your assistant Roderick for failure to hire a competent dungeon master.\n"
        "");
#line 685
    LandColor ink = land_color_rgba(0.5, 0, 0, 0.9);
    land_text_set_x(x + w);
    land_color_set(ink);
    land_print_right("L9 Mgmt");
#line 690
    land_clip_pop();
}
void title_draw(void) {
    int x, y, w, h;
    LandColor back;
    land_clip_push();
    _frame(& x, & y, & w, & h, & back);
#line 698
    LandColor black = land_color_rgba(0, 0, 0, 1);
    LandColor ink = land_color_rgba(1, 1, 1, 1);
    LandColor ink2 = land_color_rgba(1, 1, 0, 1);
#line 702
    land_text_pos(x + w / 2 + 1, y + 1);
    land_font_set(font_menu);
    land_color_set(black);
    land_print_center("KrampusHack 2020!");
    land_color_set(ink2);
    land_text_pos(x + w / 2, y);
    land_print_center("KrampusHack 2020!");
#line 710
    float yt = land_text_y_pos();
    float ht = land_line_height();
#line 713
    land_color_set(black);
    land_font_set(font_small);
    land_text_pos(x, yt + ht - land_line_height());
    land_write("For: ");
    land_text_set_y(yt);
    land_font_set(font_menu);
    land_color_set(ink2);
    land_write("Tharro ");
#line 722
    land_color_set(black);
    land_font_set(font_small);
    land_text_set_y(yt + ht - land_line_height());
    land_write("From: ");
    land_text_set_y(yt);
    land_font_set(font_menu);
    land_color_set(ink2);
    land_print("Allefant");
#line 731
    land_font_set(font_small);
    land_text_set_x(x);
    land_color_set(black);
    land_print_wordwrap(w, h, "\nThis is a game for Tharro. The wishes to implement were:");
    land_color_set(ink);
#line 737
    land_print_wordwrap(w, h, "\n"
        "- Some management of utilities (power, transport, ...) should be present.");
    land_color_set(black);
    land_print_wordwrap(w, h, "I tried to include this by making the main goal of the game to manage utilities for a dungeon.");
    land_color_set(ink);
#line 742
    land_print_wordwrap(w, h, "\n"
        "- It would be cool if some form of simulation is involved.");
    land_color_set(black);
    land_print_wordwrap(w, h, "I made the game a dungeon simulation, with simulation of heroes, vendors, quest givers, monsters, potions, traps...");
    land_color_set(ink);
#line 747
    land_print_wordwrap(w, h, "\n"
        "- Cheats, if I can't win the game I'd like to have to some cheats that will simplify the road to victory!");
    land_color_set(black);
#line 750
    land_print_wordwrap(w, h, "I don't like cheating, but I added cheat codes: \"iddqd\" to restore health and \"idkfa\" for full equipment.\n"
        "");
    land_color_set(black);
    land_print_wordwrap(w, h, "Thanks to Amarillion for hosting the competition and everyone else for taking part and keeping logs and playing the games!");
#line 754
    land_text_set_x(x + w);
    land_color_set(ink2);
    land_print_right("Allefant");
#line 758
    land_clip_pop();
}
/* This file was generated by scramble.py. */
