Example #1
0
void ShootSequenceDemoRandom(bool singleshot)
{
	COORD shotloc;
	int bodypart;
	int timeshit;
	int shotstofire = singleshot?1:random(31,32);
	

	ShootingClearHitMatrix();
	ShootingLoadSilhouetteMatrix("data\\sil_partialcover.dat");
	ShootingPrintSilhouette(SHOOTING_TGTPOS_PARTIALCOVER);

	for(int i = 0; i < shotstofire; i++)
	{
		shotloc = ShootingGetHitLocFromAccuracy(BODY_HEAD, 80, 5);
		
		playMIXsound("sounds\\weapons\\rifle2.wav");
		Sleep(singleshot?500:60); //100 / num rds turn?

		bool onscreen = ShootingGetHitFromMatrix(shotloc, bodypart, timeshit);
		if(bodypart == -1 || !onscreen)
		{
			playRicochet(SOUND_MODE_MIX);
			GRAY;
		}
		else
		{
			playMIXsound("sounds\\hits\\bullethit.wav");
			LRED;
		}
		if(onscreen)
			ShootingPrintHitGraphic(shotloc, timeshit++);
	}
	waitforkey();
}
Example #2
0
void PromptForCorrectScreenSize()
{
	char* prompt = "Please Press ALT + ENTER To Maximize Your Screen Size";
	char* prompt2 = "When Ready, Press SPACE To Begin";
	int key;
	COORD promptdrawcoords;

	promptdrawcoords = retrieveTextCenter(prompt);
	LRED;
	setcursor(promptdrawcoords.X, promptdrawcoords.Y);
	printf(prompt);
	promptdrawcoords = retrieveTextCenter(prompt2);
	promptdrawcoords.Y++;
	setcursor(promptdrawcoords.X, promptdrawcoords.Y);
	printf(prompt2);
	
	while(1)
	{
		key = waitforkey();
		if (key == ' '){
			cls();
			return;
		}
	}
}
Example #3
0
void showfile(char *fname)
{
    int i, bh = bodylen();
    FILE *fp;
    char buf[MAXSTRLEN], *result;
    bool ateof = FALSE;

    statusmsg("FileBrowser: Hit key to continue, Q to quit");

    if ((fp = fopen(fname, "r")) != NULL)   /* file available? */
    {
        while (!ateof)
        {
            clsbody();

            for (i = 0; i < bh - 1 && !ateof; i++)
            {
                buf[0] = '\0';
                result = fgets(buf, MAXSTRLEN, fp);

                if (result && strlen(buf))
                    bodymsg(buf);
                else
                    ateof = TRUE;
            }

            switch (waitforkey())
            {
            case 'Q':
            case 'q':
            case 0x1b:
                ateof = TRUE;
            }
        }

        fclose(fp);
    }
    else
    {
        sprintf(buf, "ERROR: file '%s' not found", fname);
        errormsg(buf);
    }
}
Example #4
0
void domenu(menu *mp)
{
    int y, x, nitems, barlen, mheight, mw, old = -1, cur = 0, cur0;
    bool stop = FALSE;
    WINDOW *wmenu;

    curs_set(0);
    getmenupos(&y, &x);
    menudim(mp, &nitems, &barlen);
    mheight = nitems + 2;
    mw = barlen + 2;
    wmenu = newwin(mheight, mw, y, x);
    colorbox(wmenu, SUBMENUCOLOR, 1);
    repaintmenu(wmenu, mp);

    key = ERR;

    while (!stop && !quit)
    {
        if (cur != old)
        {
            if (old != -1)
                mvwaddstr(wmenu, old + 1, 1,
                          prepad(padstr(mp[old].name, barlen - 1), 1));

            setcolor(wmenu, SUBMENUREVCOLOR);
            mvwaddstr(wmenu, cur + 1, 1,
                      prepad(padstr(mp[cur].name, barlen - 1), 1));

            setcolor(wmenu, SUBMENUCOLOR);
            statusmsg(mp[cur].desc);

            old = cur;
            wrefresh(wmenu);
        }

        switch (key = ((key != ERR) ? key : waitforkey()))
        {
        case '\n':          /* menu item selected */
            touchwin(wbody);
            wrefresh(wbody);
            setmenupos(y + 1, x + 1);
            rmerror();

            key = ERR;
            curs_set(1);
            (mp[cur].func)();   /* perform function */
            curs_set(0);

            repaintmenu(wmenu, mp);

            old = -1;
            break;

        case KEY_UP:
            cur = (cur + nitems - 1) % nitems;
            key = ERR;
            break;

        case KEY_DOWN:
            cur = (cur + 1) % nitems;
            key = ERR;
            break;

        case KEY_ESC:
        case KEY_LEFT:
        case KEY_RIGHT:
            if (key == KEY_ESC)
                key = ERR;  /* return to prev submenu */

            stop = TRUE;
            break;

        default:
            cur0 = cur;

            do
            {
                cur = (cur + 1) % nitems;

            } while ((cur != cur0) &&
                     (hotkey(mp[cur].name) != toupper((int)key)));

            key = (hotkey(mp[cur].name) == toupper((int)key)) ? '\n' : ERR;
        }

    }

    rmerror();
    delwin(wmenu);
    touchwin(wbody);
    wrefresh(wbody);
}
Example #5
0
static void mainmenu(menu *mp)
{
    int nitems, barlen, old = -1, cur = 0, c, cur0;

    menudim(mp, &nitems, &barlen);
    repaintmainmenu(barlen, mp);

    while (!quit)
    {
        if (cur != old)
        {
            if (old != -1)
            {
                mvwaddstr(wmain, 0, old * barlen,
                          prepad(padstr(mp[old].name, barlen - 1), 1));

                statusmsg(mp[cur].desc);
            }
            else
                mainhelp();

            setcolor(wmain, MAINMENUREVCOLOR);

            mvwaddstr(wmain, 0, cur * barlen,
                      prepad(padstr(mp[cur].name, barlen - 1), 1));

            setcolor(wmain, MAINMENUCOLOR);
            old = cur;
            wrefresh(wmain);
        }

        switch (c = (key != ERR ? key : waitforkey()))
        {
        case KEY_DOWN:
        case '\n':              /* menu item selected */
            touchwin(wbody);
            wrefresh(wbody);
            rmerror();
            setmenupos(th + mh, cur * barlen);
            curs_set(1);
            (mp[cur].func)();   /* perform function */
            curs_set(0);

            switch (key)
            {
            case KEY_LEFT:
                cur = (cur + nitems - 1) % nitems;
                key = '\n';
                break;

            case KEY_RIGHT:
                cur = (cur + 1) % nitems;
                key = '\n';
                break;

            default:
                key = ERR;
            }

            repaintmainmenu(barlen, mp);
            old = -1;
            break;

        case KEY_LEFT:
            cur = (cur + nitems - 1) % nitems;
            break;

        case KEY_RIGHT:
            cur = (cur + 1) % nitems;
            break;

        case KEY_ESC:
            mainhelp();
            break;

        default:
            cur0 = cur;

            do
            {
                cur = (cur + 1) % nitems;

            } while ((cur != cur0) && (hotkey(mp[cur].name) != toupper(c)));

            if (hotkey(mp[cur].name) == toupper(c))
                key = '\n';
        }

    }

    rmerror();
    touchwin(wbody);
    wrefresh(wbody);
}
Example #6
0
void ComputerPrintOutString(char* string, int sleeptime, char* finalstring)
{
	COORD consize = getconsize();
	int width = consize.X - 3;
	if(!string){
		return;
	}
	char* ourstring = (char*) malloc((strlen(string) + 1) * sizeof(char));
	strcpy(ourstring, string);
	WrapStringToWidth(ourstring, width);
	int height = GetNumberOfStringLines(ourstring);
	int finalYorigin = (consize.Y / 2) - (height / 2); //THIS IS WHERE THE TEXT SHOULD BE SCROLLED UP TO.
	int finalXorigin = 1;
	int bottomYorigin = consize.Y - 1;
	int currentYorigin = finalYorigin;
	int currentXorigin = finalXorigin;
	SMALL_RECT scrollrect;
	scrollrect.Bottom = consize.Y - 1;
	scrollrect.Left = finalXorigin;
	scrollrect.Right = width;
	scrollrect.Top = currentYorigin;
	SMALL_RECT cliprect;
	cliprect.Bottom = consize.Y - 2;
	cliprect.Top = finalYorigin;
	cliprect.Right = width;
	cliprect.Left = finalXorigin;
	CHAR_INFO fill;
	fill.Attributes = FOREGROUND_RED;
	fill.Char.AsciiChar = (char)219;
	COORD neworigin;
	bool Skipped = false;
	int i;
	int numevents;
	USHORT key;
	neworigin.X = finalXorigin;
	neworigin.Y = currentYorigin - 1;
	
	unsigned int len = strlen(ourstring);
	unsigned int currentchar;
	char cursorchar = (char)219;
	unsigned int currentlocalcharacter = 1;
	HANDLE consoleout = getconsoleoutputh();
	
	for(currentchar = 1; currentchar <= len; currentchar++)
	{
		
		numevents = checkforinput();
			if (numevents > 1)
			{
				for (i = 1; i <= numevents; i++)
				{
					key = getinput(i);
					if(key == VK_ESCAPE){
						FLUSH;
			clearinputrecords();
						Skipped = true;
					}
				}
			}
			FLUSH;
			clearinputrecords();
		//1. DISPLAY PREVIOUS CHARACTER IN FULL GREEN
		LGREEN;
		setcursor(currentlocalcharacter - 1 + currentXorigin, currentYorigin);
		writechar(ourstring[currentchar - 1]);
		//2a. IF CURRENT CHARACTER IS \n, SCROLL TEXT AND RESET XCURSOR
		if(ourstring[currentchar] == '\n'){
			//GO KILL THAT CURSOR.
			
			setcolor(0);
			setcursor(currentlocalcharacter + currentXorigin, currentYorigin);
			writechar(cursorchar);
			currentXorigin = finalXorigin;
			currentYorigin++;
			scrollrect.Top = currentYorigin;
			neworigin.Y = currentYorigin;
			currentlocalcharacter = 0;
			//ScrollConsoleScreenBuffer(consoleout, &scrollrect, &cliprect, neworigin, &fill);
		}
		//2. ELSE, DISPLAY CURRENT CHARACTER IN FADED GREEN.
		else{
			if(currentchar < len){
			GREEN;
			setcursor(currentlocalcharacter + currentXorigin, currentYorigin);
			writechar(ourstring[currentchar]);
			currentlocalcharacter++;
			}
				//3. DRAW CURSOR.
		GREEN;
		setcursor(currentlocalcharacter + currentXorigin, currentYorigin);
		writechar(cursorchar);
		if(!Skipped){
		Sleep(sleeptime);
		}
		}
		
			
	}

	//NOW, WHILE WE'RE NOT LINED UP WITH THE Y ORIGIN....
	//SCROLL UP.
	/*
	for(;currentYorigin > finalYorigin; currentYorigin--)
	{
		setcolor(0);
			setcursor(currentlocalcharacter + currentXorigin, bottomYorigin);
			writechar(cursorchar);
			currentXorigin = finalXorigin;
			currentYorigin--;
			scrollrect.Top = currentYorigin;
			neworigin.Y = currentYorigin;
			currentlocalcharacter = 0;
			ScrollConsoleScreenBuffer(consoleout, &scrollrect, &cliprect, neworigin, &fill);
	}
*/
	if(!Skipped){
	Sleep(1000);
	}
	GREEN;
	setcursor(finalXorigin, finalYorigin + height);
	writestring(finalstring);
	waitforkey();
	
}
Example #7
0
void CreditScreen()
{
#define MAX_DUTIES 21
#define MAX_CREDIT_LENGTH 400
	
#define CREDIT_REDFLASH 0
#define CREDIT_GREENFADE 1
	
	//#define PROMPT_TEXT_SPACE_X_OFFSETFROMLEFT 16
	//#define PROMPT_TEXT_SPACE_Y_OFFSETFROMTOP 4
	//#define PROMPT_TEXT_WIDTH	46
	//#define PROMPT_TEXT_HEIGHT 15
	
	RECT boxrect;
	int creditcounter;
	char duties[MAX_DUTIES][MAX_CREDIT_LENGTH] = {
		"THE AGENCY",
			"Based On \"The Agency\" Espionage Universe", 
			"Designer",
			"Lead Programmer",
			"Glamour Model",
			"Box / Manual Design",
			"Special Thanks To:", 
			"Special Thanks To:",
			"We Extend A Special Thank You To:",
			"We Extend A Special Thank You To:",
			"We Extend A Special Thank You To:",
			"Vorpal Design Group is a small west-coast game design group centered around the intelligence and military gaming enthusiast.",
			"The Agency is an original concept created by Charles Cox. For franchising information, and for info on how you can become a part of The Agency Universe, please contact Charles Cox, President of VDG at: [email protected]",
			"We will be bringing The Agency : Razor One to you in full 3d very soon. Please stay tuned to the company that brings the intelligence and military world to your computer:",
			"Vorpal",
			"VDG   ",
			"Charles Cox",
			"Wyatt Jackson",
			"Eddy Irwin",
			"Jennifer Dygert",
			"THANKS FOR PLAYING!"
	};
	
	char names[MAX_DUTIES][MAX_CREDIT_LENGTH] = {
		"RAZOR ONE",
			"By Charles Cox", 
			"Charles Cox",
			"Charles Cox",
			"Charlie \"Flowers\" From Jersey City",
			"Charles Cox",
			"Wyatt Jackson (Dr. J)",
			"\"Fast\" Eddy Irwin From Jersey City",
			"\"Big\" Bird",
			"Big \"Bird\"",
			"Bert \"and\" Ernie",
			"",
			"",
			"",
			"Design Group",
			"   IS",
			"President, CEO, Lead Designer",
			"Programmer",
			"Programmer / Designer",
			"Craft Services",
			"PRESS A KEY TO RETURN."
	} ; 
	
	int styles[MAX_DUTIES] = {
		CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_GREENFADE,
			CREDIT_GREENFADE,
			CREDIT_GREENFADE,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
			CREDIT_REDFLASH,
	};
	
	COORD dutydrawcoords;
	COORD namedrawcoords;
	COORD boxsize = {PROMPT_TEXT_WIDTH, PROMPT_TEXT_HEIGHT};
	COORD boxstart = {PROMPT_TEXT_SPACE_X_OFFSETFROMLEFT, PROMPT_TEXT_SPACE_Y_OFFSETFROMTOP};
	COORD zeroed = {0,0};
	
	
	boxrect.left = PROMPT_TEXT_SPACE_X_OFFSETFROMLEFT;
	boxrect.top = PROMPT_TEXT_SPACE_Y_OFFSETFROMTOP;
	boxrect.right = PROMPT_TEXT_SPACE_X_OFFSETFROMLEFT+PROMPT_TEXT_WIDTH;
	boxrect.bottom = PROMPT_TEXT_SPACE_Y_OFFSETFROMTOP + PROMPT_TEXT_HEIGHT;
	
	
	LoopSong(globals.musiclist.songs[CREDITS_SONG]);
	
	styles[MAX_DUTIES - 1] = CREDIT_REDFLASH; //THE LAST CREDIT MUST ALWAYS BE REDFLASH.
	
	GREEN;
	printgraphic(globals.graphicslist, zeroed,  PROMPT_GRAPHIC_ID);
	for (creditcounter = 0; creditcounter < MAX_DUTIES; creditcounter++){
		if (styles[creditcounter] == CREDIT_REDFLASH)
		{
			ClearRect(boxrect);
			dutydrawcoords = retrieveTextCenter(duties[creditcounter]);
			dutydrawcoords.Y --;
			namedrawcoords = retrieveTextCenter(names[creditcounter]);
			RED;
			setcursor(dutydrawcoords.X, dutydrawcoords.Y);
			bufferprint(1, duties[creditcounter]);
			setcursor(dutydrawcoords.X, dutydrawcoords.Y);
			LRED;
			bufferprint(1, duties[creditcounter]);
			Sleep(200);
			RED;
			setcursor(namedrawcoords.X, namedrawcoords.Y);
			bufferprint(1, names[creditcounter]);
			setcursor(namedrawcoords.X, namedrawcoords.Y);
			LRED;
			bufferprint(1, names[creditcounter]);
			if (creditcounter < MAX_DUTIES - 1)
			{
				Sleep(3500);
				
				RED;
				setcursor(dutydrawcoords.X, dutydrawcoords.Y);
				printf(duties[creditcounter]);
				setcursor(dutydrawcoords.X, dutydrawcoords.Y);
				RED;
				setcursor(namedrawcoords.X, namedrawcoords.Y);
				printf(names[creditcounter]);
				setcursor(namedrawcoords.X, namedrawcoords.Y);
				Sleep(80);
				setcursor(namedrawcoords.X, namedrawcoords.Y);
				cleartext(names[creditcounter]);
				setcursor(dutydrawcoords.X, dutydrawcoords.Y);
				cleartext(duties[creditcounter]);
				Sleep(1000);
			}
			else{
				FLUSH;
				clearinputrecords();
				waitforkey();
				StopSong();
				cls();
				return;
			}
		}
		else if (styles[creditcounter] == CREDIT_GREENFADE)
		{
			ClearRect(boxrect);
			GREEN;
			
			printwordwrapcoordinate(duties[creditcounter], boxsize, boxstart);
			Sleep(80);
			LGREEN;
			
			printwordwrapcoordinate(duties[creditcounter], boxsize, boxstart);
			Sleep(10000);
			GREEN;
			
			printwordwrapcoordinate(duties[creditcounter], boxsize, boxstart);
			Sleep(80);
			ClearRect(boxrect);
			Sleep(1000);
		}
	}
	
}
Example #8
0
void opcontitles(int titlenumber)
{
	
	COORD consize;
	
	COORD lastdatepos;
//	char datestring[60];
	
	COORD lasttitlepos;
	
	COORD lastquotepos;
	int quotenumber = rand()%3;
	
	COORD lastlevelpos;
	
	char quotestring[TS_FINAL][3][60] = 
	{
		{"-They Sense Your Every Move-", "-They Know Your Every Thought-", "-They Brought You To Life-"},
		{"-You Do Not Officially Exist-", "-You Have No Lifeline-", "-You Can Never Go Back-"},
		{"-Silence Is Your Only Ally-", "-There Is No Sanctuary-", "-They've Programmed You-"},
		{"-They Took Everything From You-", "-Mortis Absolvo-", "-They Can Take It All Away-"},
		{"-Veritas Ventosus-", "-Nobody Can Know The Whole Truth-", "-They Promised You Everything-"},
		{"-Ashes To Ashes, Dust To Dust-", "-In The End We Are All Alone-", "-We're All Slaves To Someone-"},
		{"-In The End, All Is Ruin-", "-Never Shall The Two Meet-", "-Eternity Lies Beyond-"}
	};
	char titlestring[TS_FINAL][60] = 
	{"OPERATIONS CONTROL", "OFFICE OF PERSONNEL AND RECORDS", "ARMORY AND OUTFITTING CENTER", "TRAINING SIMULATOR CENTER", "SARTU NETWORK UPLINK CENTER", "THE SILENT WALL", "NUCLEAR WEAPONS STORAGE"};
	char levelstring[TS_FINAL][60] = 
	{"DSA - LEVEL V", "DSA - LEVEL I", "DSA - LEVEL IV", "DSA - LEVEL V", "DSA - LEVEL III", "DSA - LEVEL I", "DSA-LEVEL VI"};
	
	
	cls();
	Sleep(500);
	
	if (titlenumber < 0 && titlenumber > TS_FINAL)
	{
		printf("ILLEGAL TITLE!!!!!!\n");
		printf("<PRESS A KEY>");
		waitforkey();
		return;
	}
	
	
//	sprintf(datestring, "%2.2d/%2.2d/%4.4d - %2.2d%2.2d HOURS", chronostruct->month, chronostruct->day, chronostruct->year, chronostruct->hour, chronostruct->minute);
	
	consize = getconsize();
	lastdatepos.X = 0;
	lastdatepos.Y = consize.Y - 1;
	
	lastlevelpos.Y = retrieveTextCenterV() + 1;
	lastlevelpos.X = retrieveTextCenterH(levelstring[titlenumber]);
	
	lastquotepos.Y = retrieveTextCenterV() - 1;
	lastquotepos.X = retrieveTextCenterH(quotestring[titlenumber][quotenumber]);
	
	lasttitlepos = retrieveTextCenter(titlestring[titlenumber]);
	
	setcursor(lastquotepos.X, lastquotepos.Y);
	GREEN;
	printf("%s", quotestring[titlenumber][quotenumber]);
	Sleep(150);
	LGREEN;
	setcursor(lastquotepos.X, lastquotepos.Y);
	printf("%s", quotestring[titlenumber][quotenumber]);
	
	Sleep(1000);
	
				setcursor(lastquotepos.X, lastquotepos.Y);
				GREEN;
				printf("%s", quotestring[titlenumber][quotenumber]);
				Sleep(150);
				
				cls();
				Sleep(1000);
				
				setcursor(lasttitlepos.X, lasttitlepos.Y);
				GREEN;
				printf("%s", titlestring[titlenumber]);
				setcursor(lastlevelpos.X, lastlevelpos.Y);
				printf("%s", levelstring[titlenumber]);
				Sleep(150);
				setcursor(lasttitlepos.X, lasttitlepos.Y);
				LGREEN;
				printf("%s", titlestring[titlenumber]);
				setcursor(lastlevelpos.X, lastlevelpos.Y);
				printf("%s", levelstring[titlenumber]);
				
				Sleep(500);
				
				setcursor(lastdatepos.X, lastdatepos.Y);
	//			bufferprint(50, datestring);
				
				Sleep(3000);
				
				
				/************************************************************
				; FADE OUT
				************************************************************/
				
				setcursor(lastdatepos.X, lastdatepos.Y);
				GREEN;
			//	printf("%s", datestring);
				setcursor(lasttitlepos.X, lasttitlepos.Y);
				GREEN;
				printf("%s", titlestring[titlenumber]);
				setcursor(lastlevelpos.X, lastlevelpos.Y);
				printf("%s", levelstring[titlenumber]);
				
				Sleep(150);
				cls();
				return;
				
				
}