extern void Show_WinnerScreen(void)
{
	LoadAvPMenuGfx(AVPMENUGFX_WINNER_SCREEN);
	
	int timeRemaining = 10*ONE_FIXED;
	do
	{
		int a = timeRemaining*2;
		if (a>ONE_FIXED)
		{
		  	DrawAvPMenuGfx(AVPMENUGFX_WINNER_SCREEN, 0, 0, ONE_FIXED+1,AVPMENUFORMAT_LEFTJUSTIFIED);
		}
		else
		{
		  	DrawAvPMenuGfx_Faded(AVPMENUGFX_WINNER_SCREEN, 0, 0, a,AVPMENUFORMAT_LEFTJUSTIFIED);
		}

		CheckForWindowsMessages();
		FlipBuffers();
			
	  	DirectReadKeyboard();	
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	while(timeRemaining>=0 && !DebouncedGotAnyKey);
	ClearScreenToBlack();
	FlipBuffers();
	ClearScreenToBlack();
	FlipBuffers();
	
}
extern void ShowSplashScreens(void)
{
	LoadAllSplashScreenGfx();
	int i;
	enum AVPMENUGFX_ID graphic[] = 
	{
		AVPMENUGFX_SPLASH_SCREEN1,AVPMENUGFX_SPLASH_SCREEN2,AVPMENUGFX_SPLASH_SCREEN3,
		AVPMENUGFX_SPLASH_SCREEN4,AVPMENUGFX_SPLASH_SCREEN5,
	};
	for (i=0; i<5; i++)
	{
		int timeRemaining = 5*ONE_FIXED;
		do
		{
			int a = timeRemaining*2;
			if (a>ONE_FIXED) a=ONE_FIXED;
			
			if (i!=4)
			{
			  	DrawAvPMenuGfx_CrossFade(graphic[i],graphic[i+1], a);
				timeRemaining-=NormalFrameTime;
			}
			else
			{
				if (a==ONE_FIXED)
				{
				  	DrawAvPMenuGfx(graphic[i], 0, 0, ONE_FIXED+1,AVPMENUFORMAT_LEFTJUSTIFIED);
				}
				else
				{
				  	DrawAvPMenuGfx_Faded(graphic[i], 0, 0, a,AVPMENUFORMAT_LEFTJUSTIFIED);
				}
				timeRemaining-=NormalFrameTime/2;
			}
			CheckForWindowsMessages();
			FlipBuffers();
			
		  	DirectReadKeyboard();	
			FrameCounterHandler();
		}
		while(timeRemaining>=0 && !DebouncedGotAnyKey);
	}
	ClearScreenToBlack();
	FlipBuffers();
	ClearScreenToBlack();
	FlipBuffers();

}
extern void PlayIntroSequence(void)
{
	if (IntroHasAlreadyBeenPlayed)
	{
		StartMenuMusic();
		return;
	}
	IntroHasAlreadyBeenPlayed=1;

	ResetFrameCounter();
	Show_CopyrightInfo();

	/* play the Fox Interactive FMV */
	ClearScreenToBlack();
	FlipBuffers();
	ClearScreenToBlack();

	PlayBinkedFMV("FMVs/logos.bik");
	//PlayFMV("FMVs/rebellion.smk");

	StartMenuMusic();
	ResetFrameCounter();
	
	Show_Presents();
	#if ALLOW_SKIP_INTRO
	if (!GotAnyKey) Show_ARebellionGame();
	if (!GotAnyKey) Show_AvPLogo();
	#else
	Show_ARebellionGame();
	Show_AvPLogo();
	#endif

}
Ejemplo n.º 4
0
void Update(World *const w)
{
	for(int y = 0; y < w->height; ++y)
	{
		for(int x = 0; x < w->width; ++x)
		{
			UpdateCell(w, x, y);
		}
	}
	FlipBuffers(w);	
}
void Show_CopyrightInfo(void)
{
	int timeRemaining = ONE_FIXED/2;
	do
	{
		CheckForWindowsMessages();
		{
			DrawAvPMenuGfx_Faded(AVPMENUGFX_COPYRIGHT_SCREEN, 0, 0, ONE_FIXED-timeRemaining*2,AVPMENUFORMAT_LEFTJUSTIFIED);
			FlipBuffers();
		}
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	while(timeRemaining>0);
	
	timeRemaining = ONE_FIXED*2;
	do
	{
		CheckForWindowsMessages();
		{
			DrawAvPMenuGfx_Faded(AVPMENUGFX_COPYRIGHT_SCREEN, 0, 0, ONE_FIXED,AVPMENUFORMAT_LEFTJUSTIFIED);
			FlipBuffers();
		}
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	while(timeRemaining>0);
	
	timeRemaining = ONE_FIXED/2;
	do
	{
		CheckForWindowsMessages();
		{
			DrawAvPMenuGfx_Faded(AVPMENUGFX_COPYRIGHT_SCREEN, 0, 0, timeRemaining*2,AVPMENUFORMAT_LEFTJUSTIFIED);
			FlipBuffers();
		}
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	while(timeRemaining>0);
}
void Show_Presents(void)
{
	int timeRemaining = 8*ONE_FIXED-ONE_FIXED/2;
	do
	{
		CheckForWindowsMessages();
		{
			char *textPtr = GetTextString(TEXTSTRING_FOXINTERACTIVE);
			int y = (480-AvPMenuGfxStorage[AVPMENUGFX_PRESENTS].Height)/2;
			PlayMenuMusic();
			DrawMainMenusBackdrop();
	
			if (timeRemaining > 6*ONE_FIXED)
			{
			  //	DrawGraphicWithFadingLevel(&Starfield_Backdrop,timeRemaining-7*ONE_FIXED);
//				DrawAvPMenuGfx_Faded(AVPMENUGFX_BACKDROP, 0, 0, 15*ONE_FIXED-timeRemaining*2,AVPMENUFORMAT_LEFTJUSTIFIED);
				FadedScreen((15*ONE_FIXED-timeRemaining*2)/3);
			}
			else if (timeRemaining > 5*ONE_FIXED)
			{
				RenderMenuText(textPtr,MENU_CENTREX,y,6*ONE_FIXED-timeRemaining,AVPMENUFORMAT_CENTREJUSTIFIED);
			}
			else if (timeRemaining > 4*ONE_FIXED)
			{
				RenderMenuText(textPtr,MENU_CENTREX,y,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
			}
			else if (timeRemaining > 3*ONE_FIXED)
			{
				RenderMenuText(textPtr,MENU_CENTREX,y,timeRemaining-3*ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
			}
			
			FlipBuffers();
		}
		#if ALLOW_SKIP_INTRO
		DirectReadKeyboard();	
		#endif
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	#if ALLOW_SKIP_INTRO
	while((timeRemaining>0) && !GotAnyKey);
	#else
	while(timeRemaining>0);// && !GotAnyKey);
	#endif
}
void Show_ARebellionGame(void)
{
	int timeRemaining = 7*ONE_FIXED;
	do
	{
		CheckForWindowsMessages();
		{
			char *textPtr = GetTextString(TEXTSTRING_PRESENTS);
			int y = (480-AvPMenuGfxStorage[AVPMENUGFX_AREBELLIONGAME].Height)/2;
			DrawMainMenusBackdrop();
//			DrawAvPMenuGfx(AVPMENUGFX_BACKDROP, 0, 0, ONE_FIXED+1,AVPMENUFORMAT_LEFTJUSTIFIED);
			PlayMenuMusic();

			if (timeRemaining > 13*ONE_FIXED/2)
			{
//				DrawAvPMenuGfx(AVPMENUGFX_AREBELLIONGAME, MENU_CENTREX, y, 14*ONE_FIXED-timeRemaining*2,AVPMENUFORMAT_CENTREJUSTIFIED);
				RenderMenuText(textPtr,MENU_CENTREX,y,14*ONE_FIXED-timeRemaining*2,AVPMENUFORMAT_CENTREJUSTIFIED);
//				DrawGraphicWithAlphaChannel(&RebellionLogo,timeRemaining*2-13*ONE_FIXED);
 			}
			else if (timeRemaining > 5*ONE_FIXED)
			{
//				DrawAvPMenuGfx(AVPMENUGFX_AREBELLIONGAME, MENU_CENTREX, y, ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
				RenderMenuText(textPtr,MENU_CENTREX,y,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
//				DrawGraphicWithAlphaChannel(&RebellionLogo,0);
			}
			else if (timeRemaining > 3*ONE_FIXED)
			{
//				DrawAvPMenuGfx(AVPMENUGFX_AREBELLIONGAME, MENU_CENTREX, y, (timeRemaining-3*ONE_FIXED)/2,AVPMENUFORMAT_CENTREJUSTIFIED);
				RenderMenuText(textPtr,MENU_CENTREX,y,(timeRemaining-3*ONE_FIXED)/2,AVPMENUFORMAT_CENTREJUSTIFIED);
//				DrawGraphicWithAlphaChannel(&RebellionLogo, ONE_FIXED - (timeRemaining-3*ONE_FIXED)/2);
			}

			FlipBuffers();
		}
		DirectReadKeyboard();	
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	#if ALLOW_SKIP_INTRO
	while((timeRemaining>0) && !GotAnyKey);
	#else
	while(timeRemaining>0);// && !GotAnyKey);
	#endif
}
void Show_AvPLogo(void)
{
	int timeRemaining = 5*ONE_FIXED;
	do
	{
		CheckForWindowsMessages();
		{
			int y = (480-AvPMenuGfxStorage[AVPMENUGFX_ALIENSVPREDATOR].Height)/2;
			DrawMainMenusBackdrop();
//			DrawAvPMenuGfx(AVPMENUGFX_BACKDROP, 0, 0, ONE_FIXED+1,AVPMENUFORMAT_LEFTJUSTIFIED);
			PlayMenuMusic();

			if (timeRemaining > 9*ONE_FIXED/2)
			{
				DrawAvPMenuGfx(AVPMENUGFX_ALIENSVPREDATOR, MENU_CENTREX, y, -timeRemaining*2+10*ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
 			}
			else if (timeRemaining > 4*ONE_FIXED)
			{
				DrawAvPMenuGfx(AVPMENUGFX_ALIENSVPREDATOR, MENU_CENTREX, y, ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED);
			}
			else
			{
				DrawAvPMenuGfx(AVPMENUGFX_ALIENSVPREDATOR, MENU_CENTREX, y, timeRemaining/4,AVPMENUFORMAT_CENTREJUSTIFIED);
				timeRemaining-=NormalFrameTime/4;
			}

			FlipBuffers();
		}
		DirectReadKeyboard();	
		FrameCounterHandler();
		timeRemaining-=NormalFrameTime;
	}
	#if ALLOW_SKIP_INTRO
	while((timeRemaining>0) && !GotAnyKey);
	#else
	while(timeRemaining>0);// && !GotAnyKey);
	#endif
}
Ejemplo n.º 9
0
int main()
{
	// Set display options.
	// DCNT_MODE0 sets mode 0, which provides four tiled backgrounds.
	// DCNT_OBJ enables objects.
	// DCNT_OBJ_1D make object tiles mapped in 1D (which makes life easier).
	REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_OBJ;
	
	REG_BG0CNT = BG_CBB(0) | BG_SBB(30) | BG_8BPP | BG_REG_32x32 | BG_PRIO(0);
	
	REG_BG1CNT = BG_CBB(0) | BG_SBB(29) | BG_8BPP | BG_REG_32x32 | BG_PRIO(1);
	
	REG_BG2CNT = BG_CBB(0) | BG_SBB(25) | BG_8BPP | BG_REG_64x64 | BG_PRIO(2);
	REG_BG2HOFS = 0;
	REG_BG2VOFS = 0;
	
	ClearObjects();
	
	SetPaletteBG(1, RGB(31, 31, 31)); // white
	
	//Load each tile in font_bold into it's corresponding position in charblock 0
	for (int i = 0; i < 128; i++)
	{
		LoadTile8(0, i, font_bold[i]);
	}
	
	DrawText(5, (SCREEN_HEIGHT / 16) - 2, "DECEPTIVE DIMENSIONS");
	DrawText(5, (SCREEN_HEIGHT / 16), "Press start to begin");
	
	Buttons buttons;
	int framecounter = 0;
	
	//Title screen (under construction)
	while (true)
	{
		buttons.Update();
		
		if (buttons.StartJustPressed())
		{
			break;
		}
		
		WaitVSync();	
	}
	
	while (true)
	{
		//Load Custom spritesheet
		LoadPaletteObjData(0, spritesheet4Pal, sizeof spritesheet4Pal);
		LoadPaletteBGData(0, backgroundnewnewPal, sizeof backgroundnewnewPal);
		LoadTileData(4, 0, spritesheet4Tiles, sizeof spritesheet4Tiles);
		LoadTileData(0, 0, backgroundnewnewTiles, sizeof backgroundnewnewTiles);
		
		int levelnumber = 1;
		
		Level level(levelnumber);
		
		for (int screenblock = 21; screenblock < 31; screenblock++)
		{
			level.FillScreenblock(screenblock, 0);
		}
		
		level.DrawBackground(level.curdimension);
		
		bool gamerunning = true;
		
		//Main game loop
		while (gamerunning)
		{
			buttons.Update();
			
			gamerunning = level.CheckIfLevelComplete();
			level.TakeInput(buttons);
			level.MoveObjects();
			level.Draw();
			level.UpdateLevelObjects(framecounter);

			framecounter++;
			
			WaitVSync();
			FlipBuffers();
		}
		
		//Reload each tile in font_bold into it's corresponding position in charblock 0
		for (int i = 0; i < 128; i++)
		{
			LoadTile8(0, i, font_bold[i]);
		}
		
		SetPaletteBG(0, RGB(0, 0, 0)); // black
		SetPaletteBG(1, RGB(31, 31, 31)); // white		
		
		for (int screenblock = 25; screenblock < 31; screenblock++)
		{
			for (int y = 0; y < 32; y++)
			{
				for (int x = 0; x < 32; x++)
				{
					SetTile(screenblock, x, y, 0);
				}
			}
		}
		
		level.player.drawx = SCREEN_WIDTH;
		
		SetObject(level.player.GetObjNum(),
		  ATTR0_SHAPE(2) | ATTR0_8BPP | ATTR0_HIDE,
		  ATTR1_SIZE(2) | ATTR1_X(level.player.drawx),
		  ATTR2_ID8(0) | ATTR2_PRIO(2));
		
		UpdateObjects();
		
		DrawText(6, (SCREEN_HEIGHT / 16) - 2, "That's all folks!!");
		DrawText(3, (SCREEN_HEIGHT / 16), "Press start to try again");
		
		while (true)
		{
			buttons.Update();
			
			if (buttons.StartJustPressed())
			{
				break;
			}
			
			WaitVSync();
		}
	}
}
Ejemplo n.º 10
0
void AllegroDisp::Update()
{
	//Clear();
	FlipBuffers();
}
void UpdateDatabaseScreen(void)
{
	FlipBuffers();
}
Ejemplo n.º 12
0
int main()
{
	initializeGraphics();	

	MouseType mouseObject = IDLE;

	int cursorXLocation = 10;
	int cursorYLocation = 10;

	// These control building & unit logic
	GameEntity* buildingsContainer = NULL;
	GameEntity* unitsContainer = NULL;

	uint16_t population = 0;		// This controls population count
	uint16_t frame = 0;				// This counts frames
	uint16_t unitSpawnDelay = 0;			// This controls the delay between unit spawns

	while (true)
	{
		FlipBuffers();																				// Flip buffers
		
		ClearScreen8(SAND_COLOR);																	// Clear screen

		render(buildingsContainer,unitsContainer);													// Render all buildings and units

		animatePowerPlant(frame);																	// Animate the power plant
		animateBarracks(frame);																		// Animate the barracks

		if(mouseObject!=IDLE)																		// If there has been some mouse action ...
		{
			if(isMovement(mouseObject))																	// ... and it is movement ...
			{
				move(cursorXLocation,cursorYLocation,mouseObject);											// ... movet the mouse.
			}
			 
			else if(isPlacement(mouseObject))															// ... if it is placement ...
			{
				place(cursorXLocation,cursorYLocation,mouseObject,buildingsContainer);						// ... attempt placement.
			}

			else if(isSpawning(mouseObject) && unitSpawnDelay==0 && population!=POP_CAP)				// ... if it is a unit and it's not to soon after the last unit was trained and population cap has not been reached  ...
			{														
				spawn(unitsContainer,buildingsContainer);													// place the unit
				population++;																				// increase population

				unitSpawnDelay = UNIT_SPAWN_COOLDOWN_PERIOD;												// start cooldown timer
			}
		}

		drawCursor(cursorXLocation,cursorYLocation);												// Draw the cursor

		mouseObject = updatedMouseType();															// Update the mouse

		WaitVSync();																				// Sync

		frame = (frame == 100) ? 0 : frame+1;														//	Reset frame count every 100 frames, else increase by one

		if(unitSpawnDelay!=0)																		// If there is a cooldown timer in action ...
			unitSpawnDelay--;																			// ... update it!

	}
	
	// We are environmentaly concious, so we clean after ourselves
	delete buildingsContainer;					
	delete unitsContainer;

	return 0;
}
Ejemplo n.º 13
0
int main(int argc, char** argv)
{

	int dw = GetScreenWidth();
	int dh = GetScreenHeight();

	vec3 icp = {0.0F, 4.0F, 8.0F};
	vec3 icl = {0.0F, 0.0F, 0.0F};
	vec3 icu = {0.0F, 1.0F, 0.0F};
	g_globalCam.SetCamera(icp, icl, icu);
	g_globalCam.SetPerspective(65.0F, dw / (float)dh, 0.1F, 1000.0F);



	// Query extension base //
	CreateAppWindow("Mooball", dw, dh, 32, false);
	initExtensions();
	InitKeys();

	srand(time(NULL));

	// Query Device capabilities //
	if(!ValidateDevice())
	{
		DestroyAppWindow();
		return 0;
	}
	g_pTexInterface = new CTextureInterface;
	g_pShaderInterface = new CShaderInterface;
	g_lightManager = new CLightManager;
	g_bMSAA = (quickINI::Instance()->getValueAsInt("msaa") > 0) && (g_pTexInterface->GetMaxMSAA() > 0);
	g_bVSYNC = quickINI::Instance()->getValueAsInt("vsync") > 0;

//	g_model.Load( "Media/Models/Pokeball.3ds" );
	CModelObject* pMdl = new COBJModel;
	std::string err = pMdl->LoadModel("sponza.obj", "Media/Models/");

	// Initialize CG Runtime and shaders //
	init_cg();

	// Turn vsync on //
	if( EXT_VSYNC && g_bVSYNC )
	{
        #ifdef WIN32
            wglSwapIntervalEXT(1);
        #else
            glXSwapIntervalSGI(1);
        #endif
	}

	// Create offscreen targets and depth configurations //
	init_render_targets();

	// Added 8/4/10 - Keeps Mooball from hogging
	// the input focus while it's minimized.
//	HWND windowHandle = GetFocus();

	while(running)
	{
		if(QueryQuitMsg())
			running = false;

		else
		{
			if(!g_bDebugMode)
			{
				UpdateScene();
				PollKeys();
				PollMouse();
			}
			RenderScene();
			FlipBuffers();
		}

	}

	// Fall through to destruction //
	DestroyAppWindow();

	delete g_lightManager;
	delete g_pTexInterface;
	delete g_pShaderInterface;

	return 0;
}