Ejemplo n.º 1
0
void Intro(void)
{	
	NewGameWindow(1);	/* Set to 512 mode */ 

	FadeToBlack();		/* Fade out the video */
	
	DisplayScreen(rMacPlayPic, rMacPlayPal);
	BlastScreen();

	StartSong(SongListPtr[0]);	/* Play the song */
	
	FadeTo(rMacPlayPal);		/* Fade in the picture */
	WaitTicksEvent(240);		/* Wait for event */
	
	DisplayScreen(rMacPlayPic, rIdLogoPal); /* higher bpp hack */
	BlastScreen();
	
	FadeTo(rIdLogoPal);

	if (toupper(WaitTicksEvent(240))=='B') { /* Wait for event */
		FadeToBlack();
		ClearTheScreen(BLACK);
		DisplayScreen(rYummyPic, rYummyPal);
		BlastScreen();
		FadeTo(rYummyPal);
		
		WaitTicksEvent(600);
	}	
}
Ejemplo n.º 2
0
GameStatus MyWorld::RunLevel()
{
	//Nachman Initializations
	NachMan* Nach		= GetNachMan();
	Maze*	 cur_maze	= GetMaze();
	if (Nach->GetNumLivesLeft() > 0)
	{
		Nach->SetActorState(ALIVE, false);			//This sets NachMan direction to NONE
		Nach->SetX(cur_maze->GetNachManStartX());
		Nach->SetY(cur_maze->GetNachManStartY());
	}
	//Monster Initializations
	Actor* Monst;
	for (int i=0;i<NUM_MONSTERS;i++)
	{
		Monst = GetMonster(i);
		Monst->SetActorState(NORMAL, true);
		Monst->SetX(cur_maze->GetMonsterStartX());
		Monst->SetY(cur_maze->GetMonsterStartY());
	}

	DisplayScreen(true);
	
	while(Nach->GetActorState() == ALIVE &&  cur_maze->GetRemainingFood() > 0)
	{
		Nach->doSomething();		//Allow NachMan to move	
		//If NachMan is still alive, allow monsters to move
		if(Nach->GetActorState() == ALIVE)				{
			for (int j = 0; j <NUM_MONSTERS; j++)	{
				Monst = GetMonster(j);
				Monst->doSomething();				}	}
		DisplayScreen(false);
	}
	
	if (cur_maze->GetRemainingFood() == 0)
		return FINISHED_LEVEL;
	else
		return PLAYER_DIED;
}
Ejemplo n.º 3
0
Boolean TitleScreen()
{
	Word RetVal;		/* Value to return */

	playstate = EX_LIMBO;	/* Game is not in progress */
	NewGameWindow(1);	/* Set to 512 mode */
	FadeToBlack();		/* Fade out the video */

	DisplayScreen(rTitlePic, rTitlePal);
	BlastScreen();

	StartSong(SongListPtr[0]);
	FadeTo(rTitlePal);	/* Fade in the picture */
	BlastScreen();
	
	RetVal = WaitTicksEvent(0);		/* Wait for event */
	
	playstate = EX_COMPLETED;

	return TRUE;	
}
Ejemplo n.º 4
0
bool intern initmonitor()
/***********************/
{
    WORD height, width;

    ScreenHandle = CreateScreen( uigetscreenname(),
                        DONT_CHECK_CTRL_CHARS | AUTO_DESTROY_SCREEN );
    if( ScreenHandle == -1 ) {
        return( FALSE );
    }
    SetCurrentScreen( ScreenHandle );

    SetPositionOfInputCursor( 0, 0 );
    HideInputCursor();

    DisplayScreen( ScreenHandle );

    if( UIData == NULL ) {
        UIData = &ui_data;
    }

    GetSizeOfScreen( &height, &width );

    UIData->height = (ORD) height;
    UIData->width  = (ORD) width;


/* IsColorMonitor doesn't seem to be working for NetWare 3.11 */
/* so we'll just assume a colour monitor for now. */

    if( IsColorMonitor( ) ){
        UIData->colour = M_CGA;
    } else {
        UIData->colour = M_MONO;
    } /* end if */

    return( TRUE );
}
Ejemplo n.º 5
0
bool RKPClass::loop_PanelMon()
{
	static int msgbufLen = 0;
	static byte msgbuf[ixMaxPanel];
	static bool bReceivingPacketNow = false;
	static byte lastByte=-1;

	//Note - nothing here is to be blocking
	//- so sending emails must not block receiving serial logs

	/*static byte buf[64];
	static int bufix=0;
	while(Serial1.available())
	{
		buf[bufix++] = Serial1.read();
		if (bufix==64)
		{
			bufix=0;
			LogHex(buf,64);
		}
	}
	return;*/

	//Knock off the "We Sent To Panel" Led not less than 100ms after we turn it on
	if (timeToSwitchOffLed != 0 && millis() > timeToSwitchOffLed)
	{
		timeToSwitchOffLed = 0;
		digitalWrite(LED_Stat, LOW);
	}

	//Software UART not great at receiving for some reason :/ - ok for sending.
	while(Serial1.available())	//if(Serial1.available())
	{
		byte rx = Serial1.read();
		if (bReceivingPacketNow == false)
		{
			if(lastByte == 0)
			{//last char was a zero - this was the end of the last message
				if (rx==0)
					continue; //CD34 sends 0 at start And 0 at End - different to CD72 and 92 - so ignore extra zero

				//It may be for us or not - but get whole message before testing so we stay in sync
				bReceivingPacketNow = true;
				msgbufLen=0;
				//not necessary to blank - but good for debug
				for(int n=0;n<ixMaxPanel;n++)
					msgbuf[n]=0xFF;
				msgbuf[msgbufLen++]=rx;
			}
			lastByte = rx;
			continue; //wait for byte#3 (0,id,..)
		}
		lastByte = rx;	//needed in case cs error

		msgbuf[msgbufLen++]=rx;
		if (rx!=0)
		{//wasn't end of packet - is buffer full?
			if (msgbufLen>=ixMaxPanel)
			{//packet never terminated - bytes lost :(
				Log(F("Buf overflow"));
				bReceivingPacketNow = false;
				continue;
			}
		}
		else
		{//End of the packet
			bReceivingPacketNow = false;

			byte idDev = (msgbuf[0] & 0xf0)>>4; //ID of remote that message is for 0x0-0xf are valid ids

			//Uncomment to Display all packets
			//Log(F("DevID:"));Log(idDev);Log(' ');LogHex(msgbuf,msgbufLen);
			//LogLn(idDev);

			byte cs = 0;
			for(int n=0;n<msgbufLen;n++)
			{
				byte rx = msgbuf[n];
				if (n<msgbufLen-2) //dont sum cs or terminator
					cs+=rx;
				//Log((char)rx);
			}

			if (cs == 0)
				cs++; //protocol avoids 0 except for end marker- so will send cs 00 as 01
			if (cs != msgbuf[msgbufLen-2])
			{
				LogLn(F("CS Fail :( "));
				LogHex(msgbuf,msgbufLen);
				//Log(F("Dev:"));LogLn(idDev);LogLn(F("!"));
				continue;
			}


			//For CD34 this is ok- but not for 72/92 as there is no start 0. lastByte=-1; //good message - so waiting again for next zero

			//for us?
			if (idDev==mdevID)
			{
				bool bAck = (msgbuf[0] & 0x04) != 0;	//required for good comms
				SendToPanel(mdevID, bAck);
				DisplayScreen(msgbuf, msgbufLen); //try display what device 0 sees
				//LogLn(F("-OK-"));
			}
			else
			{
				//LogLn("-Not for us-");
			}

			{//Send Email if alarm lights come on
				bool bIsPanelWarning = (msgbuf[1] & 0x04) != 0;
				if (bIsPanelWarning == true && RKPClass::mbIsPanelWarning == false)
					SMTP::QueueEmail();
				RKPClass::mbIsPanelWarning = bIsPanelWarning;

				bool bIsPanelAlarm = (msgbuf[1] & 0x02) != 0;
				if (bIsPanelAlarm == true && RKPClass::mbIsPanelAlarm == false)
					SMTP::QueueEmail();
				RKPClass::mbIsPanelAlarm = bIsPanelAlarm;
			}
		}
	}


	return bScreenHasUpdated;
}
Ejemplo n.º 6
0
int _tmain(int argc, char **argv)
{
	int i;
	TCHAR lpStr[80];

	for (i = 0; i < 80; i++)
		lpEmpty[i] = lpHeader[i] = _T(' ');
	lpEmpty[79] = _T('\0');

	/* Initialize global variables */
	hInst = 0 /* FIXME: which value? [used with LoadString(hInst, ..., ..., ...)] */;

	if (LoadString(hInst, IDS_COLUMN_NUMBER, lpStr, 80))
	{
		columnRightPositions[0] = _tcslen(lpStr) + 3;
		_tcsncpy(&lpHeader[2], lpStr, _tcslen(lpStr));
	}
	if (LoadString(hInst, IDS_COLUMN_IMAGENAME, lpStr, 80))
	{
		columnRightPositions[1] = columnRightPositions[0] + _tcslen(lpStr) + 3;
		_tcsncpy(&lpHeader[columnRightPositions[0] + 2], lpStr, _tcslen(lpStr));
	}
	if (LoadString(hInst, IDS_COLUMN_PID, lpStr, 80))
	{
		columnRightPositions[2] = columnRightPositions[1] + _tcslen(lpStr) + 3;
		_tcsncpy(&lpHeader[columnRightPositions[1] + 2], lpStr, _tcslen(lpStr));
	}
	if (LoadString(hInst, IDS_COLUMN_CPU, lpStr, 80))
	{
		columnRightPositions[3] = columnRightPositions[2] + _tcslen(lpStr) + 3;
		_tcsncpy(&lpHeader[columnRightPositions[2] + 2], lpStr, _tcslen(lpStr));
	}
	if (LoadString(hInst, IDS_COLUMN_MEM, lpStr, 80))
	{
		columnRightPositions[4] = columnRightPositions[3] + _tcslen(lpStr) + 3;
		_tcsncpy(&lpHeader[columnRightPositions[3] + 2], lpStr, _tcslen(lpStr));
	}
	if (LoadString(hInst, IDS_COLUMN_PF, lpStr, 80))
	{
		columnRightPositions[5] = columnRightPositions[4] + _tcslen(lpStr) + 3;
		_tcsncpy(&lpHeader[columnRightPositions[4] + 2], lpStr, _tcslen(lpStr));
	}

	for (i = 0; i < columnRightPositions[5]; i++)
		lpSeparator[i] = _T('-');
	lpHeader[0] = _T('|');
	lpSeparator[0] = _T('+');
	for (i = 0; i < 6; i++)
	{
		lpHeader[columnRightPositions[i]] = _T('|');
		lpSeparator[columnRightPositions[i]] = _T('+');
	}
	lpSeparator[columnRightPositions[5] + 1] = _T('\0');
	lpHeader[columnRightPositions[5] + 1] = _T('\0');


	if (!LoadString(hInst, IDS_APP_TITLE, lpTitle, 80))
		lpTitle[0] = _T('\0');
	if (!LoadString(hInst, IDS_COLUMN_MEM_UNIT, lpMemUnit, 3))
		lpMemUnit[0] = _T('\0');
	if (!LoadString(hInst, IDS_MENU, lpMenu, 80))
		lpMenu[0] = _T('\0');
	if (!LoadString(hInst, IDS_IDLE_PROCESS, lpIdleProcess, 80))
		lpIdleProcess[0] = _T('\0');

	if (LoadString(hInst, IDS_MENU_QUIT, lpStr, 2))
		KEY_QUIT = lpStr[0];
	if (LoadString(hInst, IDS_MENU_KILL_PROCESS, lpStr, 2))
		KEY_KILL = lpStr[0];
	if (LoadString(hInst, IDS_YES, lpStr, 2))
		KEY_YES = lpStr[0];
	if (LoadString(hInst, IDS_NO, lpStr, 2))
		KEY_NO = lpStr[0];

	GetInputOutputHandles();

	if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE)
	{
		if (LoadString(hInst, IDS_CTM_GENERAL_ERR1, lpStr, 80))
			_tprintf(lpStr);
		return -1;
	}

	if (GetConsoleMode(hStdin, &inConMode) == 0)
	{
		if (LoadString(hInst, IDS_CTM_GENERAL_ERR2, lpStr, 80))
			_tprintf(lpStr);
		return -1;
	}

	if (GetConsoleMode(hStdout, &outConMode) == 0)
	{
		if (LoadString(hInst, IDS_CTM_GENERAL_ERR3, lpStr, 80))
			_tprintf(lpStr);
		return -1;
	}

	SetConsoleMode(hStdin, 0); //FIXME: Should check for error!
	SetConsoleMode(hStdout, 0); //FIXME: Should check for error!

	PerfInit();

	while (1)
	{
		DWORD numEvents;

		PerfDataRefresh();
		DisplayScreen();

		/* WaitForSingleObject for console handles is not implemented in ROS */
		WaitForSingleObject(hStdin, 1000);
		GetNumberOfConsoleInputEvents(hStdin, &numEvents);

		if (numEvents > 0)
		{
			if (ProcessKeys(numEvents) == TRUE)
				break;
		}
	}

	RestoreConsole();
	return 0;
}
Ejemplo n.º 7
0
/******************************************************************************
* Interpret the command line and scan the given GIF file.		      *
******************************************************************************/
void main(int argc, char **argv)
{
    int	i, j, k, Error, NumFiles, Size, Row, Col, Width, Height, ExtCode,
	Count, ColorMapSize, GraphDriver, GraphMode, Sum,
	HelpFlag = FALSE,
	BGIPathFlag = FALSE,
	BGIUserDriverFlag = FALSE,
	ZoomFlag = FALSE;
    GifRecordType RecordType;
    GifByteType *Extension;
    char Str[80], *BGIUserDriverNameMode,
	**FileName = NULL;
    GifRowType *ScreenBuffer;
    GifFileType *GifFile;
    struct text_info TextInfo;      /* So we can restore starting text mode. */

    if ((Error = GAGetArgs(argc, argv, CtrlStr,
		&GifQuitePrint, &BGIPathFlag, &BGIPath,
		&BGIUserDriverFlag, &BGIUserDriverNameMode,
		&ZoomFlag, &ZoomFactor,
		&BeepsDisabled, &HelpFlag,
		&NumFiles, &FileName)) != FALSE ||
		(NumFiles > 1 && !HelpFlag)) {
	if (Error)
	    GAPrintErrMsg(Error);
	else if (NumFiles > 1)
	    GIF_MESSAGE("Error in command line parsing - one GIF file please.");
	GAPrintHowTo(CtrlStr);
	exit(1);
    }

    if (HelpFlag) {
	fprintf(stderr, VersionStr);
	GAPrintHowTo(CtrlStr);
	exit(0);
    }

    if (BGIUserDriverFlag) {
	/* Use the driver supplied by the user! */
        BGIInstallUserDriver(BGIUserDriverNameMode);
        installuserdriver(BGIUserDriverName, detectVGA);
	GraphDriver = BGI_USER_INSTALL;
    }
    else {
        /* Sense type of display we have and attempt to load right driver. */
        detectgraph(&GraphDriver, &GraphMode);
        if (GraphDriver < 0)
	    GIF_EXIT("BGI Auto detect: No graphics device detected.");
    }

    /* Put in the following any graphic driver specific setup: */
    switch (GraphDriver) {
	case CGA:
	    GraphMode = CGAHI;
	    break;
	case EGA:
	    GraphMode = EGAHI;
	    break;
	case EGA64:
	    GraphMode = EGA64HI;
	    break;
	case EGAMONO:
	    GraphMode = EGAMONOHI;
	    break;
	case HERCMONO:
	    GraphMode = HERCMONOHI;
	    break;
	case VGA:
	    GraphMode = VGAHI;
	    break;
	case BGI_USER_INSTALL:
	    GraphDriver = DETECT;
	    GraphMode = BGIUserDriverMode;
	    break;
	default:
	    GIF_EXIT("Requested graphic device is not supported.");
	    break;
    }

    if (NumFiles == 1) {
	GifFileName = *FileName;
	if ((GifFile = DGifOpenFileName(*FileName)) == NULL) {
	    PrintGifError();
	    exit(-1);
	}
    }
    else {
	/* Use the stdin instead: */
	GifFileName = "Stdin";
	setmode(0, O_BINARY);
	if ((GifFile = DGifOpenFileHandle(0)) == NULL) {
	    PrintGifError();
	    exit(-1);
	}
    }

    /* Allocate the screen as vector of column of rows. We cannt allocate    */
    /* the all screen at once, as this broken minded CPU can allocate up to  */
    /* 64k at a time and our image can be bigger than that:		     */
    /* Note this screen is device independent - its the screen as defined by */
    /* the GIF file parameters itself.					     */
    if ((ScreenBuffer = (GifRowType *)
	malloc(GifFile -> SHeight * sizeof(GifRowType *))) == NULL)
	    GIF_EXIT("Failed to allocate memory required, aborted.");

    Size = GifFile -> SWidth * sizeof(GifPixelType);/* Size in bytes of one row.*/
    if ((ScreenBuffer[0] = (GifRowType) malloc(Size)) == NULL)    /* First row. */
	GIF_EXIT("Failed to allocate memory required, aborted.");

    for (i = 0; i < GifFile -> SWidth; i++)  /* Set its color to BackGround. */
	ScreenBuffer[0][i] = GifFile -> SBackGroundColor;
    MaximumScreenHeight = GifFile -> SHeight - 1;
    for (i = 1; i < GifFile -> SHeight; i++) {
	/* Allocate the other rows, and set their color to background too: */
	if ((ScreenBuffer[i] = (GifRowType) malloc(Size)) == NULL) {
	    if (i > 30) {
		/* Free some memory for the BGI driver and auxilary. */
		for (j = 1; j < 28; j++)
	    	    free((char *) ScreenBuffer[i - j]);
	    	MaximumScreenHeight = i - 28;
	    	fprintf(stderr, "\n%s: Failed to allocate all memory required, last line %d.\n",
			PROGRAM_NAME, MaximumScreenHeight);
	    	break;
	    }
	    else
		GIF_EXIT("Failed to allocate memory required, aborted.");
	}

	memcpy(ScreenBuffer[i], ScreenBuffer[0], Size);
    }

    /* Scan the content of the GIF file and load the image(s) in: */
    do {
	if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) {
	    PrintGifError();
	    break;
	}
	switch (RecordType) {
	    case IMAGE_DESC_RECORD_TYPE:
		if (DGifGetImageDesc(GifFile) == GIF_ERROR) {
		    PrintGifError();
		    exit(-1);
		}

		Row = GifFile -> ITop; /* Image Position relative to Screen. */
		Col = GifFile -> ILeft;
		Width = GifFile -> IWidth;
		Height = GifFile -> IHeight;
		GifQprintf("\n%s: Image %d at (%d, %d) [%dx%d]:     ",
		    PROGRAM_NAME, ++ImageNum, Col, Row, Width, Height);
		if (GifFile -> ILeft + GifFile -> IWidth > GifFile -> SWidth ||
		   GifFile -> ITop + GifFile -> IHeight > GifFile -> SHeight) {
		    fprintf(stderr, "Image %d is not confined to screen dimension, aborted.\n");
		    exit(-2);
		}
		if (GifFile -> IInterlace) {
		    /* Need to perform 4 passes on the images: */
		    for (Count = i = 0; i < 4; i++)
			for (j = Row + InterlacedOffset[i]; j < Row + Height;
						 j += InterlacedJumps[i]) {
			    GifQprintf("\b\b\b\b%-4d", Count++);
			    if (DGifGetLine(GifFile,
				&ScreenBuffer[MIN(j, MaximumScreenHeight)][Col],
				Width) == GIF_ERROR) {
				PrintGifError();
				exit(-1);
			    }
			}
		}
		else {
		    for (i = 0; i < Height; i++, Row++) {
			GifQprintf("\b\b\b\b%-4d", i);
			if (DGifGetLine(GifFile, &ScreenBuffer[MIN(Row, MaximumScreenHeight)][Col],
				Width) == GIF_ERROR) {
			    PrintGifError();
			    MaximumScreenHeight = MIN(i - 1, MaximumScreenHeight);
			}
		    }
		}
		break;
	    case EXTENSION_RECORD_TYPE:
		/* Skip any extension blocks in file: */
		if (DGifGetExtension(GifFile, &ExtCode, &Extension) == GIF_ERROR) {
		    PrintGifError();
		    exit(-1);
		}
		while (Extension != NULL) {
		    if (DGifGetExtensionNext(GifFile, &Extension) == GIF_ERROR) {
			PrintGifError();
			exit(-1);
		    }
		}
		break;
	    case TERMINATE_RECORD_TYPE:
		break;
	    default:		    /* Should be traps by DGifGetRecordType. */
		break;
	}
    }
    while (RecordType != TERMINATE_RECORD_TYPE);

    /* Lets display it - set the global variables required and do it: */
    BackGround = GifFile -> SBackGroundColor;
    ColorMap = (GifFile -> IColorMap ? GifFile -> IColorMap :
				       GifFile -> SColorMap);
    ColorMapSize = 1 << (GifFile -> IColorMap ? GifFile -> IBitsPerPixel :
						GifFile -> SBitsPerPixel);

    gettextinfo(&TextInfo);	     /* Save current mode so we can recover. */

    initgraph(&GraphDriver, &GraphMode, BGIPath);
    if (graphresult() != grOk)	 	       /* Error occured during init. */
	GIF_EXIT("Graphics System Error, failed to initialize driver.");

    if (getmaxcolor() + 1 < ColorMapSize) {
	sprintf(Str, "GIF Image color map (%d) is too big for device (%d).\n",
					      ColorMapSize, getmaxcolor() + 1);
	closegraph();
	GIF_EXIT(Str);
    }

    /* Initialize hardware pallete and also select fore/background color.    */
    BackGround = ForeGround = 1;
    Sum = ((int) ColorMap[1].Red) +
	  ((int) ColorMap[1].Green) +
	  ((int) ColorMap[1].Blue);
    j = k = Sum;
    for (i = 0; i < ColorMapSize; i++) {
	setrgbpalette(i, ColorMap[i].Red >> 2,
			 ColorMap[i].Green >> 2,
			 ColorMap[i].Blue >> 2);

	Sum = ((int) ColorMap[i].Red) +
	      ((int) ColorMap[i].Green) +
	      ((int) ColorMap[i].Blue);
	if (i != 0 && Sum > j) {			/* Dont use color 0. */
	    ForeGround = i;
	    j = Sum;
	}
	if (i != 0 && Sum <= k) {			/* Dont use color 0. */
	    BackGround = i;
	    k = Sum;
	}
    }

    DeviceMaxX = getmaxx();		    /* Read size of physical screen. */
    DeviceMaxY = getmaxy();
    ScreenWidth = GifFile -> SWidth;
    ScreenHeight = MIN(GifFile -> SHeight, MaximumScreenHeight);

    Tone(500, 10);
    DisplayScreen(ScreenBuffer, GifFile);

    if (DGifCloseFile(GifFile) == GIF_ERROR) {
	PrintGifError();
	closegraph();
	exit(-1);
    }

    closegraph();

    textmode(TextInfo.currmode);
}
Ejemplo n.º 8
0
void LevelCompleted(void)
{
    Word k;

    /* setup */

    ParTime = MapListPtr->InfoArray[gamestate.mapon].ParTime;
    BonusScore = 0;		/* Init the bonus */

    IntermissionHack = TRUE;	/* Hack to keep score from drawing twice */
    NumberIndex = 47;		/* Hack to draw score using an alternate number set */
    NewGameWindow(1);		/* Force 512 mode screen */

    DisplayScreen(rIntermission, rInterPal);
    BlastScreen();

    InitInterMisPic();

    WhichBJ = 0;		/* Init BJ */
    BJTime = ReadTick()-50;		/* Force a redraw */
    BlastScreen();		/* Draw the screen */
    ShowBJ();			/* Draw BJ */
    StartSong(SongListPtr[1]);	/* Play the intermission song */
    SetAPalette(rInterPal);	/* Set the palette */
    DrawIScore();			/* Draw the current score */
    FlushKeys();			/* Flush the keyboard buffer */

    /* First an initial pause */

    BJBreath(60);

    /* Display Par Time, Player's Time, and show bonus if any. */

    if (gamestate.playtime>=(100*60*60UL)) {
        k =(99*60)+59;
    } else {
        k = gamestate.playtime/60;
    }
    DrawTime(TIMEX,TIMEY,k);		/* How much time has elapsed? */
    DrawTime(TIMEX,TIMEY2,ParTime);

    if (k < ParTime) {
        k = (ParTime-k) * 50;		/* 50 points per second */
        BonusScore += k;		/* Add to the bonus */
        DrawIBonus();			/* Draw the bonus */
        PlaySound(SND_EXTRA);
        BJBreath(60);			/* Breath a little */
    }

    /* Show ratios for "terminations", treasure, and secret stuff. */
    /* If 100% on all counts, Perfect Bonus! */

    k=0;		/* Not perfect (Yet) */
    RollRatio(RATIOX,RATIOY,(gamestate.treasurecount*100)/gamestate.treasuretotal);
    if (gamestate.treasurecount == gamestate.treasuretotal) {
        k++;			/* Perfect treasure */
    }
    if (!NoEnemies) {
        RollRatio(RATIOX,RATIOY2,(gamestate.killcount*100)/gamestate.killtotal);
        if (gamestate.killcount == gamestate.killtotal) {
            k++;			/* Perfect kills */
        }
    }
    RollRatio(RATIOX,RATIOY3,(gamestate.secretcount*100)/gamestate.secrettotal);
    if (gamestate.secretcount == gamestate.secrettotal) {
        k++;			/* Perfect secret */
    }
    if (BonusScore) {	/* Did you get a bonus? */
        RollScore();
        BJBreath(60);
    }
    if (k==3) {
        WhichBJ = 2;	/* Draw thumbs up for BJ */
        PlaySound(SND_THUMBSUP);
    }
    do {
        ShowBJ();		/* Animate BJ */
    } while (!WaitTicksEvent(1));		/* Wait for a keypress */

    FadeToBlack();		/* Fade away */

    FreeInitMisPic();
    IntermissionHack = FALSE;		/* Release the hack */
    NumberIndex = 36;			/* Restore the index */
}
Ejemplo n.º 9
0
void gp2x_video_flip_single(struct osd_bitmap *bitmap)
{
    DisplayScreen(bitmap);
}
Ejemplo n.º 10
0
static void statusDrawFinish() {
	DisplayScreen(&bottomScreen);
	DisplayScreen(&top1Screen);
//	DisplayScreen(&top2Screen);
	TryScreenShot();
}
Ejemplo n.º 11
0
int main(){
	int gd=DETECT, gm;
	int Return=0;
	char Key, ScanCode;
	int Counter=0;                          //Divide total delay & take multiple input
	initgraph(&gd, &gm,"c:\\tc\\bgi");      //initialize graphics mode
	randomize();                            //Randomize block's shapes & color
	cleardevice();                          //clear screen
	InitPalette();                          //for setting color pallete
	InitMatrix();                           //Initialize Matrix
	GetImages();                            //Saving the images
	StartScreen();                          //for start screen
	cleardevice();                          //clear screen
	AssignShape(GetRandomShape(), GetRandomColor());      //for the falling block
	NextShape=GetRandomShape();
	NextColor=GetRandomColor();                                         	DisplayScreen();                        //Show main screen
	DisplayNextShape();                     //show next brick
	MoveBlock(LEFT);                        //keep the block on center & check game over
	while(kbhit()) getch();  		//empty the keyboard input
	while (!Quit && !GameOver) {            //Moving the blocks down
		if(++Counter >= Speed)          //For controling the speed
		{	Counter=0;
			MoveBlock(DOWN);
			SoundDrop();
		}
		if(kbhit())                     //For the arrow keys
		{  Key = getch();
		   if(Key == 0)
		   {	   ScanCode = getch();
			   if(ScanCode == KEY_UP)
					RotateBlock();
			   else if(ScanCode == KEY_LEFT)
					MoveBlock(LEFT);
			   else if(ScanCode == KEY_RIGHT)
					MoveBlock(RIGHT);
			   else if(ScanCode == KEY_DOWN)
			   {		Score++;         //increase score
					PrintScore();
					MoveBlock(DOWN);
			   }
			   if(!Return)
				   SoundDrop();
			   Return = 0;
		   }
		   else if(Key == KEY_ENTER || Key == KEY_SPACE)   //Rotating bricks
				RotateBlock();
		   else if(Key == 'P' || Key == 'p')      //For pause
		   {	  MessageBox("  Paused");
			  while(kbhit()) getch();         //clear the keyboard input
			  for(int x=0; x<COLS; x++)
				 for(int y=0; y<ROWS; y++)
					PreviousScreenLayout[x][y] -= 1;    //Clear the present screen layout to refresh the whole screen
			  UpdateScreen();                //refresh screen
		   }
		   else if(Key == KEY_ESC)                                      //For quit
		   {	  char ret = MessageBox("Are you sure, you want to Quit?", 563, 2);
			  if(ret == 'y' || ret == 'Y' || ret == KEY_ENTER)
			  {	  Quit = 1;
				  break;
			  }
			  cleardevice();                              //Clear the message box
			  while(kbhit()) getch();  		      //Clear the keyboard input
			  for(int x=0; x<COLS; x++)
				 for(int y=0; y<ROWS; y++)
					PreviousScreenLayout[x][y] -= 1;    // Clear the present screen layout to refresh the whole screen
			  UpdateScreen();                //refresh screen
			  DisplayScreen();               //show the main screen again
			  DisplayNextShape();            //show next brick box
		   }
		   else if(Key == 's' || Key == 'S')        //For sound on/off
		   {
			  SoundOn = !SoundOn;

		   }
		   else if(Key=='a' || Key=='A')                      //For author
		   {	 MessageBox("Author: Aguntuk Group",450);
			 cleardevice();                               //Clear the message box
			 while(kbhit()) getch();                      //Clear the keyboard input
			 for(int x=0;x<COLS;x++)
				for(int y=0;y<ROWS;y++)
					PreviousScreenLayout[x][y] -=1;     //Clear the present screen layout to refresh the whole screen
			 UpdateScreen();                   //refresh screen
			 DisplayScreen();                  //show the main screen again
			 DisplayNextShape();               //show next brick box
		   }
		}
		delay(6);      	      //For moving down the blocks slowly
	}
	if(GameOver)                  //For game over option
	{      	DisplayBlock(6,0);    //For display the top most brick
		ShowGameOver();       //For display game over message box
	}
	restorecrtmode();    //For closing graphicg mode
	return 0;
}