Exemplo n.º 1
0
static int _qdgdfv_startup(void)
{
    vga_init();

    _qdgdfv_scale = 1;

    /* only 320x200 supported by now */
    _qdgdfv_screen_x_size = 320;
    _qdgdfv_screen_y_size = 200;

    vga_setmode(G320x200x256);

    _qdgdfv_set_palette();

    keyboard_init();

    keyboard_translatekeys(TRANSLATE_CURSORKEYS);

    _qdgdfv_virtual_screen = (unsigned char *)
        qdgdfv_malloc(_qdgdfv_screen_x_size * _qdgdfv_screen_y_size);

    qdgdfv_clear_virtual_screen();

    /* svgalib runs always fullscreen */
    _qdgdfv_full_screen = 1;

    qdgdfv_logger("qdgdfv_startup", "SVGALIB driver startup");

    return 1;
}
Exemplo n.º 2
0
void GameEnd(void)
{
    _tty_under_water = 1;
    _fade_edges = 1;

    SwapScreens(1);
    LoadScreen("end");
    SwapScreens(0);

    Tty("SPACE PLUMBER MISSION REPORT\a\n\n"
        "ALL LEVELS HAS BEEN SECURED.\a\n"
        "PRESSURE SYSTEM RESTARTED.\a\n"
        "AQUA ENTERPRISES, INC. MAIN\n"
        "PLANT IS AGAIN FULLY FUNCTIONAL.\a\n\n" "WHAT ABOUT SOME DAYS OF VACATION?\n");

    qdgdfv_clear_virtual_screen();

    Tty("RESPONSE FROM HIGH COMMAND\a\n\n"
        "CONGRATULATIONS.\a\n\n"
        "VACATION REQUESTS MUST BE MADE\n"
        "BY FILLING THE FORM TT-243/F.\a\n"
        "THIS FORM IS UNAVAILABLE FOR NOW.\a\n\n" "END OF TRANSMISSION.\n");

    _level_resolved = 0;
    _last_level_resolved = 0;
}
Exemplo n.º 3
0
void show_info(void)
{
    int c = qdgdfv_seek_color(255, 255, 255);
    int y;

    qdgdfv_clear_virtual_screen();

    for (y = 0; info[y] != NULL; y++)
        qdgdfv_font_print(1, y * _qdgdfv_font_height, (unsigned char *)info[y], c);

    qdgdfv_font_print(1, y * _qdgdfv_font_height,
            (unsigned char *)qdgdfv_sprintf("%d %c", _qdgdfv_key_alnum, _qdgdfv_alnum),
            c);

    qdgdfv_font_print(-1, -1, (unsigned char *)"Press ESCAPE", c);

    qdgdfv_dump_virtual_screen();
}
Exemplo n.º 4
0
int Menu(void)
{
    int up, down;
    int menu_opt = 0;

    if (_menu_mask == NULL)
        _menu_mask = qdgdfv_malloc(SCREEN_X_SIZE * SCREEN_Y_SIZE);

    _text_mask_x = -1;

    up = down = 0;

    qdgdfv_clear_virtual_screen();
    qdgdfv_load_pcx((unsigned char *) _menu_mask, "graph/menu.pcx", SCREEN_X_SIZE * SCREEN_Y_SIZE);

    SwapScreens(1);
    LoadScreen("wmenu");
    SwapScreens(0);

    qdgdfv_load_pcx((unsigned char *) cursor, "graph/cursor.pcx", CURSOR_SIZE);

    for (;;) {
        DrawWaterVirtualScreen();
        DrawMenu(menu_opt);
        qdgdfv_dump_virtual_screen();

        qdgdfv_input_poll();

        if (_qdgdfv_key_up) {
            down = 0;

            if (up == 0) {
                up = 1;

                menu_opt--;

                if (menu_opt == -1)
                    menu_opt = 4;
            }
        }
        else
            up = 0;

        if (_qdgdfv_key_down) {
            up = 0;

            if (down == 0) {
                down = 1;

                menu_opt++;

                if (menu_opt == 5)
                    menu_opt = 0;
            }
        }
        else
            down = 0;

        if (_qdgdfv_key_escape) {
            menu_opt = -1;
            break;
        }

        if (_qdgdfv_key_enter)
            break;
    }

    /* wait until no key is pressed */
    while (_qdgdfv_key_escape || _qdgdfv_key_enter || _qdgdfv_key_up || _qdgdfv_key_down)
        qdgdfv_input_poll();

    return (menu_opt);
}
Exemplo n.º 5
0
void Intro(void)
/* intro */
{
    time_t t;

    music = qdgdfa_load_sound("sound/holst.wav");
    qdgdfa_play_sound(music, 1);

    LoadScreen("aolabs");

    for (t = time(NULL); t + 10 > time(NULL);) {
        qdgdfv_dump_virtual_screen();

        qdgdfv_input_poll();

        if (_qdgdfv_key_escape) {
            while (_qdgdfv_key_escape)
                qdgdfv_input_poll();

            return;
        }

        if (_qdgdfv_key_enter) {
            while (_qdgdfv_key_enter)
                qdgdfv_input_poll();

            return;
        }
    }

    qdgdfv_clear_virtual_screen();
    qdgdfv_dump_virtual_screen();

    SwapScreens(1);
    LoadScreen("logo");
    SwapScreens(0);

    for (t = time(NULL); t + 15 > time(NULL);) {
        DrawWaterVirtualScreen();
        qdgdfv_dump_virtual_screen();

        qdgdfv_input_poll();

        if (_qdgdfv_key_escape) {
            while (_qdgdfv_key_escape)
                qdgdfv_input_poll();

            return;
        }

        if (_qdgdfv_key_enter) {
            while (_qdgdfv_key_enter)
                qdgdfv_input_poll();

            return;
        }
    }

    LoadScreen("planet");

    if (!Tty
        ("SPACE PLUMBER MISSION BRIEFING\n\n\nPLANET: X-239-LQ (TSUNAMI XXVI)\a\nSURFACE: 100% WATER\a\n"
         "RESOURCES: URANIUM AND THALIUM\a\nEXPLOITED BY:\n"
         "  98% AQUA ENTERPRISES, INC.\n  02% OTHER COMPANIES.\n"))
        return;

    LoadScreen("planet");

    Tty("PROBLEM DESCRIPTION:\a\n  MAIN PROCESSING PLANT\n"
        "  PRESSURE SYSTEM MALFUNCTION.\a\n"
        "  ALL TECHNICIANS EVACUATED.\a\n\n"
        "MISSION: ACTIVATE ALL WATER\n"
        "  EXTRACTION PUMPS.\a\n"
        "  DEACTIVATE SECURITY CONSOLES\n" "  WHERE AVAILABLE.\n");
}
Exemplo n.º 6
0
int Tty(char *message)
{
    clock_t c;
    time_t t;
    char *ptr;

    _text_mask[0] = '\0';
    ptr = _text_mask;

    t = 0;
    _text_mask_x = 8;

    for (;;) {
        c = clock();
        while (c == clock());

        if (_tty_under_water)
            DrawWaterVirtualScreen();

        DrawText();
        qdgdfv_dump_virtual_screen();

        qdgdfv_input_poll();

        if (_qdgdfv_key_escape) {
            while (_qdgdfv_key_escape)
                qdgdfv_input_poll();

            return (0);
        }

        if (_qdgdfv_key_enter) {
            while (_qdgdfv_key_enter)
                qdgdfv_input_poll();

            return (1);
        }

        if (t == 0) {
            if (*message == '\a' || *message == '\0')
                t = time(NULL) + 2;
            else {
                *ptr = *message;
                message++;
                ptr++;
                *ptr = '\0';
            }
        }
        else if (time(NULL) > t) {
            t = 0;

            if (*message == '\0')
                break;
            else
                message++;
        }
    }

    qdgdfv_clear_virtual_screen();

    t = time(NULL) + 3;
    while (time(NULL) < t) {
        if (_tty_under_water)
            DrawWaterVirtualScreen();

        qdgdfv_dump_virtual_screen();
    }

    return (1);
}