Ejemplo n.º 1
0
int CObject::Update (void)
{
	short	nPrevSegment = (short) info.nSegment;

#if DBG
if ((info.nType == OBJ_WEAPON) && (info.nId == SMARTMINE_BLOB_ID)) {
	nDbgObj = OBJ_IDX (this);
	nDbgObj = nDbgObj;
	}
if (OBJ_IDX (this) == nDbgObj)
	nDbgObj = nDbgObj;
#endif
if (info.nType == OBJ_ROBOT) {
	if (gameOpts->gameplay.bNoThief && (!IsMultiGame || IsCoopGame) && ROBOTINFO (info.nId).thief) {
		info.xShields = 0;
		info.xLifeLeft = 0;
		Die ();
		}
	else {
		fix xMaxShields = RobotDefaultShields (this);
		if (info.xShields > xMaxShields)
			info.xShields = xMaxShields;
		}
	}
info.vLastPos = info.position.vPos;			// Save the current position
RepairDamage ();
HandleSpecialSegment ();
if ((info.xLifeLeft != IMMORTAL_TIME) &&
	 (info.xLifeLeft != ONE_FRAME_TIME) &&
	 (gameData.physics.xTime != I2X (1)))
	info.xLifeLeft -= (fix) (gameData.physics.xTime / gameStates.gameplay.slowmo [0].fSpeed);		//...inevitable countdown towards death
gameStates.render.bDropAfterburnerBlob = 0;
if ((gameData.physics.xTime != I2X (1)) && UpdateControl ()) {
	UpdateEffects ();
	return 1;
	}
if (info.xLifeLeft < 0) {		// We died of old age
	Die ();
	if ((info.nType == OBJ_WEAPON) && WI_damage_radius (info.nId))
		ExplodeBadassWeapon (info.position.vPos);
	else if (info.nType == OBJ_ROBOT)	//make robots explode
		Explode (0);
	}
if ((info.nType == OBJ_NONE) || (info.nFlags & OF_SHOULD_BE_DEAD)) {
	return 1;			//CObject has been deleted
	}
UpdateMovement ();
UpdateEffects ();
if (CheckTriggerHits (nPrevSegment))
	return 0;
CheckWallPhysics ();
CheckGuidedMissileThroughExit (nPrevSegment);
CheckAfterburnerBlobDrop ();
return 1;
}
Ejemplo n.º 2
0
void EffectSystem::Update(float _dt)
{
	/*
	If currentTime is >= then maxTime, reset to 0, else add _dt
	*/
	m_currentTime = m_currentTime >= m_maxTime ? 0 : m_currentTime + _dt;

	// Go through all entites
	for (auto entityPair : m_entityMap)
	{
		Entity* e = entityPair.second;

		m_flags = e->GetComponent<EffectComponent>()->m_effects;

		// OnEveryFrame
		OnEveryFrame(e, _dt);

		// OneEverySecond
		if (m_currentTime >= m_maxTime)
			OnEverySecond(e, _dt);


		// OnCollision
		auto collide = e->GetComponent<CollisionComponent>();
		if (collide)
		{
			if (collide->GetCollisions().size() > 0)
				OnCollision(e, _dt);
		}
	}

	UpdateEffects(_dt);
}
void CtaArtefactActivation::UpdateActivation()
{
	if (!IsInProgress())
		return;

	VERIFY(!physics_world()->Processing());
	m_cur_state_time				+=	Device.fTimeDelta;
	if(m_cur_state_time				>=	m_activation_states[int(m_cur_activation_state)].m_time){
		m_cur_activation_state		=	(EActivationStates)(int)(m_cur_activation_state+1);
		
		if(m_cur_activation_state == eMax){
			m_cur_activation_state = eNone;
			//m_af->processing_deactivate			();
			//m_af->DestroyObject();
		}

		m_cur_state_time	= 0.0f;
		ChangeEffects				();


	if(m_cur_activation_state==eSpawnZone && OnServer())
		SpawnAnomaly	();

	}
	UpdateEffects				();
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponMedigun::WeaponReset( void )
{
	BaseClass::WeaponReset();

	m_flHealEffectLifetime = 0;

	m_bHealing = false;
	m_bAttacking = false;
	m_bHolstered = true;
	m_bChargeRelease = false;

	m_bCanChangeTarget = true;

	m_flNextBuzzTime = 0;
	m_flReleaseStartedAt = 0;
	m_flChargeLevel = 0.0f;

	RemoveHealingTarget( true );

#if defined( CLIENT_DLL )
	m_bPlayingSound = false;
	m_bUpdateHealingTargets = false;
	m_bOldChargeRelease = false;

	UpdateEffects();
	ManageChargeEffect();

	m_pChargeEffect = NULL;
	m_pChargedSound = NULL;
#endif

}
Ejemplo n.º 5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_FireSmoke::Update( void )
{
	//If we haven't already, find the clip plane for smoke effects
	if ( ( m_nFlags & bitsFIRESMOKE_SMOKE ) && ( m_bClipTested == false ) )
	{
		FindClipPlane();
	}

	//Update all our parts
	UpdateEffects();
	UpdateScale();
	UpdateAnimation();
	UpdateFlames();

	//See if we should emit smoke
	if ( m_nFlags & bitsFIRESMOKE_SMOKE )
	{
		float tempDelta = Helper_GetFrameTime();

		while( m_tParticleSpawn.NextEvent( tempDelta ) )
		{
			SpawnSmoke();
		}
	}
}
Ejemplo n.º 6
0
void Texture::Draw(uint32_t Diff)
{
    UpdateEffects(Diff);
    ShakeTime = max(0, ShakeTime - (int32_t)Diff);
    ShakeTick = ShakeTime ? !ShakeTick : false;

    float sx = XScale / 1000.f;
    float sy = YScale / 1000.f;
    float ox = OX * (1.f - sx);
    float oy = OY * (1.f - sy);
    float s = sin(Angle * M_PI / 180.);
    float c = cos(Angle * M_PI / 180.);
    float XA[4] = {X, X + Width * sx, X + Width * sx, X};
    float YA[4] = {Y, Y, Y + Height * sy, Y + Height * sy};
    for (int i = 0; i < 4; ++i)
    {
        XA[i] -= X + OX * sx;
        YA[i] -= Y + OY * sy;
        float xn = XA[i] * c - YA[i] * s;
        float yn = XA[i] * s + YA[i] * c;
        XA[i] = xn + X + OX * sx + ox;
        YA[i] = yn + Y + OY * sy + oy;
        XA[i] += ShakeTick * XShake;
        YA[i] += ShakeTick * YShake;
    }

    if (pBlur) pBlur->OnDraw(this, XA, YA, Width * sx, Height * sy);
    else GLTexture::Draw(XA, YA);

    if (glUseProgramObjectARB)
        glUseProgramObjectARB(0);
}
Ejemplo n.º 7
0
void SArtefactActivation::UpdateActivation()
{
	VERIFY(!ph_world->Processing());
	m_cur_state_time				+=	Device.fTimeDelta;
	if(m_cur_state_time				>=	m_activation_states[int(m_cur_activation_state)].m_time){
		m_cur_activation_state		=	(EActivationStates)(int)(m_cur_activation_state+1);
		
		if(m_cur_activation_state == eMax){
			m_cur_activation_state = eNone;

			m_af->processing_deactivate			();
			m_af->CPHUpdateObject::Deactivate	();
			m_af->DestroyObject();
		}

		m_cur_state_time	= 0.0f;
		ChangeEffects				();


	if(m_cur_activation_state==eSpawnZone && OnServer())
		SpawnAnomaly	();

	}
	UpdateEffects				();

}
Ejemplo n.º 8
0
void Vehicle::Update()
{
  UpdateHUD();
  UpdateWheels();
  UpdateEffects();
  UpdateSounds();
  UpdateCameraEntity();
  UpdateLight();
}
Ejemplo n.º 9
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : bnewentity - 
//-----------------------------------------------------------------------------
void C_FireSmoke::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged( updateType );

	UpdateEffects();

	if ( updateType == DATA_UPDATE_CREATED )
	{
		Start();
	}
}
Ejemplo n.º 10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CWeaponMedigun::Lower( void )
{
	// Stop healing if we are
	if ( m_bHealing )
	{
		RemoveHealingTarget( true );
		m_bAttacking = false;

#ifdef CLIENT_DLL
		UpdateEffects();
#endif
	}

	return BaseClass::Lower();
}
Ejemplo n.º 11
0
void CChannelHandler::ProcessChannel()
{
	// Run all default and common channel processing
	// This gets called each frame
	//

	UpdateDelay();
	UpdateNoteCut();

	if (!m_bEnabled)
		return;

	UpdateVolumeSlide();
	UpdateVibratoTremolo();
	UpdateEffects();
}
Ejemplo n.º 12
0
/**
 * Draw the button on screen
 */
void ListEmuBrowser::Draw()
{
	if(!this->IsVisible())
		return;
	
	bgSaveSelectionImg->Draw();
	browserSeparatorImg->Draw();
	infosWindow->Draw();
	scrollbar->Draw();
	
	for(u32 i = 0; i < saveBtn.size(); i++)
	{
		saveBtn[i]->Draw();
	}
	
	UpdateEffects();
}
Ejemplo n.º 13
0
void GuiScrollbar::Draw()
{
	if(PageSize <= EntrieCount)
	{
		scrollbarTileImg->Draw();
		scrollbarTopImg->Draw();
		scrollbarBottomImg->Draw();
		arrowUpBtn->Draw();
		arrowDownBtn->Draw();
		scrollbarBoxBtn->Draw();
	}

	if(pressedChan >= 0 && userInput[pressedChan].wpad.ir.valid)
		oneButtonScrollImg->Draw();

	UpdateEffects();
}
Ejemplo n.º 14
0
/**
 * Draw the button on screen
 */
void IconSaveBrowser::Draw()
{
	if(!IsVisible())
		return;

	bgSelectionImg->Draw();
	scrollbar->Draw();

	for(u32 i = 0; i < Buttons.size(); i++)
	{
		Buttons[i]->Draw();
	}

	//needs a redraw for overrendering
	if(parentElement && parentElement->GetState() != STATE_DISABLED)
	{
		if(state == STATE_DISABLED)
			state = STATE_DEFAULT;

		bool tooltip = false;
		if (SelectTimer.elapsed() > 2 && Settings.Tooltips && browser->GetSaveListCount())
		{
			for (int ind = 3; ind >= 0; ind--)
			{
				if (userInput[ind].wpad.ir.valid)
				{
					if (Buttons[selectedItem]->IsInside(userInput[ind].wpad.ir.x, userInput[ind].wpad.ir.y))
					{
						Tooltip[selectedItem]->Draw();
						tooltip = true;
					}
				}
			}
			if(!tooltip)
				SelectTimer.reset();
		}
	}
	else
	{
		if(state == STATE_DEFAULT)
			state = STATE_DISABLED;
	}

	UpdateEffects();
}
Ejemplo n.º 15
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponMedigun::UpdateOnRemove( void )
{
	RemoveHealingTarget( true );
	m_bAttacking = false;

#ifdef CLIENT_DLL
	if ( m_bPlayingSound )
	{
		m_bPlayingSound = false;
		StopHealSound();
	}

	UpdateEffects();
#endif



	BaseClass::UpdateOnRemove();
}
	void FMixerSource::Update()
	{
		SCOPE_CYCLE_COUNTER(STAT_AudioUpdateSources);

		if (!WaveInstance || !MixerSourceVoice || Paused || !bInitialized)
		{
			return;
		}

		UpdatePitch();

		UpdateVolume();

		UpdateSpatialization();

		UpdateEffects();

		UpdateChannelMaps();

		FSoundSource::DrawDebugInfo();
	}
Ejemplo n.º 17
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : updateType - 
//-----------------------------------------------------------------------------
void CWeaponMedigun::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged( updateType );

	if ( m_bUpdateHealingTargets )
	{
		UpdateEffects();
		m_bUpdateHealingTargets = false;
	}

	// Think?
	if ( m_bHealing )
	{
		ClientThinkList()->SetNextClientThink( GetClientHandle(), CLIENT_THINK_ALWAYS );
	}
	else
	{
		ClientThinkList()->SetNextClientThink( GetClientHandle(), CLIENT_THINK_NEVER );
		m_bPlayingSound = false;
		StopHealSound( true, false );

		// Are they holding the attack button but not healing anyone? Give feedback.
		if ( IsActiveByLocalPlayer() && GetOwner() && GetOwner()->IsAlive() && m_bAttacking && GetOwner() == C_BasePlayer::GetLocalPlayer() && CanAttack() == true )
		{
			if ( gpGlobals->curtime >= m_flNextBuzzTime )
			{
				CLocalPlayerFilter filter;
				EmitSound( filter, entindex(), "WeaponMedigun.NoTarget" );
				m_flNextBuzzTime = gpGlobals->curtime + 0.5f;	// only buzz every so often.
			}
		}
		else
		{
			StopHealSound( false, true );	// Stop the "no target" sound.
		}
	}

	ManageChargeEffect();
}
Ejemplo n.º 18
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CWeaponMedigun::Holster( CBaseCombatWeapon *pSwitchingTo )
{
	RemoveHealingTarget( true );
	m_bAttacking = false;
	m_bHolstered = true;



#ifdef GAME_DLL
	CTFPlayer *pOwner = ToTFPlayer( GetOwnerEntity() );
	if ( pOwner )
	{
		pOwner->m_Shared.RecalculateChargeEffects( true );
	}
#endif

#ifdef CLIENT_DLL
	UpdateEffects();
	ManageChargeEffect();
#endif

	return BaseClass::Holster( pSwitchingTo );
}
Ejemplo n.º 19
0
void C_ASW_TeslaTrap::OnDataChanged( DataUpdateType_t type )
{	
	/*
	bool bPredict = ShouldPredict();
	if (bPredict)
	{
		SetPredictionEligible( true );
	}
	else
	{
		SetPredictionEligible( false );
	}
*/
	BaseClass::OnDataChanged( type );

	if ( type == DATA_UPDATE_CREATED )
	{
		// We want to think every frame.
		SetNextClientThink( CLIENT_THINK_ALWAYS );
	}

	UpdateEffects();
}
Ejemplo n.º 20
0
void C_ASW_Shaman::ClientThink()
{
	BaseClass::ClientThink();

	UpdateEffects();
}
Ejemplo n.º 21
0
void BoxCover::Draw()
{
	u8 BoxAlpha = (int) (alpha+alphaDyn) & 0xFF;

	GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);

	GX_ClearVtxDesc();
	GX_InvVtxCache();
	GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
	GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
	GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX8);

	//! don't draw inside of the box
	GX_SetCullMode(GX_CULL_FRONT);

	Mtx	modelView;
	Mtx	modelView2;
	Mtx	modelView3;

	guVector cubeAxis = {0,0,1};
	guVector cubeAxis2 = {0,1,0};
	guVector cubeAxis3 = {1,0,0};
	guMtxIdentity(modelView);
	guMtxRotAxisDeg(modelView3, &cubeAxis3, RotX-Animation2);
	guMtxRotAxisDeg(modelView2, &cubeAxis2, RotY+Animation2+xoffsetDyn/2.0f);
	guMtxRotAxisDeg(modelView, &cubeAxis, RotZ-Animation);
	guMtxConcat(modelView3, modelView2, modelView2);
	guMtxConcat(modelView2, modelView, modelView);
	if(Settings.widescreen)
		guMtxScaleApply(modelView, modelView, Settings.WSFactor, 1.0f, 1.0f);
	guMtxTransApply(modelView, modelView, PosX+xoffsetDyn/680.0f+movePosX, PosY+yoffsetDyn/680.0f+movePosY, PosZ);
	guMtxConcat(view,modelView,modelView);

	GX_LoadPosMtxImm(modelView,	GX_PNMTX0);

	//! Border quads
	GX_LoadTexObj(&boxBorderTex, GX_TEXMAP0);
	GX_InvalidateTexAll();

	GX_SetArray(GX_VA_POS, (void *) &g_boxMeshQ[0].pos, sizeof(g_boxMeshQ[0]));
	GX_SetArray(GX_VA_TEX0, (void *) &g_boxMeshQ[0].texCoord, sizeof(g_boxMeshQ[0]));

	GX_Begin(GX_QUADS, GX_VTXFMT0, g_boxMeshQSize);
	for (u32 j = 0; j < g_boxMeshQSize; ++j)
	{
		GX_Position1x8(j);
		GX_Color4u8(boxColor.r, boxColor.g, boxColor.b, BoxAlpha);
		GX_TexCoord1x8(j);
	}
	GX_End();

	//! Border triangles
	GX_SetArray(GX_VA_POS, (void *) &g_boxMeshT[0].pos, sizeof(g_boxMeshT[0]));
	GX_SetArray(GX_VA_TEX0, (void *) &g_boxMeshT[0].texCoord, sizeof(g_boxMeshT[0]));

	GX_Begin(GX_TRIANGLES, GX_VTXFMT0, g_boxMeshTSize);
	for (u32 j = 0; j < g_boxMeshTSize; ++j)
	{
		GX_Position1x8(j);
		GX_Color4u8(boxColor.r, boxColor.g, boxColor.b, BoxAlpha);
		GX_TexCoord1x8(j);
	}
	GX_End();

	//! Back Cover (Might be flat)
	GX_LoadTexObj(flatCover ? &defaultBoxTex : &coverTex, GX_TEXMAP0);
	GX_InvalidateTexAll();

	GX_SetArray(GX_VA_POS, (void *) &g_boxBackCoverMesh[0].pos, sizeof(g_boxBackCoverMesh[0]));
	GX_SetArray(GX_VA_TEX0, (void *) &g_boxBackCoverMesh[0].texCoord, sizeof(g_boxBackCoverMesh[0]));

	GX_Begin(GX_QUADS, GX_VTXFMT0, g_boxBackCoverMeshSize);
	for (u32 j = 0; j < g_boxBackCoverMeshSize; ++j)
	{
		GX_Position1x8(j);
		if(flatCover)
			GX_Color4u8(boxColor.r, boxColor.g, boxColor.b, BoxAlpha);
		else
			GX_Color4u8(0xff, 0xff, 0xff, BoxAlpha);
		GX_TexCoord1x8(j);
	}
	GX_End();

	if(flatCover)
	{
		//! Front Flat Cover
		GX_LoadTexObj(&coverTex, GX_TEXMAP0);
		GX_InvalidateTexAll();

		GX_SetArray(GX_VA_POS, (void *) &g_flatCoverMesh[0].pos, sizeof(g_flatCoverMesh[0]));
		GX_SetArray(GX_VA_TEX0, (void *) &g_flatCoverMesh[0].texCoord, sizeof(g_flatCoverMesh[0]));

		GX_Begin(GX_QUADS, GX_VTXFMT0, g_flatCoverMeshSize);
		for (u32 j = 0; j < g_flatCoverMeshSize; ++j)
		{
			GX_Position1x8(j);
			GX_Color4u8(0xff, 0xff, 0xff, 0xff);
			GX_TexCoord1x8(j);
		}
		GX_End();
	}
	else
	{
		//! Front Cover
		GX_SetArray(GX_VA_POS, (void *) &g_boxCoverMesh[0].pos, sizeof(g_boxCoverMesh[0]));
		GX_SetArray(GX_VA_TEX0, (void *) &g_boxCoverMesh[0].texCoord, sizeof(g_boxCoverMesh[0]));

		GX_Begin(GX_QUADS, GX_VTXFMT0, g_boxCoverMeshSize);
		for (u32 j = 0; j < g_boxCoverMeshSize; ++j)
		{
			GX_Position1x8(j);
			GX_Color4u8(0xff, 0xff, 0xff, BoxAlpha);
			GX_TexCoord1x8(j);
		}
		GX_End();
	}

	//! stop cull
	GX_SetCullMode(GX_CULL_NONE);

	UpdateEffects();
}
Ejemplo n.º 22
0
void BattleSystem::Encounter( Character& player, Character& AI ) const
{
    std::string events;
    std::string output;
    bool flee = false;
    auto ExitCondition = [] ( const std::array<bool, 3> conditions )
    {
        static const std::array<std::string, 3> output
        {
            "lose!\n",
            "win!\n",
            "flee the battle!\n"
        };
        
        for( int i = 0, limit = conditions.size( ); i < limit; i++ )
        {
            if( conditions[i] )
            {
                std::cout << "\nYou " << output[i];
                std::cout << "Press enter to continue: ";
                SelectEnter( );

                return true;
            }
        }

        return false;
    };

    while( true )
    {
        ClearScreen( );
        output.clear( );
        output
            .append( "> BATTLE <\n- " )
            .append( player.name )
            .append( " vs " )
            .append( AI.name )
            .append( "!\n\n> EVENTS <\n" )
            .append( events )
            .append( "\n> HEALTH <\n- " )
            .append( player.name )
            .append( ": " )
            .append( GetStringHealth( player.health ) )
            .append( "\n- " )
            .append( AI.name )
            .append( ": " )
            .append( GetStringHealth( AI.health ) )
            .append( "\n\n> ACTION <\n" );
        std::cout << output;

        if( ExitCondition( { !player.active, !AI.active, flee } ) )
        {
            break;
        }

        events.clear( );
        events += UpdateEffects( player );
        events += UpdateEffects( AI );
        events += TurnPlayer( player, AI, output, flee );
        events += TurnAI( AI, player );
        player.Update( );
        AI.Update( );
    }
}