Exemple #1
0
void MainMenu::onKeyDown(KeyboardEvent* event)
{
    switch (event->keyCode())
    {
        case SDLK_e:
        case SDLK_ESCAPE:
            doExit();
            break;
        case SDLK_n:
            doNewGame();
            break;
        case SDLK_l:
            doLoadGame();
            break;
        case SDLK_i:
            doIntro();
            break;
        case SDLK_c:
            doCredits();
            break;
        case SDLK_o:
            doSettings();
            break;
    }
}
Exemple #2
0
void _main(void) {
	short int font = FontGetSys(), speed = AVERAGE, difficulty = NORMAL;

	// create the hiscore file, if it doesn't exist
	if (needScoreFile()) {
		createHiScoreTable();
	}

	// Make sure there are no keystrokes left in the buffer
	GKeyFlush();

	// setup medium size font
	FontSetSys(F_6x8);

	// seed the random number generator
	randomize();

	// disable interrupts
	OSSetSR(0x0700);

	// keep playing until doIntro returns FALSE (exit)
	while (doIntro(&speed,&difficulty)) {
		play(speed,difficulty);
	}

	// reenable interrupts before exit
	OSSetSR(0x0000);

	// restore the standard font
	FontSetSys(font);
}
Exemple #3
0
char doRegular(char expand, char c)
{
    char toReturn;
    int i;
    int done = 0;
    label doorinfo;

    toReturn = FALSE;

    for (i = 0; !expand && i < MAXEXTERN && extCmd[i].name[0]; ++i) {
        if (c == toupper(extCmd[i].name[0]) && (onConsole || !extCmd[i].local)) {
            done = 1;
            mPrintf("\b%s", extCmd[i].name);
            doCR();
            if (changedir(cfg.aplpath) == ERROR) {
                mPrintf("  -- Can't find application directory.\n\n");
                changedir(cfg.homepath);
            }
        /* apsystem(extCmd[i].command); */
            sprintf(doorinfo, "DORINFO%d.DEF", onConsole ? 0 : userdat.apl_com);
            extFmtRun(extCmd[i].command, doorinfo);
        }
    }
    if (!done) {
        switch (c) {

            case 'S':
                if (gl_user.sysop && expand) {
                    mPrintf("\b\bSysop Menu");
                    doCR();
                    doSysop();
                } else {
                    toReturn = TRUE;
                }
                break;

            case 'A':
                if (gl_user.aide) {
                    doAide(expand, 'E');
                } else {
                    toReturn = TRUE;
                }
                break;

            case 'C':
                doChat(expand, '\0');
                break;
            case 'D':
                doDownload(expand);
                break;
            case 'E':
                doEnter(expand, 'm');
                break;
            case 'F':
                doRead(expand, 'f');
                break;
            case 'G':
                doGoto(expand, FALSE);
                break;
            case 'H':
                doHelp(expand);
                break;
            case 'I':
                doIntro();
                break;
            case 'J':
                mPrintf("\bJump back to ");
                unGotoRoom();
                break;
            case 'K':
                doKnown(expand, 'r');
                break;
            case 'L':
                if (!loggedIn) {
                    doLogin(expand);
                } else {
                    if (!getYesNo(confirm, 0))
                        break;
                    doLogout(expand, 's');
                    doLogin(expand);
                }
                break;
            case 'N':
            case 'O':
            case 'R':
                doRead(expand, tolower(c));
                break;

            case 'B':
                doGoto(expand, TRUE);
                break;
            case 'T':
                doLogout(expand, 'q');
                break;
            case 'U':
                doUpload(expand);
                break;
            case 'X':
                if (!expand) {
                    doEnter(expand, 'x');
                } else {
                    doXpert();
                }
                break;

            case '=':
            case '+':
                doNext();
                break;
            case '\b':
                mPrintf("  ");
            case '-':
                doPrevious();
                break;

            case ']':
            case '>':
                doNextHall();
                break;
            case '[':
            case '<':
                doPreviousHall();
                break;
            case '~':
                mPrintf("\bAnsi %s\n ", gl_term.ansiOn ?
					gl_str.off : gl_str.on);
                gl_term.ansiOn = !gl_term.ansiOn;
                break;

            case '!':
                mPrintf("\bIBM Graphics %s\n ", gl_term.IBMOn ?
					gl_str.off:gl_str.on);
                gl_term.IBMOn = !gl_term.IBMOn;
                break;

            case '?':
                nextmenu("mainopt", &(cfg.cnt.mainopttut), 1);
				listExterns();
                break;

            case 0:     /* never gets here in shell mode... */
                if (newCarrier) {
                    greeting();

                    if (cfg.forcelogin) {
                        doCR();
                        doCR();
                        i = 0;
                        while (!loggedIn && gotCarrier()) {
                            doLogin(2);
                            if (++i > 3) {
                                Initport();
                                toReturn = TRUE;
                                break;
                            }
                        }
                    }
                    newCarrier = FALSE;
                }
                if (logBuf.lbflags.NODE && loggedIn) {
                    net_slave();

                    haveCarrier = FALSE;
                    modStat = FALSE;
                    newCarrier = FALSE;
                    justLostCarrier = FALSE;
                    onConsole = FALSE;
                    disabled = FALSE;
                    callout = FALSE;

                    delay(2000);

                    Initport();

                    cfg.callno++;
                    terminate(FALSE, FALSE);
                }
                if (justLostCarrier || ExitToMsdos) {
                    justLostCarrier = FALSE;
                    if (loggedIn)
                        terminate(FALSE, FALSE);
                }
                break;      /* irrelevant value */

            default:
                toReturn = TRUE;
                break;
        }
    }
    /* if they get unverified online */
    if (logBuf.VERIFIED)
        terminate(FALSE, FALSE);

    /* update25();	*/
	do_idle(0);
    return toReturn;
}
Exemple #4
0
void MainMenu::onIntroButtonClick(MouseEvent* event)
{
    doIntro();
}