Ejemplo n.º 1
0
void AGOSEngine::timerProc() {
	if (_videoLockOut & 0x80E9 || _videoLockOut & 2)
		return;

	_syncCount++;

	_videoLockOut |= 2;

	handleMouseMoved();

	if (!(_videoLockOut & 0x10)) {
		processVgaEvents();
		processVgaEvents();
		_cepeFlag = !_cepeFlag;
		if (!_cepeFlag)
			processVgaEvents();
	}

	if (_displayFlag) {
		displayScreen();
		_displayFlag = 0;
	}

	_videoLockOut &= ~2;
}
Ejemplo n.º 2
0
void CharacterGame::initialize()
{
    // Enable multi-touch (only affects devices that support multi-touch).
    setMultiTouch(true);

    // Display the gameplay splash screen for at least 1 second.
    displayScreen(this, &CharacterGame::drawSplash, NULL, 1000L);

    // Load the font.
    _font = Font::create("res/arial40.gpb");

    // Load scene.
    _scene = Scene::load("res/scene.scene");

    // Update the aspect ratio for our scene's camera to match the current device resolution.
    _scene->getActiveCamera()->setAspectRatio((float)getWidth() / (float)getHeight());

    // Initialize the physics character.
    initializeCharacter();

    // Initialize the gamepad.
    initializeGamepad();

    // Initialize scene.
    _scene->visit(this, &CharacterGame::initializeScene);
}
Ejemplo n.º 3
0
void MeshGame::initialize()
{
    // Display the gameplay splash screen for at least 1 second.
    displayScreen(this, &MeshGame::drawSplash, NULL, 1000L);

    // Load the font
    _font = Font::create("res/ui/arial.gpb");

    // Load the scene from file
    _scene = Scene::load("res/mesh.scene");

    // Get the duck node
	_modelNode = _scene->findNode("duck");

	_scene = Scene::load("res/room1.scene");

    // Find the light node
    Node* lightNode = _scene->findNode("directionalLight1");

    // Bind the light node's direction into duck's material.
    _modelNode->getModel()->getMaterial()->getParameter("u_directionalLightColor[0]")->setValue(lightNode->getLight()->getColor());
    _modelNode->getModel()->getMaterial()->getParameter("u_directionalLightDirection[0]")->bindValue(lightNode, &Node::getForwardVectorView);

    // Update the aspect ratio for our scene's camera to match the current device resolution
    _scene->getActiveCamera()->setAspectRatio(getAspectRatio());

    // Create the grid and add it to the scene.
    Model *model = createGridModel();
    _scene->addNode("grid")->setModel(model);
    model->release();
}
Ejemplo n.º 4
0
void AGOSEngine::haltAnimation() {
	if (_videoLockOut & 0x10)
		return;

	_videoLockOut |= 0x10;

	if (_displayFlag) {
		displayScreen();
		_displayFlag = 0;
	}
}
Ejemplo n.º 5
0
void AGOSEngine::restartAnimation() {
	if (!(_videoLockOut & 0x10))
		return;

	if (getGameType() != GType_PN) {
		_window4Flag = 2;
		setMoveRect(0, 0, 224, 127);
		displayScreen();
	}

	_videoLockOut &= ~0x10;
}
Ejemplo n.º 6
0
void AGOSEngine_Feeble::timerProc() {
	if (_videoLockOut & 0x80E9 || _videoLockOut & 2)
		return;

	_syncCount++;

	_videoLockOut |= 2;

	if (!(_videoLockOut & 0x10)) {
		_syncFlag2 = !_syncFlag2;
		if (!_syncFlag2) {
			processVgaEvents();
		} else {
			// Double speed on Oracle
			if (getGameType() == GType_FF && getBitFlag(99)) {
				processVgaEvents();
			} else if (_scrollCount == 0) {
				_videoLockOut &= ~2;
				return;
			}
		}

		if (getGameType() == GType_FF && _interactiveVideo) {
			// Controls Omni TV videos
			if (getBitFlag(42)) {
				stopInteractiveVideo();
			} else {
				_moviePlayer->nextFrame();
			}
		}

		animateSprites();
	}

	if (_displayFlag) {
		if (getGameType() == GType_FF && !(getFeatures() & GF_DEMO)) {
			if (!getBitFlag(78)) {
				oracleLogo();
			}
			if (getBitFlag(76)) {
				swapCharacterLogo();
			}
		}
		handleMouseMoved();
		displayScreen();
		_displayFlag = 0;
	}

	_videoLockOut &= ~2;
}
Ejemplo n.º 7
0
void SpaceshipGame::initialize()
{
    // TODO: Not working on iOS
    // Display the gameplay splash screen for at least 1 second.
    displayScreen(this, &SpaceshipGame::drawSplash, NULL, 1000L);

    // Create our render state block that will be reused across all materials
    _stateBlock = RenderState::StateBlock::create();
    _stateBlock->setDepthTest(true);
    _stateBlock->setCullFace(true);
    _stateBlock->setBlend(true);
    _stateBlock->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
    _stateBlock->setBlendDst(RenderState::BLEND_ONE_MINUS_SRC_ALPHA);

    // Load our scene from file
    Bundle* bundle = Bundle::create("res/spaceship.gpb");
    _scene = bundle->loadScene();
    SAFE_RELEASE(bundle);

    // Update the aspect ratio for our scene's camera to match the current device resolution
    _scene->getActiveCamera()->setAspectRatio((float)getWidth() / (float)getHeight());

    // Initialize scene data
    initializeSpaceship();
    initializeEnvironment();

    // Create a background audio track
    _backgroundSound = AudioSource::create("res/background.ogg");
    if (_backgroundSound)
        _backgroundSound->setLooped(true);
    
    // Create font
    _font = Font::create("res/airstrip28.gpb");

    // Store camera node
    _cameraNode = _scene->findNode("camera1");

    // Store initial ship and camera positions
    _initialShipPos = _shipGroupNode->getTranslation();
    _initialShipRot = _shipGroupNode->getRotation();
    _initialCameraPos = _cameraNode->getTranslation();
}
Ejemplo n.º 8
0
void AGOSEngine_PN::timerProc() {
	if (_videoLockOut & 0x80E9 || _videoLockOut & 2)
		return;

	_syncCount++;

	_videoLockOut |= 2;

	_sound->handleSoundQueue();
	handleMouseMoved();
	handleKeyboard();

	if (!(_videoLockOut & 0x10)) {
		if (_sampleWait) {
			_vgaCurSpriteId = 0xFFFF;
			vc15_sync();
			_sampleWait = false;
		}
		if (_sampleEnd) {
			_vgaCurSpriteId = 0xFFFE;
			vc15_sync();
			_sampleEnd = false;
		}

		processVgaEvents();
		processVgaEvents();
		_cepeFlag = !_cepeFlag;
		if (!_cepeFlag)
			processVgaEvents();
	}

	if (_displayFlag) {
		displayScreen();
		_displayFlag = 0;
	}

	_videoLockOut &= ~2;
}
Ejemplo n.º 9
0
void AGOSEngine::displayBoxStars() {
	HitArea *ha, *dha;
	uint count;
	uint y_, x_;
	byte *dst;
	uint color;

	o_haltAnimation();

	if (getGameType() == GType_SIMON2)
		color = 236;
	else
		color = 225;

	uint curHeight = (getGameType() == GType_SIMON2) ? _boxStarHeight : 134;


	for (int i = 0; i < 5; i++) {
		ha = _hitAreas;
		count = ARRAYSIZE(_hitAreas);

		Graphics::Surface *screen = _system->lockScreen();

		do {
			if (ha->id != 0 && ha->flags & kBFBoxInUse && !(ha->flags & kBFBoxDead)) {

				dha = _hitAreas;
				if (ha->flags & kBFTextBox) {
					while (dha != ha && dha->flags != ha->flags)
						++dha;
					if (dha != ha && dha->flags == ha->flags)
						continue;
				} else {
					dha = _hitAreas;
					while (dha != ha && dha->itemPtr != ha->itemPtr)
						++dha;
					if (dha != ha && dha->itemPtr == ha->itemPtr)
						continue;
				}

				if (ha->y >= curHeight)
					continue;

				y_ = (ha->height / 2) - 4 + ha->y;

				x_ = (ha->width / 2) - 4 + ha->x - (_scrollX * 8);

				if (x_ >= 311)
					continue;

				dst = (byte *)screen->pixels;

				dst += (((screen->pitch / 4) * y_) * 4) + x_;

				dst[4] = color;
				dst += screen->pitch;
				dst[1] = color;
				dst[4] = color;
				dst[7] = color;
				dst += screen->pitch;
				dst[2] = color;
				dst[4] = color;
				dst[6] = color;
				dst += screen->pitch;
				dst[3] = color;
				dst[5] = color;
				dst += screen->pitch;
				dst[0] = color;
				dst[1] = color;
				dst[2] = color;
				dst[6] = color;
				dst[7] = color;
				dst[8] = color;
				dst += screen->pitch;
				dst[3] = color;
				dst[5] = color;
				dst += screen->pitch;
				dst[2] = color;
				dst[4] = color;
				dst[6] = color;
				dst += screen->pitch;
				dst[1] = color;
				dst[4] = color;
				dst[7] = color;
				dst += screen->pitch;
				dst[4] = color;
			}
		} while (ha++, --count);

		_system->unlockScreen();

		delay(100);

		setMoveRect(0, 0, 320, curHeight);
		_window4Flag = 2;

		displayScreen();
		delay(100);
	}

	o_restartAnimation();
}
Ejemplo n.º 10
0
void ParticlesGame::initialize()
{
    // Display the gameplay splash screen
    displayScreen(this, &ParticlesGame::drawSplash, NULL, 250L);

    setMultiTouch(true);

    // Set keyboard state.
    _wDown = _aDown = _sDown = _dDown = false;
    _touched = false;
    _prevX = _prevY = 0;

    // Create a scene with a camera node.
    // The camera node is a child of a node at the same location as the particle emitter.
    // The camera node is offset from its parent, looking straight at it.
    // That way, when we rotate the parent node, the camera stays aimed at the particle emitter.
    _scene = Scene::create();
    Node* cameraNode = _scene->addNode("Camera");
    _cameraParent = _scene->addNode("CameraParent");
    _cameraParent->addChild(cameraNode);
    Camera* camera = Camera::createPerspective(45.0f, (float)getWidth() / (float)getHeight(), 0.25f, 1000.0f);
    cameraNode->setCamera(camera);
    cameraNode->setTranslation(0.0f, 0.0f, ZOOM_DEFAULT);
    _scene->setActiveCamera(camera);
    SAFE_RELEASE(camera);

    addGrid(61);

    // Create a font for drawing the framerate.
    _font = Font::create("res/ui/arial.gpb");

    // Load the form for editing ParticleEmitters.
    _form = Form::create("res/editor.form");
    _form->setConsumeInputEvents(false);
    //_form->setState(Control::FOCUS);

    // Store pointers to UI controls we care about.
    _startRed = (Slider*)_form->getControl("startRed");
    _startGreen = (Slider*)_form->getControl("startGreen");
    _startBlue = (Slider*)_form->getControl("startBlue");
    _startAlpha = (Slider*)_form->getControl("startAlpha");
    _endRed = (Slider*)_form->getControl("endRed");
    _endGreen = (Slider*)_form->getControl("endGreen");
    _endBlue = (Slider*)_form->getControl("endBlue");
    _endAlpha = (Slider*)_form->getControl("endAlpha");
    _particleProperties = (Container*)_form->getControl("particleProperties");
    _startMin = (Slider*)_form->getControl("startMin");
    _startMax = (Slider*)_form->getControl("startMax");
    _endMin = (Slider*)_form->getControl("endMin");
    _endMax = (Slider*)_form->getControl("endMax");
    _energyMin = (Slider*)_form->getControl("energyMin");
    _energyMax = (Slider*)_form->getControl("energyMax");
    _emissionRate = (Slider*)_form->getControl("emissionRate");
    _started = (CheckBox*)_form->getControl("started");
    _reset = (Button*)_form->getControl("reset");
    _emit = (Button*)_form->getControl("emit");
    _zoomIn = (Button*)_form->getControl("zoomIn");
    _zoomOut = (Button*)_form->getControl("zoomOut");
    _save = (Button*)_form->getControl("save");
    _load = (Button*)_form->getControl("load");
    _burstSize = (Slider*)_form->getControl("burstSize");
    _posVarX = (Slider*)_form->getControl("posVarX");
    _posVarY = (Slider*)_form->getControl("posVarY");
    _posVarZ = (Slider*)_form->getControl("posVarZ");
    _velX = (Slider*)_form->getControl("velocityX");
    _velY = (Slider*)_form->getControl("velocityY");
    _velZ = (Slider*)_form->getControl("velocityZ");
    _velVarX = (Slider*)_form->getControl("velocityVarX");
    _velVarY = (Slider*)_form->getControl("velocityVarY");
    _velVarZ = (Slider*)_form->getControl("velocityVarZ");
    _accelX = (Slider*)_form->getControl("accelX");
    _accelY = (Slider*)_form->getControl("accelY");
    _accelZ = (Slider*)_form->getControl("accelZ");
    _accelVarX = (Slider*)_form->getControl("accelVarX");
    _accelVarY = (Slider*)_form->getControl("accelVarY");
    _accelVarZ = (Slider*)_form->getControl("accelVarZ");
    _spinSpeedMin = (Slider*)_form->getControl("spinSpeedMin");
    _spinSpeedMax = (Slider*)_form->getControl("spinSpeedMax");
    _axisX = (Slider*)_form->getControl("axisX");
    _axisY = (Slider*)_form->getControl("axisY");
    _axisZ = (Slider*)_form->getControl("axisZ");
    _axisVarX = (Slider*)_form->getControl("axisVarX");
    _axisVarY = (Slider*)_form->getControl("axisVarY");
    _axisVarZ = (Slider*)_form->getControl("axisVarZ");
    _rotationSpeedMin = (Slider*)_form->getControl("rotationSpeedMin");
    _rotationSpeedMax = (Slider*)_form->getControl("rotationSpeedMax");
    _vsync = (CheckBox*)_form->getControl("vsync");

    // Listen for UI events.
    _startRed->addListener(this, Listener::VALUE_CHANGED);
    _startGreen->addListener(this, Listener::VALUE_CHANGED);
    _startBlue->addListener(this, Listener::VALUE_CHANGED);
    _startAlpha->addListener(this, Listener::VALUE_CHANGED);
    _endRed->addListener(this, Listener::VALUE_CHANGED);
    _endGreen->addListener(this, Listener::VALUE_CHANGED);
    _endBlue->addListener(this, Listener::VALUE_CHANGED);
    _endAlpha->addListener(this, Listener::VALUE_CHANGED);
    _startMin->addListener(this, Listener::VALUE_CHANGED);
    _startMax->addListener(this, Listener::VALUE_CHANGED);
    _endMin->addListener(this, Listener::VALUE_CHANGED);
    _endMax->addListener(this, Listener::VALUE_CHANGED);
    _energyMin->addListener(this, Listener::VALUE_CHANGED);
    _energyMax->addListener(this, Listener::VALUE_CHANGED);
    _emissionRate->addListener(this, Listener::VALUE_CHANGED);
    _started->addListener(this, Listener::VALUE_CHANGED);
    _reset->addListener(this, Listener::CLICK);
    _emit->addListener(this, Listener::CLICK);
    _zoomIn->addListener(this, Listener::PRESS);
    _zoomIn->addListener(this, Listener::RELEASE);
    _zoomOut->addListener(this, Listener::PRESS);
    _zoomOut->addListener(this, Listener::RELEASE);
    _save->addListener(this, Listener::RELEASE);
    _load->addListener(this, Listener::RELEASE);
    _burstSize->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("posX")->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("posY")->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("posZ")->addListener(this, Listener::VALUE_CHANGED);
    _posVarX->addListener(this, Listener::VALUE_CHANGED);
    _posVarY->addListener(this, Listener::VALUE_CHANGED);
    _posVarZ->addListener(this, Listener::VALUE_CHANGED);
    _velX->addListener(this, Listener::VALUE_CHANGED);
    _velY->addListener(this, Listener::VALUE_CHANGED);
    _velZ->addListener(this, Listener::VALUE_CHANGED);
    _velVarX->addListener(this, Listener::VALUE_CHANGED);
    _velVarY->addListener(this, Listener::VALUE_CHANGED);
    _velVarZ->addListener(this, Listener::VALUE_CHANGED);
    _accelX->addListener(this, Listener::VALUE_CHANGED);
    _accelY->addListener(this, Listener::VALUE_CHANGED);
    _accelZ->addListener(this, Listener::VALUE_CHANGED);
    _accelVarX->addListener(this, Listener::VALUE_CHANGED);
    _accelVarY->addListener(this, Listener::VALUE_CHANGED);
    _accelVarZ->addListener(this, Listener::VALUE_CHANGED);
    _spinSpeedMin->addListener(this, Listener::VALUE_CHANGED);
    _spinSpeedMax->addListener(this, Listener::VALUE_CHANGED);
    _axisX->addListener(this, Listener::VALUE_CHANGED);
    _axisY->addListener(this, Listener::VALUE_CHANGED);
    _axisZ->addListener(this, Listener::VALUE_CHANGED);
    _axisVarX->addListener(this, Listener::VALUE_CHANGED);
    _axisVarY->addListener(this, Listener::VALUE_CHANGED);
    _axisVarZ->addListener(this, Listener::VALUE_CHANGED);
    _rotationSpeedMin->addListener(this, Listener::VALUE_CHANGED);
    _rotationSpeedMax->addListener(this, Listener::VALUE_CHANGED);
    _vsync->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("sprite")->addListener(this, Listener::CLICK);
    _form->getControl("additive")->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("transparent")->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("multiply")->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("opaque")->addListener(this, Listener::VALUE_CHANGED);
    _form->getControl("updateFrames")->addListener(this, Listener::CLICK);

    // Load preset emitters.
    loadEmitters();

    updateImageControl();
}