void WBCompEldHands::ShowWeaponAltHUD() const { WBEntity* const pWeapon = GetWeaponAlt(); ASSERT( pWeapon ); WBCompEldWeapon* const pWeaponComponent = GET_WBCOMP( pWeapon, EldWeapon ); ASSERT( pWeaponComponent ); STATIC_HASHED_STRING( HUD ); STATIC_HASHED_STRING( WeaponAltIcon ); { WB_MAKE_EVENT( SetWidgetImage, NULL ); WB_SET_AUTO( SetWidgetImage, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetImage, Hash, Widget, sWeaponAltIcon ); WB_SET_AUTO( SetWidgetImage, Hash, Image, pWeaponComponent->GetWeaponIcon() ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetImage, NULL ); } { WB_MAKE_EVENT( SetWidgetHidden, NULL ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sWeaponAltIcon ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, false ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetHidden, NULL ); } }
/*virtual*/ void WBCompOwner::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); // Bit of a hack; OnEquipped is sent from Eldritch code and this lives in Workbench. STATIC_HASHED_STRING( OnEquipped ); STATIC_HASHED_STRING( SetOwner ); const HashedString EventName = Event.GetEventName(); if( EventName == sOnEquipped ) { STATIC_HASHED_STRING( Owner ); WBEntity* const pOwner = Event.GetEntity( sOwner ); SetOwner( pOwner ); } else if( EventName == sSetOwner ) { STATIC_HASHED_STRING( NewOwner ); WBEntity* const pNewOwner = Event.GetEntity( sNewOwner ); SetOwner( pNewOwner ); } }
/*virtual*/ void WBCompEldSleeper::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Super::HandleEvent(Event); STATIC_HASHED_STRING(OnDamaged); STATIC_HASHED_STRING(OnAINoise); const HashedString EventName = Event.GetEventName(); if (EventName == sOnDamaged) { Wake(); } else if (EventName == sOnAINoise) { STATIC_HASHED_STRING(EventOwner); WBEntity* const pEventOwner = Event.GetEntity(sEventOwner); ASSERT(pEventOwner); if (pEventOwner == GetEntity()) { // Ignore AI noises from self (see SensorHearing for more details). } else { STATIC_HASHED_STRING(NoiseLocation); const Vector NoiseLocation = Event.GetVector(sNoiseLocation); STATIC_HASHED_STRING(NoiseRadius); const float NoiseRadius = Event.GetFloat(sNoiseRadius); HandleNoise(NoiseLocation, NoiseRadius); } } }
void WBCompEldFrobbable::SetHUDHidden(const bool Hidden) const { UIManager* const pUIManager = GetFramework()->GetUIManager(); ASSERT(pUIManager); STATIC_HASHED_STRING(HUD); STATIC_HASHED_STRING(FrobName); STATIC_HASHED_STRING(FrobVerb); STATIC_HASHED_STRING(FrobHold); { WB_MAKE_EVENT(SetWidgetHidden, GetEntity()); WB_SET_AUTO(SetWidgetHidden, Hash, Screen, sHUD); WB_SET_AUTO(SetWidgetHidden, Hash, Widget, sFrobName); WB_SET_AUTO(SetWidgetHidden, Bool, Hidden, Hidden); WB_DISPATCH_EVENT(GetEventManager(), SetWidgetHidden, pUIManager); } { WB_MAKE_EVENT(SetWidgetHidden, GetEntity()); WB_SET_AUTO(SetWidgetHidden, Hash, Screen, sHUD); WB_SET_AUTO(SetWidgetHidden, Hash, Widget, sFrobVerb); WB_SET_AUTO(SetWidgetHidden, Bool, Hidden, Hidden); WB_DISPATCH_EVENT(GetEventManager(), SetWidgetHidden, pUIManager); } { WB_MAKE_EVENT(SetWidgetHidden, GetEntity()); WB_SET_AUTO(SetWidgetHidden, Hash, Screen, sHUD); WB_SET_AUTO(SetWidgetHidden, Hash, Widget, sFrobHold); WB_SET_AUTO(SetWidgetHidden, Bool, Hidden, Hidden || !m_HoldReleaseMode); WB_DISPATCH_EVENT(GetEventManager(), SetWidgetHidden, pUIManager); } }
void WBCompEldSensorTheft::HandleTheft(WBEntity* const pThief) const { WBCompEldTransform* const pTransform = pThief->GetTransformComponent<WBCompEldTransform>(); DEVASSERT(pTransform); WBCompRodinKnowledge* const pKnowledge = GET_WBCOMP(GetEntity(), RodinKnowledge); ASSERT(pKnowledge); WBCompRodinKnowledge::TKnowledge& Knowledge = pKnowledge->UpdateEntity(pThief); STATIC_HASHED_STRING(NeverExpire); Knowledge.SetBool(sNeverExpire, true); STATIC_HASHED_STRING(RegardAsHostile); Knowledge.SetBool(sRegardAsHostile, true); STATIC_HASHED_STRING(LastKnownLocation); Knowledge.SetVector(sLastKnownLocation, pTransform->GetLocation()); ASSERT(!pTransform->GetLocation().IsZero()); STATIC_HASHED_STRING(KnowledgeType); STATIC_HASHED_STRING(Target); Knowledge.SetHash(sKnowledgeType, sTarget); }
/*virtual*/ void WBCompEldLight::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); STATIC_HASHED_STRING( OnMoved ); STATIC_HASHED_STRING( OnDestroyed ); STATIC_HASHED_STRING( AddLight ); STATIC_HASHED_STRING( RemoveLight ); const HashedString EventName = Event.GetEventName(); if( EventName == sOnMoved ) { if( m_DeferAddLight ) { // Do nothing } else { AddLight(); } } else if( EventName == sAddLight ) { AddLight(); } else if( EventName == sOnDestroyed || EventName == sRemoveLight ) { RemoveLight(); } }
/*virtual*/ void WBCompEldAnchor::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); STATIC_HASHED_STRING( OnSpawnedQueued ); STATIC_HASHED_STRING( OnWorldChanged ); STATIC_HASHED_STRING( OnStaticCollisionChanged ); STATIC_HASHED_STRING( Unanchor ); const HashedString EventName = Event.GetEventName(); if( EventName == sOnSpawnedQueued ) { SetAnchor(); } else if( EventName == sOnWorldChanged || EventName == sOnStaticCollisionChanged ) { if( m_IsAnchored ) { CheckAnchor(); } } else if( EventName == sUnanchor ) { if( m_IsAnchored ) { // Forcibly unanchor the entity Unanchor(); } } }
/*virtual*/ void Framework3D::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; STATIC_HASHED_STRING(QuitGame); STATIC_HASHED_STRING(ResetRenderer); STATIC_HASHED_STRING(ConditionalRefreshDisplay); STATIC_HASHED_STRING(RefreshDisplay); const HashedString EventName = Event.GetEventName(); if (EventName == sQuitGame) { #if BUILD_WINDOWS_NO_SDL XTRACE_NAMED(PostQuitMessage); PostQuitMessage(0); #endif #if BUILD_SDL SDL_Event QuitEvent; QuitEvent.type = SDL_QUIT; const int Success = SDL_PushEvent(&QuitEvent); ASSERT(Success); Unused(Success); #endif } else if (EventName == sResetRenderer) { ResetRenderer(); } else if (EventName == sConditionalRefreshDisplay) { ConditionalRefreshDisplay(); } else if (EventName == sRefreshDisplay) { RefreshDisplay(m_Display->m_Fullscreen, m_Display->m_Width, m_Display->m_Height); } }
/*virtual*/ void WBCompEldRope::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Super::HandleEvent(Event); STATIC_HASHED_STRING(OnWorldChanged); STATIC_HASHED_STRING(OnStaticCollisionChanged); STATIC_HASHED_STRING(OnInitialOrientationSet); const HashedString EventName = Event.GetEventName(); if (EventName == sOnWorldChanged || EventName == sOnStaticCollisionChanged) { if (m_Dropped) { // If anchor is removed, destroy the rope (and drop anyone climbing on // it!) CollisionInfo Info; Info.m_CollideWorld = true; Info.m_CollideEntities = true; Info.m_CollidingEntity = GetEntity(); Info.m_UserFlags = EECF_CollideAsEntity | EECF_CollideStaticEntities; EldritchWorld* const pWorld = GetWorld(); if (!pWorld->PointCheck(m_Anchor, Info)) { GetEntity()->Destroy(); } } } else if (EventName == sOnInitialOrientationSet) { DropRope(); } }
/*virtual*/ void WBCompEldHard::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); STATIC_HASHED_STRING( SetHard ); STATIC_HASHED_STRING( PushPersistence ); STATIC_HASHED_STRING( PullPersistence ); const HashedString EventName = Event.GetEventName(); if( EventName == sSetHard ) { m_Hard = true; // Broadcast event to everything with an EldHardListener component. WB_MAKE_EVENT( NotifyHardModeSet, NULL ); WB_DISPATCH_EVENT( GetEventManager(), NotifyHardModeSet, NULL ); } else if( EventName == sPushPersistence ) { PushPersistence(); } else if( EventName == sPullPersistence ) { PullPersistence(); } }
/*virtual*/ void WBCompEldSensorMarkup::PollTick(const float DeltaTime) const { Unused(DeltaTime); const Array<WBCompEldMarkup*>* pMarkupComponents = WBComponentArrays::GetComponents<WBCompEldMarkup>(); if (!pMarkupComponents) { return; } WBEntity* const pEntity = GetEntity(); DEVASSERT(pEntity); WBCompRodinKnowledge* const pKnowledge = GET_WBCOMP(pEntity, RodinKnowledge); ASSERT(pKnowledge); WBCompEldTransform* const pTransform = GetEntity()->GetTransformComponent<WBCompEldTransform>(); DEVASSERT(pTransform); const Vector CurrentLocation = pTransform->GetLocation(); const float RadiusSq = Square(m_Radius); const uint NumMarkups = pMarkupComponents->Size(); for (uint MarkupIndex = 0; MarkupIndex < NumMarkups; ++MarkupIndex) { WBCompEldMarkup* const pMarkup = (*pMarkupComponents)[MarkupIndex]; ASSERT(pMarkup); // Only consider the desired type of markup if (pMarkup->GetMarkup() != m_Markup) { continue; } WBEntity* const pMarkupEntity = pMarkup->GetEntity(); ASSERT(pMarkupEntity); WBCompEldTransform* const pMarkupTransform = pMarkupEntity->GetTransformComponent<WBCompEldTransform>(); // Distance check const float DistanceSq = (pMarkupTransform->GetLocation() - CurrentLocation).LengthSquared(); if (DistanceSq > RadiusSq) { continue; } // Update knowledge with this patrol WBCompRodinKnowledge::TKnowledge& Knowledge = pKnowledge->UpdateEntity(pMarkupEntity); STATIC_HASHED_STRING(DistanceSq); Knowledge.SetFloat(sDistanceSq, DistanceSq); STATIC_HASHED_STRING(LastKnownLocation); Knowledge.SetVector(sLastKnownLocation, pMarkupTransform->GetLocation()); ASSERT(!pMarkupTransform->GetLocation().IsZero()); STATIC_HASHED_STRING(KnowledgeType); Knowledge.SetHash(sKnowledgeType, m_Markup); } }
/*virtual*/ void WBCompEldLock::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); STATIC_HASHED_STRING( OnSpawned ); STATIC_HASHED_STRING( Unlock ); const HashedString EventName = Event.GetEventName(); if( EventName == sOnSpawned ) { EldritchPersistence* const pPersistence = GetGame()->GetPersistence(); ASSERT( pPersistence ); if( pPersistence->IsOpenLock( m_Key ) ) { Unlock(); } } else if( EventName == sUnlock ) { Unlock(); } }
void WBCompEldEndgameCounter::SetHUDHidden( const bool Hidden ) const { UIManager* const pUIManager = GetFramework()->GetUIManager(); ASSERT( pUIManager ); STATIC_HASHED_STRING( HUD ); STATIC_HASHED_STRING( EndgameImg ); STATIC_HASHED_STRING( EndgameCounter ); { WB_MAKE_EVENT( SetWidgetHidden, GetEntity() ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sEndgameImg ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, Hidden ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetHidden, pUIManager ); } { WB_MAKE_EVENT( SetWidgetHidden, GetEntity() ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sEndgameCounter ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, Hidden ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetHidden, pUIManager ); } }
/*virtual*/ void WBCompEldEndgameCounter::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Super::HandleEvent(Event); STATIC_HASHED_STRING(OnInitialized); STATIC_HASHED_STRING(IncrementEndgameCount); STATIC_HASHED_STRING(PushPersistence); STATIC_HASHED_STRING(PullPersistence); const HashedString EventName = Event.GetEventName(); if (EventName == sOnInitialized) { if (m_Count > 0) { PublishToHUD(); } else { SetHUDHidden(true); } } else if (EventName == sIncrementEndgameCount) { ++m_Count; PublishToHUD(); } else if (EventName == sPushPersistence) { PushPersistence(); } else if (EventName == sPullPersistence) { PullPersistence(); } }
WBCompEldRope::~WBCompEldRope() { WBEventManager* const pEventManager = GetEventManager(); if (pEventManager) { STATIC_HASHED_STRING(OnWorldChanged); pEventManager->RemoveObserver(sOnWorldChanged, this); STATIC_HASHED_STRING(OnStaticCollisionChanged); pEventManager->RemoveObserver(sOnStaticCollisionChanged, this); } }
/*virtual*/ void WBCompEldThinkerPatrol::Tick(float DeltaTime) { XTRACE_FUNCTION; Unused(DeltaTime); WBEntity* const pEntity = GetEntity(); DEVASSERT(pEntity); WBCompEldTransform* const pTransform = pEntity->GetTransformComponent<WBCompEldTransform>(); DEVASSERT(pTransform); WBCompRodinKnowledge* const pKnowledge = GET_WBCOMP(pEntity, RodinKnowledge); ASSERT(pKnowledge); WBCompRodinBlackboard* const pBlackboard = GET_WBCOMP(pEntity, RodinBlackboard); ASSERT(pBlackboard); const Vector CurrentLocation = pTransform->GetLocation(); // Select the furthest patrol point that we know about. WBEntity* pFurthestPatrol = nullptr; float FurthestDistSq = -1.0f; const WBCompRodinKnowledge::TKnowledgeMap& KnowledgeMap = pKnowledge->GetKnowledgeMap(); FOR_EACH_MAP(KnowledgeIter, KnowledgeMap, WBEntityRef, WBCompRodinKnowledge::TKnowledge) { WBEntity* pKnowledgeEntity = KnowledgeIter.GetKey().Get(); const WBCompRodinKnowledge::TKnowledge& Knowledge = KnowledgeIter.GetValue(); if (!pKnowledgeEntity) { continue; } // Filter out knowledge entities that aren't patrol markup. STATIC_HASHED_STRING(KnowledgeType); STATIC_HASHED_STRING(Patrol); if (Knowledge.GetHash(sKnowledgeType) != sPatrol) { continue; } WBCompEldTransform* const pKnowledgeTransform = pKnowledgeEntity->GetTransformComponent<WBCompEldTransform>(); ASSERT(pKnowledgeTransform); const float DistSq = (pKnowledgeTransform->GetLocation() - CurrentLocation).LengthSquared(); if (DistSq > FurthestDistSq) { FurthestDistSq = DistSq; pFurthestPatrol = pKnowledgeEntity; } }
WBCompEldAnchor::WBCompEldAnchor() : m_IsAnchored( false ) , m_AnchorPoint() , m_AnchorDirection() { STATIC_HASHED_STRING( OnWorldChanged ); GetEventManager()->AddObserver( sOnWorldChanged, this ); STATIC_HASHED_STRING( OnStaticCollisionChanged ); GetEventManager()->AddObserver( sOnStaticCollisionChanged, this ); }
void EldritchGame::SetUIReturnToHubDisabled( const bool Disabled ) { STATIC_HASHED_STRING( PauseScreen ); STATIC_HASHED_STRING( PausedReturnButton ); WB_MAKE_EVENT( SetWidgetDisabled, NULL ); WB_SET_AUTO( SetWidgetDisabled, Hash, Screen, sPauseScreen ); WB_SET_AUTO( SetWidgetDisabled, Hash, Widget, sPausedReturnButton ); WB_SET_AUTO( SetWidgetDisabled, Bool, Disabled, Disabled ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetDisabled, NULL ); }
void WBCompEldHands::HideWeaponAltHUD() const { STATIC_HASHED_STRING( HUD ); STATIC_HASHED_STRING( WeaponAltIcon ); WB_MAKE_EVENT( SetWidgetHidden, NULL ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sWeaponAltIcon ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, true ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetHidden, NULL ); }
void WBCompEldPickup::UnregisterForPurchaseEvents() { WBEventManager* const pEventManager = GetEventManager(); if (pEventManager) { STATIC_HASHED_STRING(OnPurchaseBuy); pEventManager->RemoveObserver(sOnPurchaseBuy, this, nullptr); STATIC_HASHED_STRING(OnPurchaseSteal); pEventManager->RemoveObserver(sOnPurchaseSteal, this, nullptr); STATIC_HASHED_STRING(OnShopkeeperDied); pEventManager->RemoveObserver(sOnShopkeeperDied, this, nullptr); } }
/*virtual*/ void WBCompEldPickup::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); STATIC_HASHED_STRING( OnFrobbed ); STATIC_HASHED_STRING( OnPurchaseBuy ); STATIC_HASHED_STRING( OnPurchaseSteal ); STATIC_HASHED_STRING( OnShopkeeperDied ); const HashedString EventName = Event.GetEventName(); if( EventName == sOnShopkeeperDied ) { m_Price = 0; } else if( EventName == sOnFrobbed ) { STATIC_HASHED_STRING( Frobber ); WBEntity* const pFrobber = Event.GetEntity( sFrobber ); ASSERT( pFrobber ); if( m_Price > 0 ) { SellItemTo( pFrobber ); } else { GiveItemTo( pFrobber ); } } else if( EventName == sOnPurchaseBuy ) { if( this == sm_PurchasePickup ) { ASSERT( sm_Purchaser ); AcceptPaymentFrom( sm_Purchaser ); NotifyPurchasedBy( sm_Purchaser ); GiveItemTo( sm_Purchaser ); } } else if( EventName == sOnPurchaseSteal ) { if( this == sm_PurchasePickup ) { ASSERT( sm_Purchaser ); NotifyTheftBy( sm_Purchaser ); GiveItemTo( sm_Purchaser ); } } }
/*virtual*/ void WBCompEldWallet::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Super::HandleEvent(Event); STATIC_HASHED_STRING(AddMoney); STATIC_HASHED_STRING(RemoveMoney); STATIC_HASHED_STRING(OnInitialized); STATIC_HASHED_STRING(PushPersistence); STATIC_HASHED_STRING(PullPersistence); const HashedString EventName = Event.GetEventName(); if (EventName == sOnInitialized) { PublishToHUD(); } else if (EventName == sAddMoney) { STATIC_HASHED_STRING(Money); const uint Money = Event.GetInt(sMoney); STATIC_HASHED_STRING(ShowPickupScreen); const bool ShowPickupScreen = Event.GetBool(sShowPickupScreen); AddMoney(Money, ShowPickupScreen); } else if (EventName == sRemoveMoney) { STATIC_HASHED_STRING(Money); const uint Money = Event.GetInt(sMoney); RemoveMoney(Money); } else if (EventName == sPushPersistence) { PushPersistence(); } else if (EventName == sPullPersistence) { PullPersistence(); } }
/*virtual*/ void WBCompState::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Super::HandleEvent(Event); STATIC_HASHED_STRING(SetState); const HashedString EventName = Event.GetEventName(); if (EventName == sSetState) { STATIC_HASHED_STRING(NewState); const HashedString State = Event.GetHash(sNewState); SetState(State); } }
/*virtual*/ void SDPEldWorld::SetShaderParameters( IRenderer* const pRenderer, Mesh* const pMesh, const View& View ) const { SDPBase::SetShaderParameters( pRenderer, pMesh, View ); EldritchFramework* const pFramework = EldritchFramework::GetInstance(); EldritchGame* const pGame = pFramework->GetGame(); const Vector4 FogParams = pGame->GetFogParams(); const Vector4 FogPosition = View.m_Location; STATIC_HASHED_STRING( FogParams ); pRenderer->SetPixelShaderFloat4( sFogParams, FogParams.GetArray(), 1 ); STATIC_HASHED_STRING( FogViewPosition ); pRenderer->SetPixelShaderFloat4( sFogViewPosition, FogPosition.GetArray(), 1 ); }
/*virtual*/ void WBCompEldVisible::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Super::HandleEvent(Event); STATIC_HASHED_STRING(SetVisible); STATIC_HASHED_STRING(SetInvisible); const HashedString EventName = Event.GetEventName(); if (EventName == sSetVisible) { m_Visible = true; } else if (EventName == sSetInvisible) { m_Visible = false; } }
/*virtual*/ void EldritchPersistence::HandleEvent( const WBEvent& Event ) { STATIC_HASHED_STRING( SetPersistentVar ); const HashedString EventName = Event.GetEventName(); if( EventName == sSetPersistentVar ) { STATIC_HASHED_STRING( Name ); const HashedString Name = Event.GetHash( sName ); STATIC_HASHED_STRING( Value ); const WBEvent::SParameter* const pParameter = Event.GetParameter( sValue ); m_VariableMap.Set( Name, pParameter ); } }
/*virtual*/ void EldritchFramework::HandleEvent(const WBEvent& Event) { XTRACE_FUNCTION; Framework3D::HandleEvent(Event); STATIC_HASHED_STRING(ToggleInvertY); STATIC_HASHED_STRING(ToggleFullscreen); STATIC_HASHED_STRING(OnSliderChanged); STATIC_HASHED_STRING(WritePrefsConfig); STATIC_HASHED_STRING(CheckForUpdates); const HashedString EventName = Event.GetEventName(); if (EventName == sToggleInvertY) { XTRACE_NAMED(ToggleInvertY); // TODO: Also invert controller? Or on a separate button? STATIC_HASHED_STRING(TurnY); const bool InvertY = !m_InputSystem->GetMouseInvert(sTurnY); m_InputSystem->SetMouseInvert(sTurnY, InvertY); m_InputSystem->SetControllerInvert(sTurnY, InvertY); // Publish config var so UI can reflect the change. // I could make input system publish config vars for each adjustment, but // that seems wasteful since most inputs currently have no adjustment. STATICHASH(InvertY); ConfigManager::SetBool(sInvertY, InvertY); } else if (EventName == sToggleFullscreen) { XTRACE_NAMED(ToggleFullscreen); ToggleFullscreen(); } else if (EventName == sOnSliderChanged) { XTRACE_NAMED(OnSliderChanged); STATIC_HASHED_STRING(SliderName); const HashedString SliderName = Event.GetHash(sSliderName); STATIC_HASHED_STRING(SliderValue); const float SliderValue = Event.GetFloat(sSliderValue); HandleUISliderEvent(SliderName, SliderValue); } else if (EventName == sWritePrefsConfig) { XTRACE_NAMED(WritePrefsConfig); WritePrefsConfig(); } else if (EventName == sCheckForUpdates) { #if BUILD_WINDOWS && !BUILD_STEAM XTRACE_NAMED(CheckForUpdates); // So I can compile updating out of certain builds. STATICHASH(Framework); STATICHASH(CheckForUpdates); const bool CheckForUpdates = ConfigManager::GetBool(sCheckForUpdates, true, sFramework); if (CheckForUpdates) { m_CheckForUpdates->Check(false, true); } #endif } }
/*virtual*/ void SDPEldHUD::SetShaderParameters( IRenderer* const pRenderer, Mesh* const pMesh, const View& View ) const { SDPBase::SetShaderParameters( pRenderer, pMesh, View ); STATIC_HASHED_STRING( ConstantColor ); pRenderer->SetPixelShaderFloat4( sConstantColor, pMesh->m_ConstantColor.GetArray(), 1 ); }
void D3D9Renderer::Tick() { XTRACE_FUNCTION; PROFILE_FUNCTION; // Restore lost device if (!IsValid() && CanReset()) { if (m_RestoreDeviceCallback.m_Callback) { m_RestoreDeviceCallback.m_Callback(m_RestoreDeviceCallback.m_Void); } return; } #if BUILD_DEBUG m_DEBUGRenderStats.NumMeshes = 0; m_DEBUGRenderStats.NumPrimitives = 0; #endif m_D3DDevice->BeginScene(); RenderBuckets(); PostRenderBuckets(); m_D3DDevice->EndScene(); Present(); #if BUILD_DEBUG STATIC_HASHED_STRING(Render); DEBUGCATPRINTF(sRender, 2, "%d meshes, %d primitives\n", m_DEBUGRenderStats.NumMeshes, m_DEBUGRenderStats.NumPrimitives); #endif }
bool UIInputMapEldritch::OnCancel() { Keyboard* const pKeyboard = m_Framework->GetKeyboard(); XInputController* const pController = m_Framework->GetController(); InputSystem* const pInputSystem = m_Framework->GetInputSystem(); STATIC_HASHED_STRING(Frob); const uint Keyboard_Frob = pInputSystem->GetBoundKeyboardSignal(sFrob); if (pKeyboard->OnRise(Keyboard_Frob)) { return true; } if (pKeyboard->OnRise(Keyboard::EB_Escape)) { return true; } const uint Controller_Frob = pInputSystem->GetBoundControllerSignal(sFrob); if (pController->OnRise(Controller_Frob)) { return true; } if (pController->OnRise(XInputController::EB_B)) { return true; } return false; }