bool eae6320::Graphics::Initialize( const HWND i_renderingWindow )
{
	if (!Context::Initialize(i_renderingWindow))
		goto OnError;

	s_FrameRate.Create(eae6320::Time::GetFrameRate(), "Frame Rate");
	s_PlayerScore.Create(teamScore, "Score");
	s_EnemyScore.Create(enemyScore, "Score");
	eae6320::Graphics::DebugMenu::CreateDebugMenuFont();

	m_StaminaSprite.CreateTexture("data/Stamina.material", 0.9f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f);

	// Create the renderables
	if (!CreateRenderables())
		goto OnError;

	if (!CreateCamera())
		goto OnError;

	return true;

OnError:

	ShutDown();
	return false;
}
Exemple #2
0
Share<Camera> CameraFactory::CreateFromModel(StringRef name, StringRef modelName, const Size2F& winSize, bool isResizeable /*= true*/, ResourceShareType shareType /*= ResourceShareType::Share*/)
{
	Share<Camera> camera;
	if (shareType != ResourceShareType::None)
	{
		camera = Find(name);
		RETURN_SELF_IF_NOT_NULL(camera);
	}

	if (camera == nullptr)
	{
		auto model = ModelFactory::Instance().Create(modelName).CastPtr<BaseSceneModel>();
		if (model != nullptr)
		{
			camera = model->CreateCamera(name, winSize);
			Add(camera, shareType);
			if (isResizeable)
			{
				mResizeableCameras.Add(camera);
			}
		}
	}


	return camera;
}
//----------------------------------------------------------------------------
PerformanceAMDWindow::PerformanceAMDWindow(Parameters& parameters)
    :
    Window(parameters),
    mTextColor({ 0.0f, 0.0f, 0.0f, 1.0f }),
    mPerformance(mEngine->GetDevice())
{
    if (!SetEnvironment())
    {
        parameters.created = false;
        return;
    }

    CreateCamera();
    CreateTextureGenerator();
    CreateScene();

    // Disable back-face culling.
    mNoCullingState.reset(new RasterizerState());
    mNoCullingState->cullMode = RasterizerState::CULL_NONE;
    mEngine->SetRasterizerState(mNoCullingState);

    mPerformance.SaveCounterInformation("AMD7970Counters.txt");
    mPerformance.Register(Listener);
    mPerformance.SetAllCounters();

    UpdateCW();
}
Exemple #4
0
int CreateCameras (void)
{
	int		h, i, j, k, r;
	ubyte		t;
	tWall		*wallP;
	tObject	*objP;
	tTrigger	*triggerP;

if (!gameStates.app.bD2XLevel)
	return 0;
PrintLog ("   creating cameras\n");
memset (gameData.cameras.nSides, 0xFF, MAX_SEGMENTS * 6 * sizeof (*gameData.cameras.nSides));
for (i = 0, wallP = gameData.walls.walls; i < gameData.walls.nWalls; i++, wallP++) {
	t = wallP->nTrigger;
	if (t >= gameData.trigs.nTriggers)
		continue;
	triggerP = gameData.trigs.triggers + t;
	if (triggerP->nType == TT_CAMERA) {
		for (j = 0; j < triggerP->nLinks; j++)
			if (CreateCamera (gameData.cameras.cameras + gameData.cameras.nCameras, (short) wallP->nSegment, (short) wallP->nSide, triggerP->nSegment [j], triggerP->nSide [j], NULL, 0, 0))
				gameData.cameras.nSides [triggerP->nSegment [j] * 6 + triggerP->nSide [j]] = (char) gameData.cameras.nCameras++;
		}
#if TELEPORT_CAMERAS
	else if (/*EGI_FLAG (bTeleporterCams, 0, 0) &&*/ (triggerP->nType == TT_TELEPORT)) {
		if (CreateCamera (gameData.cameras.cameras + gameData.cameras.nCameras, triggerP->nSegment [0], triggerP->nSide [0], (short) wallP->nSegment, (short) wallP->nSide, NULL, 0, 1))
			gameData.cameras.nSides [wallP->nSegment * 6 + wallP->nSide] = (char) gameData.cameras.nCameras++;
		}
#endif
	}
FORALL_OBJS (objP, i) {
	r = j = gameData.trigs.firstObjTrigger [OBJ_IDX (objP)];
#if DBG
	if (j >= 0)
		j = j;
#endif
	for (h = sizeofa (gameData.trigs.objTriggerRefs); (j >= 0) && h; h--) {
		triggerP = gameData.trigs.objTriggers + j;
		if (triggerP->nType == TT_CAMERA) {
			for (k = 0; k < triggerP->nLinks; k++)
				if (CreateCamera (gameData.cameras.cameras + gameData.cameras.nCameras, -1, -1, triggerP->nSegment [k], triggerP->nSide [k], objP, 0, 0))
					gameData.cameras.nSides [triggerP->nSegment [k] * 6 + triggerP->nSide [k]] = (char) gameData.cameras.nCameras++;
			}
		if (r == (j = gameData.trigs.objTriggerRefs [j].next))
			break;
		}
	}
void CameraApplication::Update(float frameTime)
{
    Entity* cameraEntity = framework->Renderer()->MainCamera();
    if (cameraEntity)
        MoveCamera(cameraEntity, frameTime);
    else if (!cameraEntity && lastScene_)
        CreateCamera();
}
Exemple #6
0
GameEngine::GameEngine( ) 
: _renderer(DxlibRendererPtr(new DxlibRenderer))
, _input(DxlibInputPtr(new DxlibInput)) 
, _process(DxlibProcessPtr(new DxlibProcess))
,_gameTime(DxlibGameTimePtr(new DxlibGameTime)){
	// create main camera
	CreateCamera();
}
Exemple #7
0
WOGLevel* OGLevelConfig::Parser()
{
    WOGLevel* level = new WOGLevel;

    level->ballsrequired = rootElement.attribute("ballsrequired").toInt();
    level->letterboxed = StringToBool(rootElement.attribute("letterboxed"));
    level->visualdebug = StringToBool(rootElement.attribute("visualdebug"));
    level->autobounds = StringToBool(rootElement.attribute("autobounds"));
    level->textcolor = StringToColor(rootElement.attribute("textcolor"));
    level->texteffects = StringToBool(rootElement.attribute("texteffects"));
    level->timebugprobability =
        rootElement.attribute("timebugprobability").toDouble();

    level->strandgeom = StringToBool(rootElement.attribute("strandgeom"));
    level->allowskip = StringToBool(rootElement.attribute("allowskip"));

    QDomNode node = rootElement.firstChild();

    while (!node.isNull())
    {
        QDomElement domElement = node.toElement();

        if (domElement.tagName() == "camera")
        {
            level->camera << CreateCamera(domElement);
        }
        else if (domElement.tagName() == "music")
        {
            level->music.id = domElement.attribute("music");
        }
        else if (domElement.tagName() == "BallInstance")
        {
            level->ball << CreateBallInstance(domElement);
        }
        else if (domElement.tagName() == "levelexit")
        {
            if (!level->levelexit)
            {
                level->levelexit = CreateLevelExit(domElement);
            }
        }
        else if (domElement.tagName() == "pipe")
        {
            if (!level->pipe)
            {
                level->pipe = CreatePipe(domElement);
            }
        }
        else if (domElement.tagName() == "Strand")
        {
            level->strand << CreateStrand(domElement);
        }

        node = node.nextSibling();
    }

    return level;
}
Exemple #8
0
ApplicationFail App::Init() {
    //Init GLFW
    if(glfwInit() == false) {
        return ApplicationFail::GLFW_INIT;
    }

    //Generate Window
    CreateGLWindow();

    //
    if(ogl_LoadFunctions() == ogl_LOAD_FAILED) {
        glfwDestroyWindow(window);
        glfwTerminate();
        return ApplicationFail::OGL_LOAD_FUNCATIONS;
    }

    //Load Gizmos
    Gizmos::create();

    //Camera
    CreateCamera();

    // Load Model File
    model = LoadFBX("./rsc/models/soulspear/soulspear.fbx");
    renderOBJ = CreateRenderObject(model);

    //FrameBuffer
    //CreateFrameBuffer();
    //CreatePlane();
    //CreatePlaneShader();

    //Quad - Post Process Init
    CreateQuad();
    CreateQuadShader();
    CreateQuadBuffer();

    //Load + Bind Texture File
    LoadTexture();

    //Set Clear Screen
    glClearColor(0.25f, 0.25f, 0.25f, 1);
    glEnable(GL_DEPTH_TEST); // enables the depth buffer

    //Texture Shader
    CreateShaderProgram();




    //Time

    return ApplicationFail::NONE;
}
Exemple #9
0
// initialize initializes the general display design coordinator, creates the 
// primitive sets, textures, objects, lights, sounds, cameras, and text items
//
void Design::initialize() {

       // general display design
    //
   Reflectivity redish = Reflectivity(red);
   Reflectivity greenish = Reflectivity(green);
   Reflectivity bluish = Reflectivity(blue);
   Reflectivity whitish = Reflectivity(white);
   setProjection(0.9f, 1.0f, 1000.0f);
   setAmbientLight(1, 1, 1);
   // camera at a distance - in lhs coordinates
    // camera at a distance - in lhs coordinates
   iCamera* camera = CreateCamera();
   camera->translate(0, 190,-500);
   camera->setRadius(17.8f);
   
    lastUpdate = now;	

    hud = CreateHUD(0.72f, 0.01f, 0.27f, 0.99f, CreateTexture(HUD_IMAGE));
    // cameras ----------------------------------------------------------------

   velocitytxt_=CreateText(Rectf(0.05f,0.27f,0.95f,0.37f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);
   deltatxt_=CreateText(Rectf(0.05f,0.17f,0.95f,0.27f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);
   positiontxt_=CreateText(Rectf(0.05f,0.38f,0.95f,0.48f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);

   lasttextupdate=now;

   // game ----------------------------------------------------------------------
   setBackground(CreateTexture(L"farm.png"));
   catcher = CreatePhysicsBox(-40, -5, 0, 40, 5, 0, &bluish, 1, PHYS_Floating, true);
   iAPIWindow* win = getWindow();
   catcher->translate(0, -70, 0);

   truck = CreatePhysicsBox(-100, -2, 0, 100, 2, 0, &redish, 1, PHYS_Floating, true);
   truck->translate(300, -50, 0);

   Reflectivity yellowish = Reflectivity(yellow);

   iPhysics* fallingBox = CreatePhysicsBox(-10, -10, -10, 10, 10, 10, &yellowish, 1, PHYS_Falling, true);
   fallingBox->translate(-350, 350, 0);
   fallingBox->setVelocity(Vector(5, 20, 0));
   fallingBox->addBodyForce(Vector(0, -10, 0));
   fallingBox->setCollision(CreateCSphere(fallingBox, 5));
   objects.insert(objects.end(), fallingBox);

   wchar_t str[MAX_DESC + 1];
   StringCbPrintfW(str, MAX_DESC, L"Score: 0");
   velocitytxt_->set(str);

   StringCbPrintfW(str, MAX_DESC, L"Life left: 5"); 
   deltatxt_->set(str);
}
Exemple #10
0
   //---------------------------------------------------------------------------
   void Scene::CreateScene(Scene::Type eType)
   {
      _parentContext = dynamic_cast<Context*>(_pParent);
      _eType = eType;

      if (_parentContext)
      {
         _parentContext->SetScene(this);
      }

      if (!_pActiveCamera)
         CreateCamera();
   }
void BaseScene::Init(Ogre::Root* root, Ogre::String sceneName)
{
	mRoot = root;
	mSceneName = sceneName;
	mMouse = GameApplication::GetSingletonPtr()->GetMouse();
	mKeyboard = GameApplication::GetSingletonPtr()->GetKeyboard();

	if(Ogre::ResourceGroupManager::getSingleton().resourceGroupExists(mSceneName))
	{
		Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(mSceneName);
	}

	CreateSceneManager();
	CreateCamera();
}
Exemple #12
0
int RenderShadowMap (tDynLight *pLight)
{
	tCamera	*pc;

if (pLight->shadow.nFrame == gameData.render.shadows.nFrame)
	return 0;
if (gameData.render.shadows.nShadowMaps == MAX_SHADOW_MAPS)
	return 0;
pLight->shadow.nFrame = !pLight->shadow.nFrame;
gameStates.render.nShadowPass = 2;
pc = gameData.render.shadows.shadowMaps + gameData.render.shadows.nShadowMaps++;
CreateCamera (pc, pLight->info.nSegment, pLight->info.nSide, pLight->info.nSegment, pLight->info.nSide, NULL, 1, 0);
RenderCamera (pc);
gameStates.render.nShadowPass = 2;
return 1;
}
//----------------------------------------------------------------------------
PerformanceAMDWindow::PerformanceAMDWindow(Parameters& parameters)
    :
    Window(parameters),
    mTextColor(0.0f, 0.0f, 0.0f, 1.0f),
    mPerformance(mEngine->GetDevice())
{
    std::string gtpath = mEnvironment.GetVariable("GTE_PATH");
    if (gtpath == "")
    {
        LogError("You must create the environment variable GTE_PATH.");
        parameters.created = false;
        return;
    }
    mEnvironment.Insert(gtpath + "/Samples/Basics/PerformanceAMD/Shaders/");
    mEnvironment.Insert(gtpath + "/Samples/#Data/");
    if (mEnvironment.GetPath("GenerateTexture.hlsl") == "")
    {
        LogError("Cannot find file GenerateTexture.hlsl.");
        parameters.created = false;
        return;
    }
    if (mEnvironment.GetPath("MedicineBag.jpg") == "")
    {
        LogError("Cannot find file MedicineBag.jpg.");
        parameters.created = false;
        return;
    }

    CreateCamera();
    CreateTextureGenerator();
    CreateScene();

    // Disable back-face culling.
    mNoCullingState.reset(new RasterizerState());
    mNoCullingState->cullMode = RasterizerState::CULL_NONE;
    mEngine->SetRasterizerState(mNoCullingState);

    mPerformance.SaveCounterInformation("AMD7970Counters.txt");
    mPerformance.Register(Listener);
    mPerformance.SetAllCounters();
}
Exemple #14
0
HRESULT CEditorScene::Init()
{
	if(FAILED(CScene::Init()))
	{
		return E_FAIL;
	}

	if(FAILED(CreateEntity()))
	{
		return E_FAIL;
	}

	if(FAILED(CreateCamera()))
	{
		return E_FAIL;
	}

	if(FAILED(CreateLight()))
	{
		return E_FAIL;
	}
	return S_OK;
}
TEST_F(CameraModuleTest, LoadModule) {

    TEST_EXTENSION_FORKING_INIT;

    status_t stat;
    for (int i = 0; i < mNumberOfCameras; ++i) {
        if (isDeviceVersionHal2(i, &stat) && stat == OK) {
            CreateCamera(i, &mDevice);
            ASSERT_EQ(OK, initializeDevice(i))
                << "Failed to initialize device " << i;
            mDevice.clear();
        } else {
            const ::testing::TestInfo* const test_info =
                ::testing::UnitTest::GetInstance()->current_test_info();
            std::cerr << "Skipping test "
                      << test_info->test_case_name() << "."
                      << test_info->name()
                      << " because HAL device version is V1"
                      << std::endl;
        }
    }

}
Exemple #16
0
// initialize initializes the general display design coordinator, creates the 
// primitive sets, textures, objects, lights, sounds, cameras, and text items
//
void Design::initialize() {

    // general parameters
    //
	Reflectivity redish = Reflectivity(red);
	Reflectivity greenish = Reflectivity(green);
	Reflectivity bluish = Reflectivity(blue);
	Reflectivity whitish = Reflectivity(white);
	iGraphic* box;
    setProjection(0.9f, 1.0f, 1000.0f);
    setAmbientLight(0.9f, 0.9f, 0.9f);

    iCamera* camera = CreateCamera();
    camera->translate(0,150,0);
    camera->setRadius(17.8f);
	camera->rotatex(3.1459/2.0f);



    int i=0;
    for(i=0;i<map_.numvert();i++){
		 box   = CreateBox(-3, -3, -3 * MODEL_Z_AXIS,  3, 3, 3 * MODEL_Z_AXIS);
		CreateObject(box,&redish)->translate(map_.vx(i),map_.vy(i),map_.vz(i));
    }
    for(int j=0;j<map_.numvert();j++){
      LList<EdgeInfo>& edgelist=map_.edges(j);
      Node<EdgeInfo>* curr;
      while(curr=edgelist.curr()){
        int from=curr->data().from();
        int to=curr->data().to();
        if(from < to){
          Vector frompos=map_.pos(from);
          Vector topos=map_.pos(to);
		  float speed= curr->data().speed();
		  iGraphic* path=CreatePath(frompos.x,frompos.y,frompos.z,topos.x,topos.y,topos.z);
		  Reflectivity* pathcolour=(speed<FAST)?((speed<MEDIUM)?&redish:&bluish):&greenish;
		  CreateObject(path,pathcolour);
          #if DEBUG==1
          fprintf(debugfile,"from/to: %d %d\n",from,to);          
          fprintf(debugfile,"frompos %f %f %f\n",frompos.x,frompos.y,frompos.z);
          fprintf(debugfile,"topos %f %f %f\n",topos.x,topos.y,topos.z);
          fprintf(debugfile,"v %f %f %f\n",v.x,v.y,v.z);
          fprintf(debugfile,"edglen= %f\n",edgelen);
          #endif
		  i++;
        }
        edgelist.gonext();
      }
    }
	bucket_=CreatePhysicsBox(-2,-2,-2,2,2,2,&bluish,1,PHYS_FixedInSpace);
    whichbox_=0;
    Vector boxloc=map_.pos(whichbox_);
    bucket_->translate(boxloc.x,boxloc.y+4,boxloc.z);
	box = CreateBox(-3.1, -3.1, -3.1 * MODEL_Z_AXIS,  3.1, 3.1, 3.1 * MODEL_Z_AXIS);
	(highlighter_ = CreateObject(box,&greenish))->translate(map_.vx(0),map_.vy(0),map_.vz(0));
	selectloc_=0;
	lastFireTime_=0;
	ismoving_=false;
	searchroutine_=GREEDY;


	hud = CreateHUD(0.72f, 0.01f, 0.27f, 0.99f, CreateTexture(HUD_IMAGE));


	velocitytxt_=CreateText(Rectf(0.05f,0.27f,0.95f,0.37f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);
	deltatxt_=CreateText(Rectf(0.05f,0.17f,0.95f,0.27f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);
	positiontxt_=CreateText(Rectf(0.05f,0.38f,0.95f,0.48f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);


	lasttextupdate=now;
	
}
Exemple #17
0
int start_video_recorder(Video_Recorder* recorder)
{
	// init base config param
	recorder->base_cfg.codectype = VENC_CODEC_H264;

	recorder->base_cfg.framerate = CAP_FPS;
	recorder->base_cfg.input_width = recorder->width;
	recorder->base_cfg.input_height = recorder->height;
	recorder->base_cfg.dst_width = recorder->width;
	recorder->base_cfg.dst_height = recorder->height;
	recorder->base_cfg.maxKeyInterval = H264_IDR;
	recorder->base_cfg.inputformat = VENC_PIXEL_YUV420; //uv combined
	recorder->base_cfg.targetbitrate = H264_TB;

	// init allocate param
	recorder->alloc_parm.buffernum = 4;

	cedarx_hardware_init(0);
	CLOG("%s", "cedarx_hardware_init");
	CLOG("AWCodec version %s", getCodecVision());

	recorder->waterMark = malloc(sizeof(WaterMark));
	memset(recorder->waterMark, 0x0, sizeof(WaterMark));
	waterMark_init(recorder->waterMark);

	recorder->venc_device = cedarvEncInit();

	recorder->venc_device->ioctrl(recorder->venc_device, VENC_CMD_BASE_CONFIG, &recorder->base_cfg);
	recorder->venc_device->ioctrl(recorder->venc_device, VENC_CMD_ALLOCATE_INPUT_BUFFER, &recorder->alloc_parm);
	recorder->venc_device->ioctrl(recorder->venc_device, VENC_CMD_OPEN, 0);
	recorder->venc_device->ioctrl(recorder->venc_device, VENC_CMD_HEADER_DATA, &recorder->header_data);

	//callback header
	if (recorder->callback)
	{
		recorder->callback(0, recorder->cookie, &recorder->header_data);
	}

	recorder->cameraDevice = CreateCamera(recorder->width, recorder->height);
	CLOG("%s", "create camera ok");

	recorder->cameraDevice->setCameraDatacallback(recorder->cameraDevice, recorder, (void*) &cameraSourceCallback);

	recorder->cameraDevice->startCamera(recorder->cameraDevice);

	/* start encoder */
	recorder->mstart = 1;
	/* create encode thread */
	int err = pthread_create(&recorder->thread_enc_id, NULL, encoderThread, recorder);
	if (err || !recorder->thread_enc_id)
	{
		CLOG("%s", "Create thread_enc_id fail !");
	}
	else
	{
		void* status;
		pthread_join(recorder->thread_enc_id, &status);
	}

	return 1;
}
	// Draw everything in the scene from the viewpoint of the camera given.
	// If no camera is supplied, the most recently created camera is used.
	void CTLXEngineMod::DrawScene
		(
			ICamera* pCamera
			)
	{
		TL_FN("DrawScene");

		ICamera* pTempCamera = 0;
		if (!pCamera)
		{
			if (m_Cameras.size() > 0)
			{
				pCamera = m_Cameras.back();
			}
			else
			{
				pCamera = pTempCamera = CreateCamera(kManual, 0, 0, 0);
			}
		}
		CTLXCamera* pTLXCamera;
		pTLXCamera = dynamic_cast<CTLXCamera*>(pCamera);

		// Engine based update - FPS cameras, and scene manager preparation
		if (pTLXCamera->GetType() == kFPS)
		{
			static float time = m_pTimer->GetTime();
			float newTime = m_pTimer->GetTime();
			float frameTime = newTime - time;
			time = newTime;
			float moveSpeed = pTLXCamera->GetMovementSpeed() * frameTime;
			float rotSpeed = pTLXCamera->GetRotationSpeed() * frameTime;

			if (KeyHeld(Key_Up))
			{
				pTLXCamera->MoveLocalZ(moveSpeed);
			}
			if (KeyHeld(Key_Down))
			{
				pTLXCamera->MoveLocalZ(-moveSpeed);
			}
			if (KeyHeld(Key_Right))
			{
				pTLXCamera->MoveLocalX(moveSpeed);
			}
			if (KeyHeld(Key_Left))
			{
				pTLXCamera->MoveLocalX(-moveSpeed);
			}
			pTLXCamera->RotateY(GetMouseMovementX() * rotSpeed);
			if (g_bLegacyTL)
			{
				pTLXCamera->RotateX(GetMouseMovementY() * rotSpeed);
			}
			else
			{
				pTLXCamera->RotateLocalX(GetMouseMovementY() * rotSpeed);
			}
			m_pWindow->SetMousePosition(m_pWindow->GetWidth() / 2, m_pWindow->GetHeight() / 2);
		}
		m_pSceneManager->Update();

		// Draw scene
		m_pRenderDevice->ClearBackBuffer(true, 0xC0C0C0);
		m_pRenderDevice->StartRender();
		m_pRenderManager->Render(pTLXCamera->GetAbsPositionMatrix(),
			pTLXCamera->GetProjectionMatrix());
		m_pTextureManager->RenderSprites();
		for (TFontListIter itFont = m_Fonts.begin(); itFont != m_Fonts.end(); ++itFont)
		{
			(*itFont)->DrawTextRequests();
		}
		m_pRenderDevice->FinishRender();
		m_pRenderDevice->FlipBackBuffer();

		if (pTempCamera)
		{
			RemoveCamera(pTempCamera);
		}

		TL_ENDFN;
	}
Exemple #19
0
void DeadPlayerFrame (void)
{
	fix			xTimeDead, h;
	CFixVector	fVec;

if (gameStates.app.bPlayerIsDead) {
	xTimeDead = gameData.time.xGame - gameStates.app.nPlayerTimeOfDeath;

	//	If unable to create camera at time of death, create now.
	if (!gameData.objs.deadPlayerCamera) {
		CObject *playerP = OBJECTS + LOCALPLAYER.nObject;
		int nObject = CreateCamera (playerP);
		if (nObject != -1)
			gameData.objs.viewerP = gameData.objs.deadPlayerCamera = OBJECTS + nObject;
		else
			Int3 ();
		}
	h = DEATH_SEQUENCE_EXPLODE_TIME - xTimeDead;
	h = max (0, h);
	gameData.objs.consoleP->mType.physInfo.rotVel = CFixVector::Create(h / 4, h / 2, h / 3);
	xCameraToPlayerDistGoal = min (xTimeDead * 8, I2X (20)) + gameData.objs.consoleP->info.xSize;
	SetCameraPos (&gameData.objs.deadPlayerCamera->info.position.vPos, gameData.objs.consoleP);
	fVec = gameData.objs.consoleP->info.position.vPos - gameData.objs.deadPlayerCamera->info.position.vPos;
	gameData.objs.deadPlayerCamera->info.position.mOrient = CFixMatrix::CreateF(fVec);

	if (xTimeDead > DEATH_SEQUENCE_EXPLODE_TIME) {
		if (!gameStates.app.bPlayerExploded) {
		if (LOCALPLAYER.hostages.nOnBoard > 1)
			HUDInitMessage (TXT_SHIP_DESTROYED_2, LOCALPLAYER.hostages.nOnBoard);
		else if (LOCALPLAYER.hostages.nOnBoard == 1)
			HUDInitMessage (TXT_SHIP_DESTROYED_1);
		else
			HUDInitMessage (TXT_SHIP_DESTROYED_0);

#ifdef TACTILE
			if (TactileStick)
				ClearForces ();
#endif
			gameStates.app.bPlayerExploded = 1;
			if (gameData.app.nGameMode & GM_NETWORK) {
				AdjustMineSpawn ();
				MultiCapObjects ();
				}
			DropPlayerEggs (gameData.objs.consoleP);
			gameStates.app.bPlayerEggsDropped = 1;
			if (IsMultiGame)
				MultiSendPlayerExplode (MULTI_PLAYER_EXPLODE);
			gameData.objs.consoleP->ExplodeBadassPlayer ();
			//is this next line needed, given the badass call above?
			gameData.objs.consoleP->Explode (0);
			gameData.objs.consoleP->info.nFlags &= ~OF_SHOULD_BE_DEAD;		//don't really kill CPlayerData
			gameData.objs.consoleP->info.renderType = RT_NONE;				//..just make him disappear
			gameData.objs.consoleP->SetType (OBJ_GHOST);						//..and kill intersections
			LOCALPLAYER.flags &= ~PLAYER_FLAGS_HEADLIGHT_ON;
#if 0
			if (gameOpts->gameplay.bFastRespawn)
				gameStates.app.bDeathSequenceAborted = 1;
#endif
			}
		}
	else {
		if (d_rand () < gameData.time.xFrame * 4) {
			if (gameData.app.nGameMode & GM_MULTI)
				MultiSendCreateExplosion (gameData.multiplayer.nLocalPlayer);
			CreateSmallFireballOnObject (gameData.objs.consoleP, I2X (1), 1);
			}
		}
	if (gameStates.app.bDeathSequenceAborted) { //xTimeDead > DEATH_SEQUENCE_LENGTH) {
		StopPlayerMovement ();
		gameStates.app.bEnterGame = 2;
		if (!gameStates.app.bPlayerEggsDropped) {
			if (gameData.app.nGameMode & GM_NETWORK) {
				AdjustMineSpawn ();
				MultiCapObjects ();
				}
			DropPlayerEggs (gameData.objs.consoleP);
			gameStates.app.bPlayerEggsDropped = 1;
			if (gameData.app.nGameMode & GM_MULTI)
				MultiSendPlayerExplode (MULTI_PLAYER_EXPLODE);
			}
		DoPlayerDead ();		//kill_playerP ();
		}
	}
}
Exemple #20
0
void StartPlayerDeathSequence (CObject *playerP)
{
	int	nObject;

Assert (playerP == gameData.objs.consoleP);
gameData.objs.speedBoost [OBJ_IDX (gameData.objs.consoleP)].bBoosted = 0;
if (gameStates.app.bPlayerIsDead)
	return;
if (gameData.objs.deadPlayerCamera) {
	ReleaseObject (OBJ_IDX (gameData.objs.deadPlayerCamera));
	gameData.objs.deadPlayerCamera = NULL;
	}
StopConquerWarning ();
//Assert (gameStates.app.bPlayerIsDead == 0);
//Assert (gameData.objs.deadPlayerCamera == NULL);
ResetRearView ();
if (!(gameData.app.nGameMode & GM_MULTI))
	HUDClearMessages ();
nKilledInFrame = gameData.app.nFrameCount;
nKilledObjNum = OBJ_IDX (playerP);
gameStates.app.bDeathSequenceAborted = 0;
if (gameData.app.nGameMode & GM_MULTI) {
	MultiSendKill (LOCALPLAYER.nObject);
//		If Hoard, increase number of orbs by 1
//    Only if you haven't killed yourself
//		This prevents cheating
	if (gameData.app.nGameMode & GM_HOARD)
		if (!bMultiSuicide)
			if (LOCALPLAYER.secondaryAmmo [PROXMINE_INDEX]<12)
				LOCALPLAYER.secondaryAmmo [PROXMINE_INDEX]++;
	}
paletteManager.SetRedEffect (40);
gameStates.app.bPlayerIsDead = 1;
#ifdef TACTILE
   if (TactileStick)
	Buffeting (70);
#endif
//LOCALPLAYER.flags &= ~ (PLAYER_FLAGS_AFTERBURNER);
playerP->mType.physInfo.rotThrust.SetZero ();
playerP->mType.physInfo.thrust.SetZero ();
gameStates.app.nPlayerTimeOfDeath = gameData.time.xGame;
nObject = CreateCamera (playerP);
viewerSaveP = gameData.objs.viewerP;
if (nObject != -1)
	gameData.objs.viewerP = gameData.objs.deadPlayerCamera = OBJECTS + nObject;
else {
	Int3 ();
	gameData.objs.deadPlayerCamera = NULL;
	}
CGenericCockpit::Save (true);
cockpit->Activate (CM_LETTERBOX);
if (gameData.demo.nState == ND_STATE_RECORDING)
	NDRecordLetterbox ();
nPlayerFlagsSave = playerP->info.nFlags;
nControlTypeSave = playerP->info.controlType;
nRenderTypeSave = playerP->info.renderType;
playerP->info.nFlags &= ~OF_SHOULD_BE_DEAD;
//	LOCALPLAYER.flags |= PLAYER_FLAGS_INVULNERABLE;
playerP->info.controlType = CT_NONE;
if (!gameStates.entropy.bExitSequence) {
	playerP->info.xShields = I2X (1000);
	MultiSendShields ();
	}
paletteManager.SetEffect (0, 0, 0);
}