// Manages Currently playing 2D cinematic
void cinematicRender() {
	
	arxtime.update(false);
	float now = arxtime.now_f();

	if(PLAY_LOADED_CINEMATIC == Cinematic_StartRequested) {
		LogDebug("really starting cinematic now");
		LastFrameTicks = now;
		PLAY_LOADED_CINEMATIC = Cinematic_Started;
	}

	PlayTrack(ControlCinematique);
	ControlCinematique->InitDeviceObjects();
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);

	ControlCinematique->Render(now - LastFrameTicks);

	// end the animation
	if(   !ControlCinematique->key
	   || GInput->isKeyPressedNowUnPressed(Keyboard::Key_Escape)
	) {
		ControlCinematique->projectload=false;
		StopSoundKeyFramer();
		ControlCinematique->OneTimeSceneReInit();
		ControlCinematique->DeleteDeviceObjects();
		arxtime.resume();
		PLAY_LOADED_CINEMATIC = Cinematic_Stopped;

		bool bWasBlocked = false;
		if(BLOCK_PLAYER_CONTROLS) {
			bWasBlocked = true;
		}

		// !! avant le cine end
		if(ACTIVECAM) {
			ACTIVECAM->orgTrans.pos = ePos;
		}

		if(bWasBlocked) {
			BLOCK_PLAYER_CONTROLS = true;
		}

		ARX_SPEECH_Reset();
		SendMsgToAllIO(SM_CINE_END, LAST_LAUNCHED_CINE);
	}

	LastFrameTicks = now;
}
Example #2
0
void ARX_Menu_Manage() {
	
	// looks for keys for each mode.
	switch(ARXmenu.currentmode) {
		case AMCM_OFF: {
			// Checks for ESC key
			if(GInput->isKeyPressedNowUnPressed(Keyboard::Key_Escape)) {
				if(cinematicBorder.isActive()) {
					// Disabling ESC capture while fading in or out.
					if(!FADEDIR) {
						if(SendMsgToAllIO(SM_KEY_PRESSED, "") != REFUSE) {
							REQUEST_SPEECH_SKIP=1;				
						}
					}
				} else {
					GRenderer->getSnapshot(savegame_thumbnail, 160, 100);

					arxtime.pause();

					ARX_MENU_Launch(true);
					bFadeInOut=false;	//fade out
					bFade=true;			//active le fade
					TRUE_PLAYER_MOUSELOOK_ON = false;

					ARX_PLAYER_PutPlayerInNormalStance();
				}
			}
			break;
		}
		case AMCM_NEWQUEST: {
			if(   GInput->isKeyPressedNowUnPressed(Keyboard::Key_Escape)
			   && !bFadeInOut // XS: Disabling ESC capture while fading in or out.
			) {
				ARX_SOUND_PlayMenu(SND_MENU_CLICK);
				ARXmenu.currentmode = AMCM_MAIN;
			}
			break;
		}
		case AMCM_MAIN: {
			if(   GInput->isKeyPressedNowUnPressed(Keyboard::Key_Escape)
			   && MENU_NoActiveWindow()
			   && !REFUSE_GAME_RETURN
			) {
				arxtime.resume();
				ARX_MENU_Clicked_QUIT();
			}
			break;
		}
		case AMCM_CREDITS: {
			if(   GInput->isKeyPressedNowUnPressed(Keyboard::Key_Escape)
			   || GInput->isKeyPressedNowUnPressed(Keyboard::Key_Spacebar)
			) {
				ARX_SOUND_PlayMenu(SND_MENU_CLICK);
				bFadeInOut = true;	//fade out
				bFade = true;			//active le fade
				iFadeAction = AMCM_MAIN;

				ARX_MENU_LaunchAmb(AMB_MENU);
			}
			break;
		}
		default:
			break;
	}
}
Example #3
0
// Sends ON GAME_READY msg to all IOs
void SendGameReadyMsg()
{
	LogDebug("SendGameReadyMsg");
	SendMsgToAllIO(SM_GAME_READY);
}
Example #4
0
void levelInit() {
	
	arx_assert(entities.player());
	
	LogDebug("Initializing level ...");
	
	ARX_PARTICLES_FirstInit();
	g_renderBatcher.reset();
	
	progressBarAdvance(2.f);
	LoadLevelScreen();
	
	g_particleManager.Clear();
	
	if(GMOD_RESET)
		ARX_GLOBALMODS_Reset();

	GMOD_RESET = true;
	
	STARTDRAG = Vec2s(0);
	DANAEMouse = Vec2s(0);
	
	PolyBoomClear();
	ARX_DAMAGES_Reset();
	ARX_MISSILES_ClearAll();
	spells.clearAll();
	ARX_SPELLS_ClearAllSymbolDraw();
	
	ARX_PARTICLES_ClearAll();
	ParticleSparkClear();
	
	if(LOAD_N_ERASE) {
		CleanScriptLoadedIO();
		RestoreInitialIOStatus();
		DRAGINTER = NULL;
	}
	
	ARX_SPELLS_ResetRecognition();
	
	eyeball.exist = 0;
	
	resetDynLights();
	
	if(LOAD_N_ERASE) {
		CleanInventory();
		ARX_SCRIPT_Timer_ClearAll();
		UnlinkAllLinkedObjects();
		ARX_SCRIPT_ResetAll(false);
	}
	
	SecondaryInventory = NULL;
	TSecondaryInventory = NULL;
	ARX_FOGS_Render();
	
	if(LOAD_N_ERASE) {
		
		if(!DONT_ERASE_PLAYER)
			ARX_PLAYER_InitPlayer();

		g_hudRoot.playerInterfaceFader.resetSlid();

		player.lifePool.current = player.lifePool.max;
		player.manaPool.current = player.manaPool.max;
		if(!DONT_ERASE_PLAYER) {
			ARX_PLAYER_MakeFreshHero();
		}
	}
	
	InitSnapShot(fs::getUserDir() / "snapshot");
	
	progressBarAdvance(4.f);
	LoadLevelScreen();

	if(player.torch) {
		player.torch_loop = ARX_SOUND_PlaySFX_loop(g_snd.TORCH_LOOP, NULL, 1.0F);
	}
	
	g_playerCamera.m_pos = g_moveto = player.pos;
	g_playerCamera.angle = player.angle;
	
	RestoreLastLoadedLightning(*ACTIVEBKG);

	progressBarAdvance();
	LoadLevelScreen();

	if(LOAD_N_ERASE) {
		SetEditMode();
		ARX_SOUND_MixerStop(ARX_SOUND_MixerGame);
		ARX_SCRIPT_ResetAll(true);
		EERIE_ANIMMANAGER_PurgeUnused();
	}

	progressBarAdvance();
	LoadLevelScreen();

	LOAD_N_ERASE = true;
	DONT_ERASE_PLAYER = false;

	progressBarAdvance();
	LoadLevelScreen();
	
	PrepareIOTreatZone(1);
	
	progressBarAdvance();
	LoadLevelScreen();
	
	if(DONT_WANT_PLAYER_INZONE) {
		player.inzone = NULL;
		DONT_WANT_PLAYER_INZONE = 0;
	}
	
	progressBarAdvance();
	LoadLevelScreen();

	player.desiredangle.setPitch(0.f);
	player.angle.setPitch(0.f);
	ARX_PLAYER_RectifyPosition();

	entities.player()->_npcdata->vvpos = -99999;
	
	SendMsgToAllIO(NULL, SM_GAME_READY);
	
	PLAYER_MOUSELOOK_ON = false;
	
	g_note.clear();
	
	EntityHandle t = entities.getById("seat_stool1_0012");
	if(ValidIONum(t)) {
		entities[t]->ioflags |= IO_FORCEDRAW;
	}
	
	ARX_NPC_RestoreCuts();
	
	ResetVVPos(entities.player());
	
	progressBarAdvance();
	LoadLevelScreen();
	LoadLevelScreen(-2);
	
	if(!CheckInPoly(player.pos) && LastValidPlayerPos.x != 0.f
	   && LastValidPlayerPos.y != 0.f && LastValidPlayerPos.z != 0.f) {
		player.pos = LastValidPlayerPos;
	}
	
	LastValidPlayerPos = player.pos;
	
	g_platformTime.updateFrame();
	
	g_gameTime.resume(GameTime::PauseInitial | GameTime::PauseMenu);
}