예제 #1
0
bool BladeRunnerEngine::loadSplash() {
	Image img(this);
	if (!img.open("SPLASH.IMG")) {
		return false;
	}

	img.copyToSurface(&_surfaceFront);

	blitToScreen(_surfaceFront);

	return true;
}
예제 #2
0
	void render()
	{
		// Only render exactly what we have to
		setScissorAndViewport();
		
		// Enable the test here
		gl::enable( GL_SCISSOR_TEST );
		mScratch->bindFramebuffer();
		
		gl::clear();
		
		// Render our scene to the fbo
		mContent->render();
		
		mScratch->unbindFramebuffer();
		gl::disable( GL_SCISSOR_TEST );
		// Disable the test
		
		// Blit the result to the screen,
		// May get rid of this if we're only
		// going to use one fbo
		blitToScreen();
	}
예제 #3
0
void BladeRunnerEngine::gameTick() {
	handleEvents();

	if (_gameIsRunning && _windowIsActive) {
		if (!_kia->isOpen() && !_sceneScript->isInsideScript() && !_aiScripts->isInsideScript()) {
			_settings->openNewScene();
		}

		// TODO: Autosave

		//probably not needed, this version of tick is just loading data from buffer
		//_audioMixer->tick();

		if (_kia->isOpen()) {
			_kia->tick();
			return;
		}

		if (_spinner->isOpen()) {
			_spinner->tick();
			_ambientSounds->tick();
			return;
		}

		if (_esper->isOpen()) {
			_esper->tick();
			return;
		}

		if (_vk->isOpen()) {
			_vk->tick();
			_ambientSounds->tick();
			return;
		}

		if (_elevator->isOpen()) {
			_elevator->tick();
			_ambientSounds->tick();
			return;
		}

		if (_scores->isOpen()) {
			_scores->tick();
			_ambientSounds->tick();
			return;
		}

		_actorDialogueQueue->tick();
		if (_scene->didPlayerWalkIn()) {
			_sceneScript->playerWalkedIn();
		}
		bool inDialogueMenu = _dialogueMenu->isVisible();
		if  (!inDialogueMenu) {
			for (int i = 0; i < (int)_gameInfo->getActorCount(); ++i) {
				_actors[i]->tickCombat();
			}
		}

		_policeMaze->tick();

		// TODO: Gun range announcements
		_zbuffer->clean();

		_ambientSounds->tick();

		bool backgroundChanged = false;
		int frame = _scene->advanceFrame();
		if (frame >= 0) {
			_sceneScript->sceneFrameAdvanced(frame);
			backgroundChanged = true;
		}
		(void)backgroundChanged;
		blit(_surfaceBack, _surfaceFront);

		_overlays->tick();

		if (!inDialogueMenu) {
			actorsUpdate();
		}

		if (_settings->getNewScene() == -1 || _sceneScript->isInsideScript() || _aiScripts->isInsideScript()) {
			_sliceRenderer->setView(_view);

			// Tick and draw all actors in current set
			int setId = _scene->getSetId();
			for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) {
				if (_actors[i]->getSetId() == setId) {
					Common::Rect screenRect;
					if (_actors[i]->tick(backgroundChanged, &screenRect)) {
						_zbuffer->mark(screenRect);
					}
				}
			}

			_items->tick();

			_itemPickup->tick();
			_itemPickup->draw();

			Common::Point p = getMousePos();

			if (_dialogueMenu->isVisible()) {
				_dialogueMenu->tick(p.x, p.y);
				_dialogueMenu->draw(_surfaceFront);
			}

			if (_debugger->_viewZBuffer) {
				_surfaceFront.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480);
			}

			_mouse->tick(p.x, p.y);
			_mouse->draw(_surfaceFront, p.x, p.y);

			// TODO: Process AUD

			if (_walkSoundId >= 0) {
				_audioPlayer->playAud(_gameInfo->getSfxTrack(_walkSoundId), _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0);
				_walkSoundId = -1;
			}

			if (_debugger->_viewSceneObjects) {
				_debugger->drawSceneObjects();
			}
			if (_debugger->_viewObstacles) {
				_obstacles->draw();
			}

			blitToScreen(_surfaceFront);
			_system->delayMillis(10);
		}
	}
}